code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
import numpy as np, math
X,Y = np.meshgrid( np.arange(0.0,11.0), np.arange(0.0,7.0) )
xy = np.column_stack([ X.flatten(), Y.flatten() ])
cap = ''
for i in xy:
for j in [0.0, 90.0, 180.0, 270.0]:
# for j in [0.0, 180.0]:
cap += ' - [%6.1f, %6.1f, %6.1f]\n' % (i[0],i[1],j)
f = open( 'captures.yaml', 'w' )
f.write( cap )
f.close()
| ajibawa-2023/Python-Code-Large/train/row_99400 | 9 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99400:Import_L1_C0", "label": "numpy import np, math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99400:Assign_L3_C0", "label": "X, Y = meshgrid()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.2143, 0.0714, 0, 0.66, 0.1429, 835, 3, 2, 0, 0, 500, 10, 3], "semantic": {"name": "X, Y", "arg_names": [], "import_names": [], "rhs_call_name": "meshgrid", "annotation": ""}, "snippet": "X,Y = np.meshgrid( np.arange(0.0,11.0), np.arange(0.0,7.0) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99400:Assign_L4_C0", "label": "xy = column_stack()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2857, 0.0714, 0, 0.66, 0.2857, 358, 3, 1, 0, 0, 724, 10, 3], "semantic": {"name": "xy", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": "xy = np.column_stack([ X.flatten(), Y.flatten() ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99400:Assign_L6_C0", "label": "cap =", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.4286, 0.0714, 0, 0.66, 0.4286, 786, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "cap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "cap = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99400:For_L7_C0", "label": "for i", "type": "for", "loc": [7, 10], "level": 0, "parent": null, "vector": [6, 0, 0.6071, 0.2857, 0, 0.66, 0.5714, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in xy:\n for j in [0.0, 90.0, 180.0, 270.0]:\n # for j in [0.0, 180.0]:\n cap += ' - [%6.1f, %6.1f, %6.1f]\\n' % (i[0],i[1],j)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99400:For_L8_C4", "label": "for j", "type": "for", "loc": [8, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99400:For_L7_C0", "vector": [6, 1, 0.6429, 0.2143, 1, 0.44, 0.0, 100, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in [0.0, 90.0, 180.0, 270.0]:\n # for j in [0.0, 180.0]:\n cap += ' - [%6.1f, %6.1f, %6.1f]\\n' % (i[0],i[1],j)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99400:Assign_L12_C0", "label": "f = open()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.8571, 0.0714, 0, 0.66, 0.7143, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open( 'captures.yaml', 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99400:Expr_L13_C0", "label": "write()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.9286, 0.0714, 0, 0.66, 0.8571, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write( cap )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99400:Expr_L14_C0", "label": "close()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0714, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "f.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99400:For_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99400:For_L8_C4"}] |
import numpy as np
from numpy import pi
import time
import transforms as tr
import pylab as pl
import functools as fct
import pickle as pkl
from scipy.special import erf
import prob as pb
import optparse
waveLen = 3e8 / 900e6 # Middle of UHF RFID band
class AntennaGain():
def __init__(self, RadiationPattern, Gmax = None, GmaxDB = None, front_back_ratio = None):
if Gmax is not None:
self.gain = Gmax
elif GmaxDB is not None:
self.gain = 10.0 ** (GmaxDB/10.0)
else:
self.gain = 1.0
# If the FBR is 8 dB => fbr = DBToWatts( -8 )
self.fbr = front_back_ratio
self.RadiationPattern = RadiationPattern
def G(self, theta, phi):
rv = self.RadiationPattern( standard_rad(theta), standard_rad(phi)) * self.gain
# Account for front-back ratio
if self.fbr:
rv = np.max([ self.fbr * self.gain, rv ])
return rv
def Gdb(self, theta, phi):
#return np.max([ -80.0, WattsToDB( self.G( theta, phi ))]) # Assume always > -80db
return WattsToDB( self.G( theta, phi ))
def CartToSphere(x, y, z):
r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)
theta = np.arctan2( np.power(np.power(x,2) + np.power(y,2),0.5) , z)
phi = np.arctan2( y, x )
return (r,theta,phi)
def CartToSphere2(x, y, z): # Equivalent
r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)
theta = np.arccos( z / r )
phi = np.arctan2( y, x )
return (r,theta,phi)
def mCartToSphere(v):
x = v[0]
y = v[1]
z = v[2]
r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)
theta = np.arctan2( np.power(np.power(x,2) + np.power(y,2),0.5) , z)
phi = np.arctan2( y, x )
return (r,theta,phi)
def SphereToCart(r, theta, phi):
x = r * np.sin(theta) * np.cos(phi)
y = r * np.sin(theta) * np.sin(phi)
z = r * np.cos(theta)
return (x,y,z)
def WattsToDBm(pwr):
return 10.0 * np.log10(pwr) + 30.0
def WattsToDB(pwr):
return 10.0 * np.log10(pwr)
def DBmToWatts(pwr):
return np.power(10.0, (pwr - 30.0) / 10.0)
def DBToWatts(pwr):
return np.power(10.0, (pwr) / 10.0)
def PL( radius ):
return np.power( waveLen/(4*pi*radius), 2.0 )
def standard_rad(t):
if t > 0:
return ((t + np.pi) % (np.pi * 2)) - np.pi
else:
return ((t - np.pi) % (np.pi * -2)) + np.pi
# Dipole Antenna
def rad_dipole(theta, phi):
return np.power( np.sin(theta), 2.0 )
dipole = AntennaGain(rad_dipole, Gmax=1.5, front_back_ratio = DBToWatts(-8) )
#dipole = AntennaGain(rad_dipole, Gmax=1.5 )
# Isotropic Antenna
isotropic = AntennaGain( lambda theta,phi: 1, Gmax=1.0 )
# Patch Antenna
alpha = 1.0
k0 = 2*pi / waveLen
# See balanis 3-27: k^2 = omega^2 * mu * epsilon
# Free space: mu * epsilon = 1/c^2
# So k0 = w/c = 2pi * freq / c = 2pi / lambda (since c = f*lambda)
width = waveLen / 2.0
Leff = 1.02*waveLen / 2.0 # This is probably waveLen / 2.0 + epsilon
def rad_patch(theta, phi):
t1 = np.sin(theta)
t2 = np.sin(k0*width/2.0 * np.cos(theta)) / np.cos(theta)
t3 = np.cos(k0*Leff/2.0 * np.sin(theta)*np.sin(phi))
#return alpha * np.power(t1*t2*t3,2)
if -pi/2 <= phi <= pi/2:
return alpha * np.power(t1*t2*t3,2)
else:
return alpha * np.power(t1*t2*t3,2) * 0.0001
# S9028?
#patch = AntennaGain( rad_patch, Gmax=5.623/rad_patch(pi/2,0.0)) #7.5dBi ==> 5.623 ==> 18.233 multiplier (since rad_patch_max = 0.30841937174)
# S9025P
#patch = AntennaGain( rad_patch, Gmax=3.548/rad_patch(pi/2,0.0)) # 5.5dBi boresight. => 3.548 [ 10**(5.5/10) ]
# note: we modify Gmax instead of alpha st. Gmax * rad_patch(pi/2) => 5.5dB
patch = AntennaGain( rad_patch,
Gmax=3.548/rad_patch(pi/2,0.0), # 5.5dBi boresight. => 3.548 [ 10**(5.5/10) ]
front_back_ratio = DBToWatts( -8 )) # 8dB front-back ratio
# Friis Forward
def Friis_Inc_Tag( Prdr, CL, waveLen, radius,
Grdr_func, theta_rdr, phi_rdr,
Gtag_func, theta_tag, phi_tag ):
return Prdr * CL * Grdr_func(theta_rdr, phi_rdr) * PL(radius) * Gtag_func(theta_tag, phi_tag)
pwr_inc_tag = fct.partial( Friis_Inc_Tag, 1.0, 0.5, waveLen )
def Friis_Inc_Rdr( Prdr, CL, waveLen, AlphaBeta, radius,
Grdr_func, theta_rdr, phi_rdr,
Gtag_func, theta_tag, phi_tag ):
inter = np.power( CL * Grdr_func(theta_rdr, phi_rdr) * PL(radius) * Gtag_func(theta_tag, phi_tag), 2.0 )
return Prdr * AlphaBeta * inter
pwr_inc_rdr = fct.partial( Friis_Inc_Rdr, 1.0, 0.5, waveLen, 1.0 )
def plot_gain_patterns( gain_func, sup_title, label_psi_plane, label_theta_plane ):
gf = gain_func
psi = np.linspace( -np.pi, np.pi, 50 )
theta_front = np.linspace( 0, np.pi, 50 )
theta_back = theta_front[::-1] * -1.0
fig = pl.figure()
fig.suptitle( sup_title )
ax1 = fig.add_subplot( 121, polar=True)
ax1.plot( psi, np.array([ gf( np.pi / 2.0, p ) for p in psi ]), 'bo-' )
ax1.set_title( label_psi_plane )
# Hacky to get rotated polar...
ax2 = fig.add_subplot( 122, polar=True )
ax2.hold( True )
ax2.plot( theta_front - np.pi / 2, np.array([ gf( t, 0.0 ) for t in theta_front ]), 'ro-' )
ax2.plot( theta_back - np.pi / 2, np.array([ gf( -1.0*t, -np.pi ) for t in theta_back ]), 'ro-' ) # the negative goes to psi
pl.thetagrids( [0, 45, 90, 135, 180, 225, 270, 315], [90, 45, 0, -45, -90, -135, 180, 135 ] )
ax2.set_title( label_theta_plane )
pl.show()
if __name__ == "__main__":
p = optparse.OptionParser()
p.add_option('-a', '--patch', action='store_true', dest='patch', help='Look at patch antenna.')
opt, args = p.parse_args()
if opt.patch:
# Patch (verify E/H plane designations?)
plot_gain_patterns( patch.G, 'Patch Antenna Gains (Absolute)', 'E-Plane', 'H-Plane' )
#plot_gain_patterns( patch.Gdb, 'Patch Antenna Gains', 'E-Plane', 'H-Plane' )
else:
# Dipole (verify E/H plane designations?)
plot_gain_patterns( dipole.G, 'Dipole Antenna Gains (Absolute)', 'H-Plane', 'E-Plane' )
#plot_gain_patterns( dipole.Gdb, 'Dipole Antenna Gains', 'H-Plane', 'E-Plane' )
| ajibawa-2023/Python-Code-Large/train/row_99401 | 111 | 189 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Import_L1_C0", "label": "numpy import np", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:ImportFrom_L2_C0", "label": "from numpy import pi", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0106, 0.0053, 0, 0.66, 0.0278, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["pi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from numpy import pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Import_L3_C0", "label": "time import time", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0053, 0, 0.66, 0.0556, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Import_L4_C0", "label": "transforms import tr", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0212, 0.0053, 0, 0.66, 0.0833, 578, 0, 1, 0, 0, 578, 0, 0], "semantic": {"name": "transforms", "arg_names": [], "import_names": ["tr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import transforms as tr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Import_L5_C0", "label": "pylab import pl", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0265, 0.0053, 0, 0.66, 0.1111, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Import_L6_C0", "label": "functools import fct", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0317, 0.0053, 0, 0.66, 0.1389, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": ["fct"], "rhs_call_name": "", "annotation": ""}, "snippet": "import functools as fct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Import_L7_C0", "label": "pickle import pkl", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0053, 0, 0.66, 0.1667, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:ImportFrom_L8_C0", "label": "from scipy.special import erf", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0423, 0.0053, 0, 0.66, 0.1944, 253, 0, 1, 0, 0, 253, 0, 0], "semantic": {"name": "scipy.special", "arg_names": [], "import_names": ["erf"], "rhs_call_name": "", "annotation": ""}, "snippet": "from scipy.special import erf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Import_L9_C0", "label": "prob import pb", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0053, 0, 0.66, 0.2222, 24, 0, 1, 0, 0, 24, 0, 0], "semantic": {"name": "prob", "arg_names": [], "import_names": ["pb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import prob as pb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Import_L10_C0", "label": "optparse import optparse", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0529, 0.0053, 0, 0.66, 0.25, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L12_C0", "label": "waveLen =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0635, 0.0053, 0, 0.66, 0.2778, 139, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "waveLen", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "waveLen = 3e8 / 900e6 # Middle of UHF RFID band"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:ClassDef_L14_C0", "label": "AntennaGain", "type": "class", "loc": [14, 37], "level": 0, "parent": null, "vector": [3, 0, 0.1349, 0.127, 0, 0.66, 0.3056, 57, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "AntennaGain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AntennaGain():\n def __init__(self, RadiationPattern, Gmax = None, GmaxDB = None, front_back_ratio = None):\n if Gmax is not None:\n self.gain = Gmax\n elif GmaxDB is not None:\n self.gain = 10.0 ** (GmaxDB/10.0)\n else:\n self.gain = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L15_C4", "label": "__init__", "type": "function", "loc": [15, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:ClassDef_L14_C0", "vector": [2, 1, 0.1085, 0.0635, 1, 0.38, 0.0, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "RadiationPattern", "Gmax", "GmaxDB", "front_back_ratio"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, RadiationPattern, Gmax = None, GmaxDB = None, front_back_ratio = None):\n if Gmax is not None:\n self.gain = Gmax\n elif GmaxDB is not None:\n self.gain = 10.0 ** (GmaxDB/10.0)\n else:\n self.gain = 1.0\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L16_C8", "label": "if", "type": "if", "loc": [16, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L15_C4", "vector": [4, 2, 0.0979, 0.0317, 2, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if Gmax is not None:\n self.gain = Gmax\n elif GmaxDB is not None:\n self.gain = 10.0 ** (GmaxDB/10.0)\n else:\n self.gain = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L17_C12", "label": "self.gain =", "type": "assigned_variable", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L16_C8", "vector": [14, 3, 0.0899, 0.0053, 3, 0.15, 0.0, 815, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.gain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.gain = Gmax"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L18_C8", "label": "if", "type": "if", "loc": [18, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L16_C8", "vector": [4, 3, 0.1032, 0.0212, 3, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif GmaxDB is not None:\n self.gain = 10.0 ** (GmaxDB/10.0)\n else:\n self.gain = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L19_C12", "label": "self.gain =", "type": "assigned_variable", "loc": [19, 19], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L18_C8", "vector": [14, 4, 0.1005, 0.0053, 4, 0.51, 0.0, 815, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.gain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.gain = 10.0 ** (GmaxDB/10.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L21_C12", "label": "self.gain =", "type": "assigned_variable", "loc": [21, 21], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L18_C8", "vector": [14, 4, 0.1111, 0.0053, 4, 0.51, 1.0, 815, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.gain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.gain = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L24_C8", "label": "self.fbr =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L15_C4", "vector": [14, 2, 0.127, 0.0053, 2, 0.87, 0.5, 456, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fbr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.fbr = front_back_ratio "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L26_C8", "label": "self.RadiationPattern =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L15_C4", "vector": [14, 2, 0.1376, 0.0053, 2, 0.87, 1.0, 784, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.RadiationPattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.RadiationPattern = RadiationPattern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L28_C4", "label": "G", "type": "function", "loc": [28, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:ClassDef_L14_C0", "vector": [2, 1, 0.1614, 0.0317, 1, 0.38, 0.5, 165, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "G", "arg_names": ["self", "theta", "phi"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def G(self, theta, phi):\n rv = self.RadiationPattern( standard_rad(theta), standard_rad(phi)) * self.gain\n # Account for front-back ratio\n if self.fbr:\n rv = np.max([ self.fbr * self.gain, rv ])\n return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L29_C8", "label": "rv =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L28_C4", "vector": [14, 2, 0.1534, 0.0053, 2, 0.66, 0.0, 222, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv = self.RadiationPattern( standard_rad(theta), standard_rad(phi)) * self.gain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L31_C8", "label": "if", "type": "if", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L28_C4", "vector": [4, 2, 0.1667, 0.0106, 2, 0.66, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.fbr:\n rv = np.max([ self.fbr * self.gain, rv ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L32_C12", "label": "rv = max()", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L31_C8", "vector": [14, 3, 0.1693, 0.0053, 3, 0.32, 0.0, 222, 3, 1, 0, 0, 442, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " rv = np.max([ self.fbr * self.gain, rv ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L33_C8", "label": "return", "type": "return", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L28_C4", "vector": [13, 2, 0.1746, 0.0053, 2, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L35_C4", "label": "Gdb", "type": "function", "loc": [35, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:ClassDef_L14_C0", "vector": [2, 1, 0.1905, 0.0159, 1, 0.38, 1.0, 896, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "Gdb", "arg_names": ["self", "theta", "phi"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Gdb(self, theta, phi):\n #return np.max([ -80.0, WattsToDB( self.G( theta, phi ))]) # Assume always > -80db\n return WattsToDB( self.G( theta, phi ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L37_C8", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L35_C4", "vector": [13, 2, 0.1958, 0.0053, 2, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return WattsToDB( self.G( theta, phi ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "label": "CartToSphere", "type": "function", "loc": [39, 43], "level": 0, "parent": null, "vector": [2, 0, 0.2169, 0.0265, 0, 0.66, 0.3333, 723, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "CartToSphere", "arg_names": ["x", "y", "z"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def CartToSphere(x, y, z):\n r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)\n theta = np.arctan2( np.power(np.power(x,2) + np.power(y,2),0.5) , z)\n phi = np.arctan2( y, x )\n return (r,theta,phi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L40_C4", "label": "r = power()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "vector": [14, 1, 0.2116, 0.0053, 1, 0.66, 0.0, 436, 3, 2, 0, 0, 632, 10, 4], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "power", "annotation": ""}, "snippet": " r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L41_C4", "label": "theta = arctan2()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "vector": [14, 1, 0.2169, 0.0053, 1, 0.66, 0.3333, 729, 3, 2, 0, 0, 895, 10, 4], "semantic": {"name": "theta", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " theta = np.arctan2( np.power(np.power(x,2) + np.power(y,2),0.5) , z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L42_C4", "label": "phi = arctan2()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "vector": [14, 1, 0.2222, 0.0053, 1, 0.66, 0.6667, 388, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "phi", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " phi = np.arctan2( y, x )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L43_C4", "label": "return", "type": "return", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "vector": [13, 1, 0.2275, 0.0053, 1, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (r,theta,phi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "label": "CartToSphere2", "type": "function", "loc": [45, 49], "level": 0, "parent": null, "vector": [2, 0, 0.2487, 0.0265, 0, 0.66, 0.3611, 579, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "CartToSphere2", "arg_names": ["x", "y", "z"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def CartToSphere2(x, y, z): # Equivalent\n r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)\n theta = np.arccos( z / r )\n phi = np.arctan2( y, x )\n return (r,theta,phi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L46_C4", "label": "r = power()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "vector": [14, 1, 0.2434, 0.0053, 1, 0.85, 0.0, 436, 3, 2, 0, 0, 632, 10, 4], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "power", "annotation": ""}, "snippet": " r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L47_C4", "label": "theta = arccos()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "vector": [14, 1, 0.2487, 0.0053, 1, 0.85, 0.3333, 729, 3, 1, 0, 0, 793, 10, 1], "semantic": {"name": "theta", "arg_names": [], "import_names": [], "rhs_call_name": "arccos", "annotation": ""}, "snippet": " theta = np.arccos( z / r )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L48_C4", "label": "phi = arctan2()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "vector": [14, 1, 0.254, 0.0053, 1, 0.85, 0.6667, 388, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "phi", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " phi = np.arctan2( y, x )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L49_C4", "label": "return", "type": "return", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "vector": [13, 1, 0.2593, 0.0053, 1, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (r,theta,phi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "label": "mCartToSphere", "type": "function", "loc": [51, 58], "level": 0, "parent": null, "vector": [2, 0, 0.2884, 0.0423, 0, 0.66, 0.3889, 910, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "mCartToSphere", "arg_names": ["v"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mCartToSphere(v):\n x = v[0]\n y = v[1]\n z = v[2]\n r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)\n theta = np.arctan2( np.power(np.power(x,2) + np.power(y,2),0.5) , z)\n phi = np.arctan2( y, x )\n return (r,theta,phi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L52_C4", "label": "x =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "vector": [14, 1, 0.2751, 0.0053, 1, 0.9, 0.0, 190, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = v[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L53_C4", "label": "y =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "vector": [14, 1, 0.2804, 0.0053, 1, 0.9, 0.1667, 304, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " y = v[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L54_C4", "label": "z =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "vector": [14, 1, 0.2857, 0.0053, 1, 0.9, 0.3333, 859, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " z = v[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L55_C4", "label": "r = power()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "vector": [14, 1, 0.291, 0.0053, 1, 0.9, 0.5, 436, 3, 2, 0, 0, 632, 10, 4], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "power", "annotation": ""}, "snippet": " r = np.power( np.power(x,2) + np.power(y,2) + np.power(z,2), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L56_C4", "label": "theta = arctan2()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "vector": [14, 1, 0.2963, 0.0053, 1, 0.9, 0.6667, 729, 3, 2, 0, 0, 895, 10, 4], "semantic": {"name": "theta", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " theta = np.arctan2( np.power(np.power(x,2) + np.power(y,2),0.5) , z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L57_C4", "label": "phi = arctan2()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "vector": [14, 1, 0.3016, 0.0053, 1, 0.9, 0.8333, 388, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "phi", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " phi = np.arctan2( y, x )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "vector": [13, 1, 0.3069, 0.0053, 1, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (r,theta,phi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "label": "SphereToCart", "type": "function", "loc": [60, 64], "level": 0, "parent": null, "vector": [2, 0, 0.328, 0.0265, 0, 0.66, 0.4167, 334, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "SphereToCart", "arg_names": ["r", "theta", "phi"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def SphereToCart(r, theta, phi):\n x = r * np.sin(theta) * np.cos(phi)\n y = r * np.sin(theta) * np.sin(phi)\n z = r * np.cos(theta)\n return (x,y,z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L61_C4", "label": "x =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "vector": [14, 1, 0.3228, 0.0053, 1, 0.71, 0.0, 190, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = r * np.sin(theta) * np.cos(phi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L62_C4", "label": "y =", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "vector": [14, 1, 0.328, 0.0053, 1, 0.71, 0.3333, 304, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " y = r * np.sin(theta) * np.sin(phi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L63_C4", "label": "z =", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "vector": [14, 1, 0.3333, 0.0053, 1, 0.71, 0.6667, 859, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " z = r * np.cos(theta)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L64_C4", "label": "return", "type": "return", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "vector": [13, 1, 0.3386, 0.0053, 1, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (x,y,z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L66_C0", "label": "WattsToDBm", "type": "function", "loc": [66, 67], "level": 0, "parent": null, "vector": [2, 0, 0.3519, 0.0106, 0, 0.66, 0.4444, 378, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "WattsToDBm", "arg_names": ["pwr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def WattsToDBm(pwr):\n return 10.0 * np.log10(pwr) + 30.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L67_C4", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L66_C0", "vector": [13, 1, 0.3545, 0.0053, 1, 0.19, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 10.0 * np.log10(pwr) + 30.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L69_C0", "label": "WattsToDB", "type": "function", "loc": [69, 70], "level": 0, "parent": null, "vector": [2, 0, 0.3677, 0.0106, 0, 0.66, 0.4722, 135, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "WattsToDB", "arg_names": ["pwr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def WattsToDB(pwr):\n return 10.0 * np.log10(pwr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L69_C0", "vector": [13, 1, 0.3704, 0.0053, 1, 0.6, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 10.0 * np.log10(pwr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L72_C0", "label": "DBmToWatts", "type": "function", "loc": [72, 73], "level": 0, "parent": null, "vector": [2, 0, 0.3836, 0.0106, 0, 0.66, 0.5, 995, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "DBmToWatts", "arg_names": ["pwr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def DBmToWatts(pwr):\n return np.power(10.0, (pwr - 30.0) / 10.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L73_C4", "label": "return", "type": "return", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L72_C0", "vector": [13, 1, 0.3862, 0.0053, 1, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.power(10.0, (pwr - 30.0) / 10.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L75_C0", "label": "DBToWatts", "type": "function", "loc": [75, 76], "level": 0, "parent": null, "vector": [2, 0, 0.3995, 0.0106, 0, 0.66, 0.5278, 890, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "DBToWatts", "arg_names": ["pwr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def DBToWatts(pwr):\n return np.power(10.0, (pwr) / 10.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L75_C0", "vector": [13, 1, 0.4021, 0.0053, 1, 0.39, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.power(10.0, (pwr) / 10.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L78_C0", "label": "PL", "type": "function", "loc": [78, 79], "level": 0, "parent": null, "vector": [2, 0, 0.4153, 0.0106, 0, 0.66, 0.5556, 200, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "PL", "arg_names": ["radius"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PL( radius ):\n return np.power( waveLen/(4*pi*radius), 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L79_C4", "label": "return", "type": "return", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L78_C0", "vector": [13, 1, 0.418, 0.0053, 1, 0.3, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.power( waveLen/(4*pi*radius), 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L81_C0", "label": "standard_rad", "type": "function", "loc": [81, 85], "level": 0, "parent": null, "vector": [2, 0, 0.4392, 0.0265, 0, 0.66, 0.5833, 54, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "standard_rad", "arg_names": ["t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def standard_rad(t):\n if t > 0:\n return ((t + np.pi) % (np.pi * 2)) - np.pi\n else:\n return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L82_C4", "label": "if", "type": "if", "loc": [82, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L81_C0", "vector": [4, 1, 0.4418, 0.0212, 1, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t > 0:\n return ((t + np.pi) % (np.pi * 2)) - np.pi\n else:\n return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L83_C8", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L82_C4", "vector": [13, 2, 0.4392, 0.0053, 2, 0.94, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t + np.pi) % (np.pi * 2)) - np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L82_C4", "vector": [13, 2, 0.4497, 0.0053, 2, 0.94, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L89_C0", "label": "rad_dipole", "type": "function", "loc": [89, 90], "level": 0, "parent": null, "vector": [2, 0, 0.4735, 0.0106, 0, 0.66, 0.6111, 81, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "rad_dipole", "arg_names": ["theta", "phi"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def rad_dipole(theta, phi):\n return np.power( np.sin(theta), 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L90_C4", "label": "return", "type": "return", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L89_C0", "vector": [13, 1, 0.4762, 0.0053, 1, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.power( np.sin(theta), 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L92_C0", "label": "dipole = AntennaGain()", "type": "assigned_variable", "loc": [92, 92], "level": 0, "parent": null, "vector": [14, 0, 0.4868, 0.0053, 0, 0.66, 0.6389, 423, 3, 3, 0, 0, 57, 10, 2], "semantic": {"name": "dipole", "arg_names": [], "import_names": [], "rhs_call_name": "AntennaGain", "annotation": ""}, "snippet": "dipole = AntennaGain(rad_dipole, Gmax=1.5, front_back_ratio = DBToWatts(-8) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L97_C0", "label": "isotropic = AntennaGain()", "type": "assigned_variable", "loc": [97, 97], "level": 0, "parent": null, "vector": [14, 0, 0.5132, 0.0053, 0, 0.66, 0.6667, 783, 3, 2, 0, 0, 57, 10, 1], "semantic": {"name": "isotropic", "arg_names": [], "import_names": [], "rhs_call_name": "AntennaGain", "annotation": ""}, "snippet": "isotropic = AntennaGain( lambda theta,phi: 1, Gmax=1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L101_C0", "label": "alpha =", "type": "assigned_variable", "loc": [101, 101], "level": 0, "parent": null, "vector": [14, 0, 0.5344, 0.0053, 0, 0.66, 0.6944, 993, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "alpha", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "alpha = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L102_C0", "label": "k0 =", "type": "assigned_variable", "loc": [102, 102], "level": 0, "parent": null, "vector": [14, 0, 0.5397, 0.0053, 0, 0.66, 0.7222, 921, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "k0", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "k0 = 2*pi / waveLen"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L107_C0", "label": "width =", "type": "assigned_variable", "loc": [107, 107], "level": 0, "parent": null, "vector": [14, 0, 0.5661, 0.0053, 0, 0.66, 0.75, 989, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "width = waveLen / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L108_C0", "label": "Leff =", "type": "assigned_variable", "loc": [108, 108], "level": 0, "parent": null, "vector": [14, 0, 0.5714, 0.0053, 0, 0.66, 0.7778, 240, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Leff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "Leff = 1.02*waveLen / 2.0 # This is probably waveLen / 2.0 + epsilon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "label": "rad_patch", "type": "function", "loc": [110, 118], "level": 0, "parent": null, "vector": [2, 0, 0.6032, 0.0476, 0, 0.66, 0.8056, 1, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "rad_patch", "arg_names": ["theta", "phi"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def rad_patch(theta, phi):\n t1 = np.sin(theta)\n t2 = np.sin(k0*width/2.0 * np.cos(theta)) / np.cos(theta)\n t3 = np.cos(k0*Leff/2.0 * np.sin(theta)*np.sin(phi))\n #return alpha * np.power(t1*t2*t3,2)\n if -pi/2 <= phi <= pi/2:\n return alpha * np.power(t1*t2*t3,2)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L111_C4", "label": "t1 = sin()", "type": "assigned_variable", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "vector": [14, 1, 0.5873, 0.0053, 1, 0.98, 0.0, 329, 3, 1, 0, 0, 422, 10, 1], "semantic": {"name": "t1", "arg_names": [], "import_names": [], "rhs_call_name": "sin", "annotation": ""}, "snippet": " t1 = np.sin(theta)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L112_C4", "label": "t2 =", "type": "assigned_variable", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "vector": [14, 1, 0.5926, 0.0053, 1, 0.98, 0.3333, 469, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "t2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t2 = np.sin(k0*width/2.0 * np.cos(theta)) / np.cos(theta)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L113_C4", "label": "t3 = cos()", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "vector": [14, 1, 0.5979, 0.0053, 1, 0.98, 0.6667, 328, 3, 1, 0, 0, 705, 10, 3], "semantic": {"name": "t3", "arg_names": [], "import_names": [], "rhs_call_name": "cos", "annotation": ""}, "snippet": " t3 = np.cos(k0*Leff/2.0 * np.sin(theta)*np.sin(phi))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L115_C4", "label": "if", "type": "if", "loc": [115, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "vector": [4, 1, 0.6164, 0.0212, 1, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if -pi/2 <= phi <= pi/2:\n return alpha * np.power(t1*t2*t3,2)\n else:\n return alpha * np.power(t1*t2*t3,2) * 0.0001"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L116_C8", "label": "return", "type": "return", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L115_C4", "vector": [13, 2, 0.6138, 0.0053, 2, 0.32, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return alpha * np.power(t1*t2*t3,2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L118_C8", "label": "return", "type": "return", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L115_C4", "vector": [13, 2, 0.6243, 0.0053, 2, 0.32, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return alpha * np.power(t1*t2*t3,2) * 0.0001"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L126_C0", "label": "patch = AntennaGain()", "type": "assigned_variable", "loc": [126, 128], "level": 0, "parent": null, "vector": [14, 0, 0.672, 0.0159, 0, 0.66, 0.8333, 775, 3, 3, 0, 0, 57, 10, 3], "semantic": {"name": "patch", "arg_names": [], "import_names": [], "rhs_call_name": "AntennaGain", "annotation": ""}, "snippet": "patch = AntennaGain( rad_patch,\n Gmax=3.548/rad_patch(pi/2,0.0), # 5.5dBi boresight. => 3.548 [ 10**(5.5/10) ]\n front_back_ratio = DBToWatts( -8 )) # 8dB front-back ratio "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L133_C0", "label": "Friis_Inc_Tag", "type": "function", "loc": [133, 136], "level": 0, "parent": null, "vector": [2, 0, 0.7116, 0.0212, 0, 0.66, 0.8611, 638, 0, 10, 1, 0, 0, 0, 3], "semantic": {"name": "Friis_Inc_Tag", "arg_names": ["Prdr", "CL", "waveLen", "radius", "Grdr_func", "theta_rdr", "phi_rdr", "Gtag_func", "theta_tag", "phi_tag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Friis_Inc_Tag( Prdr, CL, waveLen, radius,\n Grdr_func, theta_rdr, phi_rdr,\n Gtag_func, theta_tag, phi_tag ):\n return Prdr * CL * Grdr_func(theta_rdr, phi_rdr) * PL(radius) * Gtag_func(theta_tag, phi_tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L136_C4", "label": "return", "type": "return", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L133_C0", "vector": [13, 1, 0.7196, 0.0053, 1, 0.67, 0.0, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Prdr * CL * Grdr_func(theta_rdr, phi_rdr) * PL(radius) * Gtag_func(theta_tag, phi_tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L138_C0", "label": "pwr_inc_tag = partial()", "type": "assigned_variable", "loc": [138, 138], "level": 0, "parent": null, "vector": [14, 0, 0.7302, 0.0053, 0, 0.66, 0.8889, 455, 3, 4, 0, 0, 365, 10, 1], "semantic": {"name": "pwr_inc_tag", "arg_names": [], "import_names": [], "rhs_call_name": "partial", "annotation": ""}, "snippet": "pwr_inc_tag = fct.partial( Friis_Inc_Tag, 1.0, 0.5, waveLen )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L140_C0", "label": "Friis_Inc_Rdr", "type": "function", "loc": [140, 144], "level": 0, "parent": null, "vector": [2, 0, 0.7513, 0.0265, 0, 0.66, 0.9167, 668, 0, 11, 1, 0, 0, 0, 4], "semantic": {"name": "Friis_Inc_Rdr", "arg_names": ["Prdr", "CL", "waveLen", "AlphaBeta", "radius", "Grdr_func", "theta_rdr", "phi_rdr", "Gtag_func", "theta_tag", "phi_tag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Friis_Inc_Rdr( Prdr, CL, waveLen, AlphaBeta, radius, \n Grdr_func, theta_rdr, phi_rdr,\n Gtag_func, theta_tag, phi_tag ):\n inter = np.power( CL * Grdr_func(theta_rdr, phi_rdr) * PL(radius) * Gtag_func(theta_tag, phi_tag), 2.0 )\n return Prdr * AlphaBeta * inter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L143_C4", "label": "inter = power()", "type": "assigned_variable", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L140_C0", "vector": [14, 1, 0.7566, 0.0053, 1, 0.31, 0.0, 700, 3, 2, 0, 0, 632, 10, 4], "semantic": {"name": "inter", "arg_names": [], "import_names": [], "rhs_call_name": "power", "annotation": ""}, "snippet": " inter = np.power( CL * Grdr_func(theta_rdr, phi_rdr) * PL(radius) * Gtag_func(theta_tag, phi_tag), 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L144_C4", "label": "return", "type": "return", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L140_C0", "vector": [13, 1, 0.7619, 0.0053, 1, 0.31, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Prdr * AlphaBeta * inter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L146_C0", "label": "pwr_inc_rdr = partial()", "type": "assigned_variable", "loc": [146, 146], "level": 0, "parent": null, "vector": [14, 0, 0.7725, 0.0053, 0, 0.66, 0.9444, 503, 3, 5, 0, 0, 365, 10, 1], "semantic": {"name": "pwr_inc_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "partial", "annotation": ""}, "snippet": "pwr_inc_rdr = fct.partial( Friis_Inc_Rdr, 1.0, 0.5, waveLen, 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "label": "plot_gain_patterns", "type": "function", "loc": [149, 172], "level": 0, "parent": null, "vector": [2, 0, 0.8492, 0.127, 0, 0.66, 0.9722, 322, 0, 4, 0, 0, 0, 0, 20], "semantic": {"name": "plot_gain_patterns", "arg_names": ["gain_func", "sup_title", "label_psi_plane", "label_theta_plane"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_gain_patterns( gain_func, sup_title, label_psi_plane, label_theta_plane ):\n gf = gain_func\n \n psi = np.linspace( -np.pi, np.pi, 50 )\n theta_front = np.linspace( 0, np.pi, 50 )\n theta_back = theta_front[::-1] * -1.0\n \n fig = pl.figure()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L150_C4", "label": "gf =", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [14, 1, 0.7937, 0.0053, 1, 0.37, 0.0, 735, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "gf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gf = gain_func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L152_C4", "label": "psi = linspace()", "type": "assigned_variable", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [14, 1, 0.8042, 0.0053, 1, 0.37, 0.0667, 560, 3, 3, 0, 0, 119, 10, 1], "semantic": {"name": "psi", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": " psi = np.linspace( -np.pi, np.pi, 50 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L153_C4", "label": "theta_front = linspace()", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [14, 1, 0.8095, 0.0053, 1, 0.37, 0.1333, 589, 3, 3, 0, 0, 119, 10, 1], "semantic": {"name": "theta_front", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": " theta_front = np.linspace( 0, np.pi, 50 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L154_C4", "label": "theta_back =", "type": "assigned_variable", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [14, 1, 0.8148, 0.0053, 1, 0.37, 0.2, 861, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "theta_back", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " theta_back = theta_front[::-1] * -1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L156_C4", "label": "fig = figure()", "type": "assigned_variable", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [14, 1, 0.8254, 0.0053, 1, 0.37, 0.2667, 806, 3, 0, 0, 0, 789, 10, 1], "semantic": {"name": "fig", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " fig = pl.figure()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L157_C4", "label": "suptitle()", "type": "expression", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.8307, 0.0053, 1, 0.37, 0.3333, 91, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "suptitle", "arg_names": [], "import_names": [], "rhs_call_name": "suptitle", "annotation": ""}, "snippet": " fig.suptitle( sup_title )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L159_C4", "label": "ax1 = add_subplot()", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [14, 1, 0.8413, 0.0053, 1, 0.37, 0.4, 946, 3, 2, 0, 0, 449, 10, 1], "semantic": {"name": "ax1", "arg_names": [], "import_names": [], "rhs_call_name": "add_subplot", "annotation": ""}, "snippet": " ax1 = fig.add_subplot( 121, polar=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L160_C4", "label": "plot()", "type": "expression", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.8466, 0.0053, 1, 0.37, 0.4667, 929, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " ax1.plot( psi, np.array([ gf( np.pi / 2.0, p ) for p in psi ]), 'bo-' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L161_C4", "label": "set_title()", "type": "expression", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.8519, 0.0053, 1, 0.37, 0.5333, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_title", "arg_names": [], "import_names": [], "rhs_call_name": "set_title", "annotation": ""}, "snippet": " ax1.set_title( label_psi_plane )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L165_C4", "label": "ax2 = add_subplot()", "type": "assigned_variable", "loc": [165, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [14, 1, 0.873, 0.0053, 1, 0.37, 0.6, 144, 3, 2, 0, 0, 449, 10, 1], "semantic": {"name": "ax2", "arg_names": [], "import_names": [], "rhs_call_name": "add_subplot", "annotation": ""}, "snippet": " ax2 = fig.add_subplot( 122, polar=True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L166_C4", "label": "hold()", "type": "expression", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.8783, 0.0053, 1, 0.37, 0.6667, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": " ax2.hold( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L167_C4", "label": "plot()", "type": "expression", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.8836, 0.0053, 1, 0.37, 0.7333, 929, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " ax2.plot( theta_front - np.pi / 2, np.array([ gf( t, 0.0 ) for t in theta_front ]), 'ro-' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L168_C4", "label": "plot()", "type": "expression", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.8889, 0.0053, 1, 0.37, 0.8, 929, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " ax2.plot( theta_back - np.pi / 2, np.array([ gf( -1.0*t, -np.pi ) for t in theta_back ]), 'ro-' ) # the negative goes to psi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L169_C4", "label": "thetagrids()", "type": "expression", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.8942, 0.0053, 1, 0.37, 0.8667, 466, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "thetagrids", "arg_names": [], "import_names": [], "rhs_call_name": "thetagrids", "annotation": ""}, "snippet": " pl.thetagrids( [0, 45, 90, 135, 180, 225, 270, 315], [90, 45, 0, -45, -90, -135, 180, 135 ] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L170_C4", "label": "set_title()", "type": "expression", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.8995, 0.0053, 1, 0.37, 0.9333, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_title", "arg_names": [], "import_names": [], "rhs_call_name": "set_title", "annotation": ""}, "snippet": " ax2.set_title( label_theta_plane )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L172_C4", "label": "show()", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "vector": [8, 1, 0.9101, 0.0053, 1, 0.37, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " pl.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "label": "if", "type": "if", "loc": [176, 187], "level": 0, "parent": null, "vector": [4, 0, 0.9603, 0.0635, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n p = optparse.OptionParser()\n p.add_option('-a', '--patch', action='store_true', dest='patch', help='Look at patch antenna.')\n opt, args = p.parse_args()\n \n if opt.patch:\n # Patch (verify E/H plane designations?)\n plot_gain_patterns( patch.G, 'Patch Antenna Gains (Absolute)', 'E-Plane', 'H-Plane' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L177_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "vector": [14, 1, 0.9365, 0.0053, 1, 0.91, 0.0, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L178_C4", "label": "add_option()", "type": "expression", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "vector": [8, 1, 0.9418, 0.0053, 1, 0.91, 0.3333, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-a', '--patch', action='store_true', dest='patch', help='Look at patch antenna.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L179_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "vector": [14, 1, 0.9471, 0.0053, 1, 0.91, 0.6667, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L181_C4", "label": "if", "type": "if", "loc": [181, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "vector": [4, 1, 0.9735, 0.037, 1, 0.91, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.patch:\n # Patch (verify E/H plane designations?)\n plot_gain_patterns( patch.G, 'Patch Antenna Gains (Absolute)', 'E-Plane', 'H-Plane' )\n #plot_gain_patterns( patch.Gdb, 'Patch Antenna Gains', 'E-Plane', 'H-Plane' )\n else:\n # Dipole (verify E/H plane designations?)\n plot_gain_patterns( dipole.G, 'Dipole Antenna Gains (Absolute)', 'H-Plane', 'E-Plane' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L183_C8", "label": "plot_gain_patterns()", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L181_C4", "vector": [8, 2, 0.9683, 0.0053, 2, 0.02, 0.0, 322, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot_gain_patterns", "arg_names": [], "import_names": [], "rhs_call_name": "plot_gain_patterns", "annotation": ""}, "snippet": " plot_gain_patterns( patch.G, 'Patch Antenna Gains (Absolute)', 'E-Plane', 'H-Plane' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L187_C8", "label": "plot_gain_patterns()", "type": "expression", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L181_C4", "vector": [8, 2, 0.9894, 0.0053, 2, 0.02, 1.0, 322, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot_gain_patterns", "arg_names": [], "import_names": [], "rhs_call_name": "plot_gain_patterns", "annotation": ""}, "snippet": " plot_gain_patterns( dipole.G, 'Dipole Antenna Gains (Absolute)', 'H-Plane', 'E-Plane' )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99401:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Return_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99401:If_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99401:Expr_L187_C8"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('robotis')
roslib.load_manifest('geometry_msgs')
roslib.load_manifest('move_base_msgs')
roslib.load_manifest('std_msgs')
roslib.load_manifest('tf')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('robotis')
import rospy
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
from rfid_servoing.msg import ServoAction, ServoGoal
from robotis.srv import MoveAng, MoveAngRequest
from geometry_msgs.msg import PoseStamped, Quaternion
from move_base_msgs.msg import MoveBaseAction
from std_msgs.msg import String
from rfid_datacapture.srv import BagCapture, BagCaptureRequest
from rfid_behaviors.srv import FlapEarsSrv
import rfid_datacapture.utils as rdut
import numpy as np, math
def sm_rfid_servo_approach( yaml_fname ):
# Create a SMACH state machine
sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'])
# Open the container
with sm:
smach.StateMachine.add(
'CAPTURE_POSITIONS',
rdut.YAMLprocPoses( yaml_fname ),
remapping = {'next_move_pose':'next_move_pose'}, # output
transitions = {'aborted':'succeeded',
'succeeded':'READY_MOVE'})
smach.StateMachine.add(
'READY_MOVE',
rdut.MoveNotify(),
transitions = {'succeeded':'MOVE_POSITION'})
smach.StateMachine.add(
'MOVE_POSITION',
SimpleActionState( '/move_base',
MoveBaseAction,
goal_slots = [ 'target_pose' ]),
remapping = { 'target_pose' : 'next_move_pose' }, # input
transitions = {'aborted':'MANUAL_SKIP',
'preempted':'aborted',
'succeeded':'CAPTURE_TAGS'})
smach.StateMachine.add(
'MANUAL_SKIP',
rdut.ManualSkip(),
transitions = {'succeeded':'CAPTURE_TAGS', # We already manually positioned the robot
'aborted':'CAPTURE_POSITIONS'}) # skip this position and go to next
smach.StateMachine.add(
'CAPTURE_TAGS',
rdut.YAMLprocMultitag( yaml_fname ),
remapping = {'bagfile_name':'bagfile_name', # output
'bagfile_topics':'bagfile_topics', # output
'panrate':'panrate',
'tagid':'tagid',
'tilt_left':'tilt_left',
'tilt_right':'tilt_right',
'tilt_rate':'tilt_rate',
'tilt_block':'tilt_block'}, # output
transitions = {'aborted':'CAPTURE_POSITIONS', # move to next location
'succeeded':'TILT_LEFT'}) # capture bag
smach.StateMachine.add(
'TILT_LEFT',
ServiceState( '/robotis/servo_left_tilt_moveangle',
MoveAng,
request_slots = ['angle','angvel','blocking']),
transitions = {'succeeded':'TILT_RIGHT'},
remapping = {'angle':'tilt_left',
'angvel':'tilt_rate',
'blocking':'tilt_block'})
smach.StateMachine.add(
'TILT_RIGHT',
ServiceState( '/robotis/servo_right_tilt_moveangle',
MoveAng,
request_slots = ['angle','angvel','blocking']),
transitions = {'succeeded':'START_BAG_CAPTURE'},
remapping = {'angle':'tilt_right',
'angvel':'tilt_rate',
'blocking':'tilt_block'})
smach.StateMachine.add(
'START_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request_slots = ['topics','dest'] ),
remapping = {'topics':'bagfile_topics',
'dest':'bagfile_name'},
transitions = {'succeeded':'FLAP'})
# Servoing is a basic state machine. Success means servoing finished @ obs.
smach.StateMachine.add(
'FLAP',
ServiceState( '/rfid_orient/flap',
FlapEarsSrv,
request_slots = ['data','panrate']),
transitions = { 'succeeded': 'STOP_BAG_CAPTURE' },
remapping = {'data':'tagid', # input
'panrate':'panrate'}) # input
smach.StateMachine.add(
'STOP_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request = BagCaptureRequest('','') ),
transitions = {'succeeded':'TUCK_LEFT'})
# Tuck Left (non-blocking)
smach.StateMachine.add(
'TUCK_LEFT',
ServiceState( 'robotis/servo_left_pan_moveangle',
MoveAng,
request = MoveAngRequest( 1.250, 0.2, 0 )), # ang (float), angvel (float), blocking (bool)
transitions = {'succeeded':'TUCK_RIGHT'})
# Tuck Right (non-blocking)
smach.StateMachine.add(
'TUCK_RIGHT',
ServiceState( 'robotis/servo_right_pan_moveangle',
MoveAng,
request = MoveAngRequest( -1.250, 0.2, 0 )), # ang (float), angvel (float), blocking (bool)
transitions = {'succeeded':'CAPTURE_TAGS'})
return sm
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--yaml', action='store', type='string', dest='yaml',
help='Capture description yaml file', default='')
opt, args = p.parse_args()
if opt.yaml == '':
print 'ERROR: Must specify YAML file.'
exit()
rospy.init_node('rfid_servo_capture')
sm = sm_rfid_servo_approach( opt.yaml )
sis = IntrospectionServer('RFID_servo_approach', sm, '/SM_RFID_SERVO_APPROACH')
sis.start()
outcome = sm.execute()
sis.stop()
# python sm_servo_capture_simple.py --yaml datacap_vert.yaml
| ajibawa-2023/Python-Code-Large/train/row_99403 | 51 | 170 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0118, 0.0059, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0176, 0.0059, 0, 0.66, 0.0435, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0235, 0.0059, 0, 0.66, 0.087, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('robotis')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0294, 0.0059, 0, 0.66, 0.1304, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('geometry_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0353, 0.0059, 0, 0.66, 0.1739, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('move_base_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0412, 0.0059, 0, 0.66, 0.2174, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('std_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0471, 0.0059, 0, 0.66, 0.2609, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0529, 0.0059, 0, 0.66, 0.3043, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0588, 0.0059, 0, 0.66, 0.3478, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('robotis')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Import_L11_C0", "label": "rospy import rospy", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0647, 0.0059, 0, 0.66, 0.3913, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Import_L13_C0", "label": "smach import smach", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0765, 0.0059, 0, 0.66, 0.4348, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:ImportFrom_L14_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0824, 0.0059, 0, 0.66, 0.4783, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Import_L15_C0", "label": "actionlib import actionlib", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0882, 0.0059, 0, 0.66, 0.5217, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:ImportFrom_L17_C0", "label": "from rfid_servoing.msg import ServoAction, ServoGoal", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.0059, 0, 0.66, 0.5652, 317, 0, 2, 0, 0, 317, 0, 0], "semantic": {"name": "rfid_servoing.msg", "arg_names": [], "import_names": ["ServoAction", "ServoGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_servoing.msg import ServoAction, ServoGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:ImportFrom_L18_C0", "label": "from robotis.srv import MoveAng, MoveAngRequest", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1059, 0.0059, 0, 0.66, 0.6087, 727, 0, 2, 0, 0, 727, 0, 0], "semantic": {"name": "robotis.srv", "arg_names": [], "import_names": ["MoveAng", "MoveAngRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from robotis.srv import MoveAng, MoveAngRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:ImportFrom_L19_C0", "label": "from geometry_msgs.msg import PoseStamped, Quaternion", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1118, 0.0059, 0, 0.66, 0.6522, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped", "Quaternion"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped, Quaternion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:ImportFrom_L20_C0", "label": "from move_base_msgs.msg import MoveBaseAction", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0059, 0, 0.66, 0.6957, 440, 0, 1, 0, 0, 440, 0, 0], "semantic": {"name": "move_base_msgs.msg", "arg_names": [], "import_names": ["MoveBaseAction"], "rhs_call_name": "", "annotation": ""}, "snippet": "from move_base_msgs.msg import MoveBaseAction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:ImportFrom_L21_C0", "label": "from std_msgs.msg import String", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1235, 0.0059, 0, 0.66, 0.7391, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["String"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import String"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:ImportFrom_L22_C0", "label": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1294, 0.0059, 0, 0.66, 0.7826, 252, 0, 2, 0, 0, 252, 0, 0], "semantic": {"name": "rfid_datacapture.srv", "arg_names": [], "import_names": ["BagCapture", "BagCaptureRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:ImportFrom_L23_C0", "label": "from rfid_behaviors.srv import FlapEarsSrv", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1353, 0.0059, 0, 0.66, 0.8261, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["FlapEarsSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import FlapEarsSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Import_L25_C0", "label": "rfid_datacapture.utils import rdut", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1471, 0.0059, 0, 0.66, 0.8696, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "rfid_datacapture.utils", "arg_names": [], "import_names": ["rdut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_datacapture.utils as rdut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Import_L27_C0", "label": "numpy import np, math", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1588, 0.0059, 0, 0.66, 0.913, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "label": "sm_rfid_servo_approach", "type": "function", "loc": [30, 143], "level": 0, "parent": null, "vector": [2, 0, 0.5088, 0.6706, 0, 0.66, 0.9565, 183, 0, 1, 1, 0, 0, 0, 28], "semantic": {"name": "sm_rfid_servo_approach", "arg_names": ["yaml_fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sm_rfid_servo_approach( yaml_fname ):\n # Create a SMACH state machine\n sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'])\n\n # Open the container\n with sm:\n\n smach.StateMachine.add("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L32_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [14, 1, 0.1882, 0.0059, 1, 0.52, 0.0, 21, 3, 1, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L37_C8", "label": "add()", "type": "expression", "loc": [37, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.2324, 0.0353, 1, 0.52, 0.0, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'CAPTURE_POSITIONS',\n rdut.YAMLprocPoses( yaml_fname ),\n remapping = {'next_move_pose':'next_move_pose'}, # output\n transitions = {'aborted':'succeeded',\n 'succeeded':'READY_MOVE'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L44_C8", "label": "add()", "type": "expression", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.2676, 0.0235, 1, 0.52, 0.0909, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'READY_MOVE',\n rdut.MoveNotify(),\n transitions = {'succeeded':'MOVE_POSITION'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L49_C8", "label": "add()", "type": "expression", "loc": [49, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.3118, 0.0529, 1, 0.52, 0.1818, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'MOVE_POSITION',\n SimpleActionState( '/move_base',\n MoveBaseAction,\n goal_slots = [ 'target_pose' ]),\n remapping = { 'target_pose' : 'next_move_pose' }, # input\n transitions = {'aborted':'MANUAL_SKIP',\n 'preempted':'aborted',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L59_C8", "label": "add()", "type": "expression", "loc": [59, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.3588, 0.0294, 1, 0.52, 0.2727, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'MANUAL_SKIP',\n rdut.ManualSkip(),\n transitions = {'succeeded':'CAPTURE_TAGS', # We already manually positioned the robot\n 'aborted':'CAPTURE_POSITIONS'}) # skip this position and go to next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L65_C8", "label": "add()", "type": "expression", "loc": [65, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.4176, 0.0765, 1, 0.52, 0.3636, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'CAPTURE_TAGS',\n rdut.YAMLprocMultitag( yaml_fname ),\n remapping = {'bagfile_name':'bagfile_name', # output\n 'bagfile_topics':'bagfile_topics', # output\n 'panrate':'panrate',\n 'tagid':'tagid',\n 'tilt_left':'tilt_left',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L79_C8", "label": "add()", "type": "expression", "loc": [79, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.4882, 0.0529, 1, 0.52, 0.4545, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'TILT_LEFT',\n ServiceState( '/robotis/servo_left_tilt_moveangle',\n MoveAng,\n request_slots = ['angle','angvel','blocking']),\n transitions = {'succeeded':'TILT_RIGHT'},\n remapping = {'angle':'tilt_left',\n 'angvel':'tilt_rate',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L89_C8", "label": "add()", "type": "expression", "loc": [89, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.5471, 0.0529, 1, 0.52, 0.5455, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'TILT_RIGHT',\n ServiceState( '/robotis/servo_right_tilt_moveangle',\n MoveAng,\n request_slots = ['angle','angvel','blocking']),\n transitions = {'succeeded':'START_BAG_CAPTURE'},\n remapping = {'angle':'tilt_right',\n 'angvel':'tilt_rate',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L100_C8", "label": "add()", "type": "expression", "loc": [100, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.6088, 0.0471, 1, 0.52, 0.6364, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'START_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request_slots = ['topics','dest'] ),\n remapping = {'topics':'bagfile_topics',\n 'dest':'bagfile_name'},\n transitions = {'succeeded':'FLAP'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L111_C8", "label": "add()", "type": "expression", "loc": [111, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.6735, 0.0471, 1, 0.52, 0.7273, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'FLAP',\n ServiceState( '/rfid_orient/flap',\n FlapEarsSrv,\n request_slots = ['data','panrate']),\n transitions = { 'succeeded': 'STOP_BAG_CAPTURE' },\n remapping = {'data':'tagid', # input\n 'panrate':'panrate'}) # input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L120_C8", "label": "add()", "type": "expression", "loc": [120, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.7206, 0.0353, 1, 0.52, 0.8182, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'STOP_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request = BagCaptureRequest('','') ),\n transitions = {'succeeded':'TUCK_LEFT'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L128_C8", "label": "add()", "type": "expression", "loc": [128, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.7676, 0.0353, 1, 0.52, 0.9091, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'TUCK_LEFT',\n ServiceState( 'robotis/servo_left_pan_moveangle',\n MoveAng,\n request = MoveAngRequest( 1.250, 0.2, 0 )), # ang (float), angvel (float), blocking (bool)\n transitions = {'succeeded':'TUCK_RIGHT'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L136_C8", "label": "add()", "type": "expression", "loc": [136, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [8, 1, 0.8147, 0.0353, 1, 0.52, 1.0, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'TUCK_RIGHT',\n ServiceState( 'robotis/servo_right_pan_moveangle',\n MoveAng,\n request = MoveAngRequest( -1.250, 0.2, 0 )), # ang (float), angvel (float), blocking (bool)\n transitions = {'succeeded':'CAPTURE_TAGS'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Return_L143_C4", "label": "return", "type": "return", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "vector": [13, 1, 0.8412, 0.0059, 1, 0.52, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "label": "if", "type": "if", "loc": [146, 166], "level": 0, "parent": null, "vector": [4, 0, 0.9176, 0.1235, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--yaml', action='store', type='string', dest='yaml',\n help='Capture description yaml file', default='')\n opt, args = p.parse_args()\n\n if opt.yaml == '':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Import_L147_C4", "label": "optparse import optparse", "type": "import", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [1, 1, 0.8647, 0.0059, 1, 0.53, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L148_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [14, 1, 0.8706, 0.0059, 1, 0.53, 0.1, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L149_C4", "label": "add_option()", "type": "expression", "loc": [149, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [8, 1, 0.8794, 0.0118, 1, 0.53, 0.2, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--yaml', action='store', type='string', dest='yaml',\n help='Capture description yaml file', default='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L151_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [14, 1, 0.8882, 0.0059, 1, 0.53, 0.3, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L153_C4", "label": "if", "type": "if", "loc": [153, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [4, 1, 0.9059, 0.0176, 1, 0.53, 0.4, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.yaml == '':\n print('ERROR: Must specify YAML file.')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L154_C8", "label": "print()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L153_C4", "vector": [8, 2, 0.9059, 0.0059, 2, 0.54, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('ERROR: Must specify YAML file.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L155_C8", "label": "exit()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L153_C4", "vector": [8, 2, 0.9118, 0.0059, 2, 0.54, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L157_C4", "label": "init_node()", "type": "expression", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [8, 1, 0.9235, 0.0059, 1, 0.53, 0.5, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('rfid_servo_capture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L159_C4", "label": "sm = sm_rfid_servo_approach()", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [14, 1, 0.9353, 0.0059, 1, 0.53, 0.6, 21, 3, 1, 0, 0, 183, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "sm_rfid_servo_approach", "annotation": ""}, "snippet": " sm = sm_rfid_servo_approach( opt.yaml )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L161_C4", "label": "sis = IntrospectionServer()", "type": "assigned_variable", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [14, 1, 0.9471, 0.0059, 1, 0.53, 0.7, 608, 3, 3, 0, 0, 702, 10, 1], "semantic": {"name": "sis", "arg_names": [], "import_names": [], "rhs_call_name": "IntrospectionServer", "annotation": ""}, "snippet": " sis = IntrospectionServer('RFID_servo_approach', sm, '/SM_RFID_SERVO_APPROACH')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L162_C4", "label": "start()", "type": "expression", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [8, 1, 0.9529, 0.0059, 1, 0.53, 0.8, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " sis.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L164_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [164, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [14, 1, 0.9647, 0.0059, 1, 0.53, 0.9, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L166_C4", "label": "stop()", "type": "expression", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "vector": [8, 1, 0.9765, 0.0059, 1, 0.53, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " sis.stop()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Return_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Import_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Assign_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99403:If_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99403:Expr_L166_C4"}] |
#!/usr/bin/python
# Basically a giant script.
import roslib
roslib.load_manifest( 'geometry_msgs' ) # the pickle files containe Point and Pose Stamped.
import rospy
from geometry_msgs.msg import PointStamped, PoseStamped
import sys
import glob
import yaml
import time
import optparse
import cPickle as pkl
import numpy as np, math
import pylab as pl
import friis
PLOT = False
# glob_files: '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/datacap/*.pkl'
# filters:
# antennas:
# PR2_Head: '/head_rfid'
# tags:
# 'datacap ':
if __name__ == '__main__':
p = optparse.OptionParser()
p.add_option('--yaml', action='store', type='string', dest='yaml', default='',
help='yaml file that describes this run.')
p.add_option('--plot', action='store_true', dest='plot',
help='Pop-up the resulting plot')
opt, args = p.parse_args()
yaml_fname = opt.yaml
PLOT = opt.plot
else:
yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/rad_plot_combined.yaml'
# SCRIPT:
if not yaml_fname:
print 'YAML file required!'
exit()
else:
f = open( yaml_fname )
yaml_config = yaml.load( f )
f.close()
# XBINS = yaml_config['rad_histbins']['xbins']
# YBINS = yaml_config['rad_histbins']['ybins']
XBINS = 50
YBINS = 50
XMIN = yaml_config['rad_histbins']['xmin']
XMAX = yaml_config['rad_histbins']['xmax']
YMIN = yaml_config['rad_histbins']['ymin']
YMAX = yaml_config['rad_histbins']['ymax']
def add_files( d, arg ):
fname, fcount = arg
print 'Loading (%d of %d): %s' % (fcount, len(fnames), fname)
f = open( fname, 'r' )
d_new = pkl.load( f )
f.close()
for k in d_new.keys():
if not d.has_key( k ):
d[k] = []
d[k] += d_new[k]
return d
def planar_xy( reading ):
# Model estimate of P^inc_tag.
# r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading
d_rdr = reading[0]
d_tag = reading[1]
read = reading[2]
d_rot = reading[3]
ps = reading[4]
r_rdr, theta_rdr, phi_rdr = d_rdr
r_tag, theta_tag, phi_tag = d_tag
x,y,z = friis.SphereToCart( r_rdr, theta_rdr, phi_rdr )
return [x,y]
fnames = reduce( lambda x,y: x+y, [ glob.glob(i) for i in yaml_config['glob_files'] ], [] )
if len(glob.glob(yaml_config['use_combined'])) > 0:
print 'Loading pickle: %s' % (yaml_config['use_combined'])
f = open( yaml_config['use_combined'], 'r' )
data = pkl.load( f )
f.close()
print 'Done.'
else:
f = open( yaml_config['use_combined'], 'w' )
d = reduce( add_files, zip(fnames,range(len(fnames))), {} )
# Apply Filters:
# Start with just the desired tagids
all_reads = reduce( lambda x,y: x+y,
[ d[k] for k in yaml_config['filters']['tags'] if d.has_key(k) ],
[] )
print '*** File \'%s\' had a total of %d reads ***' % ( yaml_fname, len( all_reads ))
# Filter based on antennas
# return [ [r_rdr, theta_rdr, phi_rdr], # all floats
# [r_tag, theta_tag, phi_tag], # all floats
# [rr.rssi, rr.antenna_name, rr.tagID ], # int, string, string
# [theta_rot_map, theta_tag_map], # floats (radians)
# [ tag_map, rdr_map, rot_map ] ] # geometry_msgs/PoseStamped
ant_dict = dict.fromkeys( yaml_config['filters']['antennas'] )
filt_reads = [ r for r in all_reads if ant_dict.has_key( r[2][1] ) ]
reads = filt_reads
data = np.array([ planar_xy(r) + [ r[2][0] ] for r in reads ]).T # 3xN: x,y,rssi
print 'Dumping data into combined pickle file: %s ' % (yaml_config['use_combined'])
pkl.dump( data, f, -1 )
f.close()
print 'Done. Re-run.'
exit()
# data will be 3xN => x, y, RSSI
# Calculate Useful Values
xy = data[0:2,:]
rssi = data[2]
pos_mask = rssi != -1
neg_mask = rssi == -1
# *******************
# Reads per location
# *******************
H,xedges,yedges = np.histogram2d( xy[0], xy[1],
bins=(XBINS,YBINS),
range=[[XMIN,XMAX],
[YMIN,YMAX]])
XS,YS = np.meshgrid( xedges, yedges )
bins_ind_x = np.sum( xy[0][:,np.newaxis] > xedges[:-1], axis = 1 ) - 1 # Tells the index for each of the reads
bins_ind_y = np.sum( xy[1][:,np.newaxis] > yedges[:-1], axis = 1 ) - 1
d = np.copy( H.T ) # The H matrices are actually transposed from how we display
d[ np.where( d > 100 ) ] = 100 # I just want to see which locations have few / no reads.
dma = np.ma.array( d, mask=(d<yaml_config['points_per_loc']) )
f = pl.figure( figsize=(10,6) )
pl.hold(True)
pl.pcolor( XS, YS, dma, cmap=pl.cm.jet ) # or hot?
pl.clim( 0.0, 100.0 )
pl.colorbar()
pl.xlabel( 'X-Coordinate (meters)' )
pl.ylabel( 'Y-Coordinate (meters)' )
pl.title( 'Number of reads attempts at each location' )
pl.savefig( yaml_config['outimage'] + '_datapoints_masked.png' )
f = pl.figure( figsize=(10,6) )
pl.hold(True)
pl.pcolor( XS, YS, d, cmap=pl.cm.jet ) # or hot?
pl.clim( 0.0, 100.0 )
pl.colorbar()
pl.xlabel( 'X-Coordinate (meters)' )
pl.ylabel( 'Y-Coordinate (meters)' )
pl.title( 'Number of reads attempts at each location' )
pl.savefig( yaml_config['outimage'] + '_datapoints_notmasked.png' )
# *******************
# Tag detection probability
# *******************
# Note... I'm still using H from above!
# Need to rebuild dma to not be capped at 100 reads.
dma = np.ma.array( np.copy(H.T), mask=(H.T<yaml_config['points_per_loc']) )
H_pos,xedges,yedges = np.histogram2d( xy[0][pos_mask], xy[1][pos_mask],
bins=(XBINS,YBINS),
range=[[XMIN,XMAX],
[YMIN,YMAX]])
# Where was it actually detected.
dma_det = np.ma.array( np.copy(H_pos.T), mask=(H.T<yaml_config['points_per_loc']) )
# Compute the probability...
dma_det[ np.where(dma.mask==False) ] = (1.0*dma_det[ np.where(dma_det.mask==False) ]) / (1.0*dma[ np.where(dma_det.mask==False) ])
f = pl.figure( figsize=(10,6) )
pl.hold(True)
pl.pcolor( XS, YS, dma_det, cmap=pl.cm.jet ) # or hot?
pl.clim( 0.0, 1.0 )
pl.colorbar()
pl.xlabel( 'X-Coordinate (meters)' )
pl.ylabel( 'Y-Coordinate (meters)' )
pl.title( 'Probability of Tag Detection' )
pl.savefig( yaml_config['outimage'] + '_tag_detect_prob.png' )
# *******************
# Mean RSSI
# *******************
# Note... I'm still using H and H_pos from above!
def get_mean( xi, yi ):
# Which indices (into 3xN data) correspond to this x-bin and y-bin?
data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )
rm = np.mean([ r for r in rssi[ data_ind ] if r != -1 ])
return rm
def get_std( xi, yi ):
# Which indices (into 3xN data) correspond to this x-bin and y-bin?
data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )
rm = np.std([ r for r in rssi[ data_ind ] if r != -1 ])
return rm
# To calculate the rssi mean...
dma_rm = np.ma.array( np.copy(H_pos.T), mask=(H_pos.T<yaml_config['rssi_points_per_loc']) )
means = np.ma.copy( dma_rm )
for i, (xi,yi) in enumerate( zip( *np.where( dma_rm.mask == False ))):
# Note: the bin indices are relative to H-matrices, which are transposed. So we switch xi/yi
means[xi,yi] = get_mean( xi, yi )
stddev = np.ma.copy( dma_rm )
for i, (xi,yi) in enumerate( zip( *np.where( dma_rm.mask == False ))):
# Note: the bin indices are relative to H-matrices, which are transposed. So we switch xi/yi
stddev[xi,yi] = get_std( xi, yi )
f = pl.figure( figsize=(10,6) )
pl.hold(True)
pl.pcolor( XS, YS, means, cmap=pl.cm.jet ) # or hot?
pl.clim( 72,96 )
pl.colorbar()
pl.xlabel( 'X-Coordinate (meters)' )
pl.ylabel( 'Y-Coordinate (meters)' )
pl.title( 'Mean RSSI' )
pl.savefig( yaml_config['outimage'] + '_tag_rssi_mean.png' )
f = pl.figure( figsize=(10,6) )
pl.hold(True)
pl.pcolor( XS, YS, stddev, cmap=pl.cm.jet ) # or hot?
pl.colorbar()
pl.xlabel( 'X-Coordinate (meters)' )
pl.ylabel( 'Y-Coordinate (meters)' )
pl.title( 'Standard Deviation of RSSI' )
pl.savefig( yaml_config['outimage'] + '_tag_rssi_std.png' )
if PLOT:
pl.show()
# SAVE SENSOR MODEL
fname = yaml_config['use_combined'].replace('.pkl','_MODEL.pkl')
MODEL = { 'detect_model': np.ma.copy( dma_det ),
'rssi_model': np.ma.copy( means ),
'stddev_model': np.ma.copy( stddev ),
'xedges': xedges, # These are necessary to define the boundaries of the bins.
'yedges': yedges }
f = open( fname, 'w' )
pkl.dump( MODEL, f, -1 )
f.close()
| ajibawa-2023/Python-Code-Large/train/row_99404 | 155 | 284 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L5_C0", "label": "roslib import roslib", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0176, 0.0035, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0035, 0, 0.66, 0.0103, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'geometry_msgs' ) # the pickle files containe Point and Pose Stamped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L7_C0", "label": "rospy import rospy", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0246, 0.0035, 0, 0.66, 0.0206, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:ImportFrom_L9_C0", "label": "from geometry_msgs.msg import PointStamped, PoseStamped", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0317, 0.0035, 0, 0.66, 0.0309, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PointStamped", "PoseStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PointStamped, PoseStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L12_C0", "label": "sys import sys", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0423, 0.0035, 0, 0.66, 0.0412, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L13_C0", "label": "glob import glob", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0458, 0.0035, 0, 0.66, 0.0515, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L14_C0", "label": "yaml import yaml", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0493, 0.0035, 0, 0.66, 0.0619, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L15_C0", "label": "time import time", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0528, 0.0035, 0, 0.66, 0.0722, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L16_C0", "label": "optparse import optparse", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0563, 0.0035, 0, 0.66, 0.0825, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L17_C0", "label": "cPickle import pkl", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0599, 0.0035, 0, 0.66, 0.0928, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L18_C0", "label": "numpy import np, math", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0634, 0.0035, 0, 0.66, 0.1031, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L19_C0", "label": "pylab import pl", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0669, 0.0035, 0, 0.66, 0.1134, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Import_L21_C0", "label": "friis import friis", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0739, 0.0035, 0, 0.66, 0.1237, 769, 0, 1, 0, 0, 769, 0, 0], "semantic": {"name": "friis", "arg_names": [], "import_names": ["friis"], "rhs_call_name": "", "annotation": ""}, "snippet": "import friis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L23_C0", "label": "PLOT =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.081, 0.0035, 0, 0.66, 0.134, 614, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "PLOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PLOT = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "label": "if", "type": "if", "loc": [32, 43], "level": 0, "parent": null, "vector": [4, 0, 0.132, 0.0423, 0, 0.66, 0.1443, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n p = optparse.OptionParser()\n p.add_option('--yaml', action='store', type='string', dest='yaml', default='',\n help='yaml file that describes this run.')\n p.add_option('--plot', action='store_true', dest='plot',\n help='Pop-up the resulting plot')\n opt, args = p.parse_args()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L33_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "vector": [14, 1, 0.1162, 0.0035, 1, 0.26, 0.0, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L34_C4", "label": "add_option()", "type": "expression", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "vector": [8, 1, 0.1215, 0.007, 1, 0.26, 0.1667, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--yaml', action='store', type='string', dest='yaml', default='',\n help='yaml file that describes this run.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L36_C4", "label": "add_option()", "type": "expression", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "vector": [8, 1, 0.1285, 0.007, 1, 0.26, 0.3333, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--plot', action='store_true', dest='plot',\n help='Pop-up the resulting plot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L38_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "vector": [14, 1, 0.1338, 0.0035, 1, 0.26, 0.5, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L40_C4", "label": "yaml_fname =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "vector": [14, 1, 0.1408, 0.0035, 1, 0.26, 0.6667, 590, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yaml_fname = opt.yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L41_C4", "label": "PLOT =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "vector": [14, 1, 0.1444, 0.0035, 1, 0.26, 0.8333, 614, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "PLOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PLOT = opt.plot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L43_C4", "label": "yaml_fname =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "vector": [14, 1, 0.1514, 0.0035, 1, 0.26, 1.0, 590, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/rad_plot_combined.yaml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "label": "if", "type": "if", "loc": [49, 55], "level": 0, "parent": null, "vector": [4, 0, 0.1831, 0.0246, 0, 0.66, 0.1546, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not yaml_fname:\n print('YAML file required!')\n exit()\nelse:\n f = open( yaml_fname )\n yaml_config = yaml.load( f )\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L50_C4", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "vector": [8, 1, 0.1761, 0.0035, 1, 0.73, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('YAML file required!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L51_C4", "label": "exit()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "vector": [8, 1, 0.1796, 0.0035, 1, 0.73, 0.25, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L53_C4", "label": "f = open()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "vector": [14, 1, 0.1866, 0.0035, 1, 0.73, 0.5, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L54_C4", "label": "yaml_config = load()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "vector": [14, 1, 0.1901, 0.0035, 1, 0.73, 0.75, 248, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "yaml_config", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " yaml_config = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L55_C4", "label": "close()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "vector": [8, 1, 0.1937, 0.0035, 1, 0.73, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L59_C0", "label": "XBINS =", "type": "assigned_variable", "loc": [59, 59], "level": 0, "parent": null, "vector": [14, 0, 0.2077, 0.0035, 0, 0.66, 0.1649, 821, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "XBINS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "XBINS = 50"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L60_C0", "label": "YBINS =", "type": "assigned_variable", "loc": [60, 60], "level": 0, "parent": null, "vector": [14, 0, 0.2113, 0.0035, 0, 0.66, 0.1753, 847, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "YBINS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "YBINS = 50"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L61_C0", "label": "XMIN =", "type": "assigned_variable", "loc": [61, 61], "level": 0, "parent": null, "vector": [14, 0, 0.2148, 0.0035, 0, 0.66, 0.1856, 194, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "XMIN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "XMIN = yaml_config['rad_histbins']['xmin']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L62_C0", "label": "XMAX =", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.2183, 0.0035, 0, 0.66, 0.1959, 896, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "XMAX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "XMAX = yaml_config['rad_histbins']['xmax']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L63_C0", "label": "YMIN =", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.2218, 0.0035, 0, 0.66, 0.2062, 287, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "YMIN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "YMIN = yaml_config['rad_histbins']['ymin']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L64_C0", "label": "YMAX =", "type": "assigned_variable", "loc": [64, 64], "level": 0, "parent": null, "vector": [14, 0, 0.2254, 0.0035, 0, 0.66, 0.2165, 136, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "YMAX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "YMAX = yaml_config['rad_histbins']['ymax']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "label": "add_files", "type": "function", "loc": [67, 79], "level": 0, "parent": null, "vector": [2, 0, 0.257, 0.0458, 0, 0.66, 0.2268, 46, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "add_files", "arg_names": ["d", "arg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def add_files( d, arg ):\n fname, fcount = arg\n print('Loading (%d of %d): %s' % (fcount, len(fnames), fname))\n f = open( fname, 'r' )\n d_new = pkl.load( f )\n f.close()\n\n for k in d_new.keys():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L68_C4", "label": "fname, fcount =", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "vector": [14, 1, 0.2394, 0.0035, 1, 0.66, 0.0, 111, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname, fcount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname, fcount = arg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L69_C4", "label": "print()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "vector": [8, 1, 0.243, 0.0035, 1, 0.66, 0.1667, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading (%d of %d): %s' % (fcount, len(fnames), fname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L70_C4", "label": "f = open()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "vector": [14, 1, 0.2465, 0.0035, 1, 0.66, 0.3333, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L71_C4", "label": "d_new = load()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "vector": [14, 1, 0.25, 0.0035, 1, 0.66, 0.5, 388, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "d_new", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " d_new = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L72_C4", "label": "close()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "vector": [8, 1, 0.2535, 0.0035, 1, 0.66, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L74_C4", "label": "for k", "type": "for", "loc": [74, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "vector": [6, 1, 0.2658, 0.0141, 1, 0.66, 0.8333, 954, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in d_new.keys():\n if not d.has_key( k ):\n d[k] = []\n d[k] += d_new[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L75_C8", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L74_C4", "vector": [4, 2, 0.2658, 0.007, 2, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not d.has_key( k ):\n d[k] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L76_C12", "label": "assign", "type": "assigned_variable", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L75_C8", "vector": [14, 3, 0.2676, 0.0035, 3, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[k] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Return_L79_C4", "label": "return", "type": "return", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "vector": [13, 1, 0.2782, 0.0035, 1, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "label": "planar_xy", "type": "function", "loc": [81, 94], "level": 0, "parent": null, "vector": [2, 0, 0.3081, 0.0493, 0, 0.66, 0.2371, 618, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "planar_xy", "arg_names": ["reading"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def planar_xy( reading ):\n # Model estimate of P^inc_tag.\n # r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading\n d_rdr = reading[0]\n d_tag = reading[1]\n read = reading[2]\n d_rot = reading[3]\n ps = reading[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L84_C4", "label": "d_rdr =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [14, 1, 0.2958, 0.0035, 1, 0.56, 0.0, 836, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rdr = reading[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L85_C4", "label": "d_tag =", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [14, 1, 0.2993, 0.0035, 1, 0.56, 0.125, 632, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_tag = reading[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L86_C4", "label": "read =", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [14, 1, 0.3028, 0.0035, 1, 0.56, 0.25, 453, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " read = reading[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L87_C4", "label": "d_rot =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [14, 1, 0.3063, 0.0035, 1, 0.56, 0.375, 134, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rot = reading[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L88_C4", "label": "ps =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [14, 1, 0.3099, 0.0035, 1, 0.56, 0.5, 232, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps = reading[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L90_C4", "label": "r_rdr, theta_rdr, phi_rdr =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [14, 1, 0.3169, 0.0035, 1, 0.56, 0.625, 349, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r_rdr, theta_rdr, phi_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r_rdr, theta_rdr, phi_rdr = d_rdr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L91_C4", "label": "r_tag, theta_tag, phi_tag =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [14, 1, 0.3204, 0.0035, 1, 0.56, 0.75, 314, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r_tag, theta_tag, phi_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r_tag, theta_tag, phi_tag = d_tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L93_C4", "label": "x, y, z = SphereToCart()", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [14, 1, 0.3275, 0.0035, 1, 0.56, 0.875, 971, 3, 3, 0, 0, 334, 10, 1], "semantic": {"name": "x, y, z", "arg_names": [], "import_names": [], "rhs_call_name": "SphereToCart", "annotation": ""}, "snippet": " x,y,z = friis.SphereToCart( r_rdr, theta_rdr, phi_rdr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Return_L94_C4", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "vector": [13, 1, 0.331, 0.0035, 1, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [x,y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L97_C0", "label": "fnames = reduce()", "type": "assigned_variable", "loc": [97, 97], "level": 0, "parent": null, "vector": [14, 0, 0.3415, 0.0035, 0, 0.66, 0.2474, 641, 3, 3, 0, 0, 622, 10, 2], "semantic": {"name": "fnames", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": "fnames = reduce( lambda x,y: x+y, [ glob.glob(i) for i in yaml_config['glob_files'] ], [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "label": "if", "type": "if", "loc": [99, 135], "level": 0, "parent": null, "vector": [4, 0, 0.412, 0.1303, 0, 0.66, 0.2577, 0, 0, 0, 0, 0, 0, 0, 25], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if len(glob.glob(yaml_config['use_combined'])) > 0:\n print('Loading pickle: %s' % (yaml_config['use_combined']))\n f = open( yaml_config['use_combined'], 'r' )\n data = pkl.load( f )\n f.close()\n print('Done.')\nelse:\n f = open( yaml_config['use_combined'], 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L100_C4", "label": "print()", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.3521, 0.0035, 1, 0.48, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading pickle: %s' % (yaml_config['use_combined']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L101_C4", "label": "f = open()", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.3556, 0.0035, 1, 0.48, 0.0588, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_config['use_combined'], 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L102_C4", "label": "data = load()", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.3592, 0.0035, 1, 0.48, 0.1176, 929, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " data = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L103_C4", "label": "close()", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.3627, 0.0035, 1, 0.48, 0.1765, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L104_C4", "label": "print()", "type": "expression", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.3662, 0.0035, 1, 0.48, 0.2353, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L106_C4", "label": "f = open()", "type": "assigned_variable", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.3732, 0.0035, 1, 0.48, 0.2941, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_config['use_combined'], 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L107_C4", "label": "d = reduce()", "type": "assigned_variable", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.3768, 0.0035, 1, 0.48, 0.3529, 355, 3, 3, 0, 0, 622, 10, 4], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " d = reduce( add_files, zip(fnames,range(len(fnames))), {} )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L112_C4", "label": "all_reads = reduce()", "type": "assigned_variable", "loc": [112, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.3979, 0.0106, 1, 0.48, 0.4118, 222, 3, 3, 0, 0, 622, 10, 2], "semantic": {"name": "all_reads", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " all_reads = reduce( lambda x,y: x+y,\n [ d[k] for k in yaml_config['filters']['tags'] if d.has_key(k) ],\n [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L116_C4", "label": "print()", "type": "expression", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.4085, 0.0035, 1, 0.48, 0.4706, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('*** File \\'%s\\' had a total of %d reads ***' % ( yaml_fname, len( all_reads )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L125_C4", "label": "ant_dict = fromkeys()", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.4401, 0.0035, 1, 0.48, 0.5294, 851, 3, 1, 0, 0, 631, 10, 1], "semantic": {"name": "ant_dict", "arg_names": [], "import_names": [], "rhs_call_name": "fromkeys", "annotation": ""}, "snippet": " ant_dict = dict.fromkeys( yaml_config['filters']['antennas'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L126_C4", "label": "filt_reads =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.4437, 0.0035, 1, 0.48, 0.5882, 172, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filt_reads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filt_reads = [ r for r in all_reads if ant_dict.has_key( r[2][1] ) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L128_C4", "label": "reads =", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.4507, 0.0035, 1, 0.48, 0.6471, 705, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "reads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " reads = filt_reads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L130_C4", "label": "data =", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [14, 1, 0.4577, 0.0035, 1, 0.48, 0.7059, 929, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = np.array([ planar_xy(r) + [ r[2][0] ] for r in reads ]).T # 3xN: x,y,rssi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L131_C4", "label": "print()", "type": "expression", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.4613, 0.0035, 1, 0.48, 0.7647, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Dumping data into combined pickle file: %s ' % (yaml_config['use_combined']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L132_C4", "label": "dump()", "type": "expression", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.4648, 0.0035, 1, 0.48, 0.8235, 952, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pkl.dump( data, f, -1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L133_C4", "label": "close()", "type": "expression", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.4683, 0.0035, 1, 0.48, 0.8824, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L134_C4", "label": "print()", "type": "expression", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.4718, 0.0035, 1, 0.48, 0.9412, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done. Re-run.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L135_C4", "label": "exit()", "type": "expression", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "vector": [8, 1, 0.4754, 0.0035, 1, 0.48, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L143_C0", "label": "xy =", "type": "assigned_variable", "loc": [143, 143], "level": 0, "parent": null, "vector": [14, 0, 0.5035, 0.0035, 0, 0.66, 0.268, 358, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "xy = data[0:2,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L144_C0", "label": "rssi =", "type": "assigned_variable", "loc": [144, 144], "level": 0, "parent": null, "vector": [14, 0, 0.507, 0.0035, 0, 0.66, 0.2784, 906, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "rssi = data[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L145_C0", "label": "pos_mask =", "type": "assigned_variable", "loc": [145, 145], "level": 0, "parent": null, "vector": [14, 0, 0.5106, 0.0035, 0, 0.66, 0.2887, 804, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos_mask", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pos_mask = rssi != -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L146_C0", "label": "neg_mask =", "type": "assigned_variable", "loc": [146, 146], "level": 0, "parent": null, "vector": [14, 0, 0.5141, 0.0035, 0, 0.66, 0.299, 608, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "neg_mask", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "neg_mask = rssi == -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L151_C0", "label": "H, xedges, yedges = histogram2d()", "type": "assigned_variable", "loc": [151, 154], "level": 0, "parent": null, "vector": [14, 0, 0.537, 0.0141, 0, 0.66, 0.3093, 90, 3, 4, 0, 0, 666, 10, 1], "semantic": {"name": "H, xedges, yedges", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2d", "annotation": ""}, "snippet": "H,xedges,yedges = np.histogram2d( xy[0], xy[1],\n bins=(XBINS,YBINS),\n range=[[XMIN,XMAX],\n [YMIN,YMAX]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L155_C0", "label": "XS, YS = meshgrid()", "type": "assigned_variable", "loc": [155, 155], "level": 0, "parent": null, "vector": [14, 0, 0.5458, 0.0035, 0, 0.66, 0.3196, 47, 3, 2, 0, 0, 500, 10, 1], "semantic": {"name": "XS, YS", "arg_names": [], "import_names": [], "rhs_call_name": "meshgrid", "annotation": ""}, "snippet": "XS,YS = np.meshgrid( xedges, yedges )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L157_C0", "label": "bins_ind_x =", "type": "assigned_variable", "loc": [157, 157], "level": 0, "parent": null, "vector": [14, 0, 0.5528, 0.0035, 0, 0.66, 0.3299, 920, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bins_ind_x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "bins_ind_x = np.sum( xy[0][:,np.newaxis] > xedges[:-1], axis = 1 ) - 1 # Tells the index for each of the reads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L158_C0", "label": "bins_ind_y =", "type": "assigned_variable", "loc": [158, 158], "level": 0, "parent": null, "vector": [14, 0, 0.5563, 0.0035, 0, 0.66, 0.3402, 80, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bins_ind_y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "bins_ind_y = np.sum( xy[1][:,np.newaxis] > yedges[:-1], axis = 1 ) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L160_C0", "label": "d = copy()", "type": "assigned_variable", "loc": [160, 160], "level": 0, "parent": null, "vector": [14, 0, 0.5634, 0.0035, 0, 0.66, 0.3505, 355, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": "d = np.copy( H.T ) # The H matrices are actually transposed from how we display"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L161_C0", "label": "assign", "type": "assigned_variable", "loc": [161, 161], "level": 0, "parent": null, "vector": [14, 0, 0.5669, 0.0035, 0, 0.66, 0.3608, 0, 1, 0, 0, 0, 0, 1, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "d[ np.where( d > 100 ) ] = 100 # I just want to see which locations have few / no reads."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L162_C0", "label": "dma = array()", "type": "assigned_variable", "loc": [162, 162], "level": 0, "parent": null, "vector": [14, 0, 0.5704, 0.0035, 0, 0.66, 0.3711, 934, 3, 2, 0, 0, 80, 10, 1], "semantic": {"name": "dma", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "dma = np.ma.array( d, mask=(d<yaml_config['points_per_loc']) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L164_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [164, 164], "level": 0, "parent": null, "vector": [14, 0, 0.5775, 0.0035, 0, 0.66, 0.3814, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L165_C0", "label": "hold()", "type": "expression", "loc": [165, 165], "level": 0, "parent": null, "vector": [8, 0, 0.581, 0.0035, 0, 0.66, 0.3918, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": "pl.hold(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L166_C0", "label": "pcolor()", "type": "expression", "loc": [166, 166], "level": 0, "parent": null, "vector": [8, 0, 0.5845, 0.0035, 0, 0.66, 0.4021, 2, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pcolor", "arg_names": [], "import_names": [], "rhs_call_name": "pcolor", "annotation": ""}, "snippet": "pl.pcolor( XS, YS, dma, cmap=pl.cm.jet ) # or hot?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L167_C0", "label": "clim()", "type": "expression", "loc": [167, 167], "level": 0, "parent": null, "vector": [8, 0, 0.588, 0.0035, 0, 0.66, 0.4124, 841, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "clim", "arg_names": [], "import_names": [], "rhs_call_name": "clim", "annotation": ""}, "snippet": "pl.clim( 0.0, 100.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L168_C0", "label": "colorbar()", "type": "expression", "loc": [168, 168], "level": 0, "parent": null, "vector": [8, 0, 0.5915, 0.0035, 0, 0.66, 0.4227, 915, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colorbar", "arg_names": [], "import_names": [], "rhs_call_name": "colorbar", "annotation": ""}, "snippet": "pl.colorbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L169_C0", "label": "xlabel()", "type": "expression", "loc": [169, 169], "level": 0, "parent": null, "vector": [8, 0, 0.5951, 0.0035, 0, 0.66, 0.433, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'X-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L170_C0", "label": "ylabel()", "type": "expression", "loc": [170, 170], "level": 0, "parent": null, "vector": [8, 0, 0.5986, 0.0035, 0, 0.66, 0.4433, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( 'Y-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L171_C0", "label": "title()", "type": "expression", "loc": [171, 171], "level": 0, "parent": null, "vector": [8, 0, 0.6021, 0.0035, 0, 0.66, 0.4536, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": "pl.title( 'Number of reads attempts at each location' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L172_C0", "label": "savefig()", "type": "expression", "loc": [172, 172], "level": 0, "parent": null, "vector": [8, 0, 0.6056, 0.0035, 0, 0.66, 0.4639, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_datapoints_masked.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L174_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [174, 174], "level": 0, "parent": null, "vector": [14, 0, 0.6127, 0.0035, 0, 0.66, 0.4742, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L175_C0", "label": "hold()", "type": "expression", "loc": [175, 175], "level": 0, "parent": null, "vector": [8, 0, 0.6162, 0.0035, 0, 0.66, 0.4845, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": "pl.hold(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L176_C0", "label": "pcolor()", "type": "expression", "loc": [176, 176], "level": 0, "parent": null, "vector": [8, 0, 0.6197, 0.0035, 0, 0.66, 0.4948, 2, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pcolor", "arg_names": [], "import_names": [], "rhs_call_name": "pcolor", "annotation": ""}, "snippet": "pl.pcolor( XS, YS, d, cmap=pl.cm.jet ) # or hot?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L177_C0", "label": "clim()", "type": "expression", "loc": [177, 177], "level": 0, "parent": null, "vector": [8, 0, 0.6232, 0.0035, 0, 0.66, 0.5052, 841, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "clim", "arg_names": [], "import_names": [], "rhs_call_name": "clim", "annotation": ""}, "snippet": "pl.clim( 0.0, 100.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L178_C0", "label": "colorbar()", "type": "expression", "loc": [178, 178], "level": 0, "parent": null, "vector": [8, 0, 0.6268, 0.0035, 0, 0.66, 0.5155, 915, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colorbar", "arg_names": [], "import_names": [], "rhs_call_name": "colorbar", "annotation": ""}, "snippet": "pl.colorbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L179_C0", "label": "xlabel()", "type": "expression", "loc": [179, 179], "level": 0, "parent": null, "vector": [8, 0, 0.6303, 0.0035, 0, 0.66, 0.5258, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'X-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L180_C0", "label": "ylabel()", "type": "expression", "loc": [180, 180], "level": 0, "parent": null, "vector": [8, 0, 0.6338, 0.0035, 0, 0.66, 0.5361, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( 'Y-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L181_C0", "label": "title()", "type": "expression", "loc": [181, 181], "level": 0, "parent": null, "vector": [8, 0, 0.6373, 0.0035, 0, 0.66, 0.5464, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": "pl.title( 'Number of reads attempts at each location' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L182_C0", "label": "savefig()", "type": "expression", "loc": [182, 182], "level": 0, "parent": null, "vector": [8, 0, 0.6408, 0.0035, 0, 0.66, 0.5567, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_datapoints_notmasked.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L191_C0", "label": "dma = array()", "type": "assigned_variable", "loc": [191, 191], "level": 0, "parent": null, "vector": [14, 0, 0.6725, 0.0035, 0, 0.66, 0.567, 934, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "dma", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "dma = np.ma.array( np.copy(H.T), mask=(H.T<yaml_config['points_per_loc']) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L192_C0", "label": "H_pos, xedges, yedges = histogram2d()", "type": "assigned_variable", "loc": [192, 195], "level": 0, "parent": null, "vector": [14, 0, 0.6813, 0.0141, 0, 0.66, 0.5773, 552, 3, 4, 0, 0, 666, 10, 1], "semantic": {"name": "H_pos, xedges, yedges", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2d", "annotation": ""}, "snippet": "H_pos,xedges,yedges = np.histogram2d( xy[0][pos_mask], xy[1][pos_mask],\n bins=(XBINS,YBINS),\n range=[[XMIN,XMAX],\n [YMIN,YMAX]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L198_C0", "label": "dma_det = array()", "type": "assigned_variable", "loc": [198, 198], "level": 0, "parent": null, "vector": [14, 0, 0.6972, 0.0035, 0, 0.66, 0.5876, 972, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "dma_det", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "dma_det = np.ma.array( np.copy(H_pos.T), mask=(H.T<yaml_config['points_per_loc']) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L201_C0", "label": "assign", "type": "assigned_variable", "loc": [201, 201], "level": 0, "parent": null, "vector": [14, 0, 0.7077, 0.0035, 0, 0.66, 0.5979, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dma_det[ np.where(dma.mask==False) ] = (1.0*dma_det[ np.where(dma_det.mask==False) ]) / (1.0*dma[ np.where(dma_det.mask==False) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L203_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [203, 203], "level": 0, "parent": null, "vector": [14, 0, 0.7148, 0.0035, 0, 0.66, 0.6082, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L204_C0", "label": "hold()", "type": "expression", "loc": [204, 204], "level": 0, "parent": null, "vector": [8, 0, 0.7183, 0.0035, 0, 0.66, 0.6186, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": "pl.hold(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L205_C0", "label": "pcolor()", "type": "expression", "loc": [205, 205], "level": 0, "parent": null, "vector": [8, 0, 0.7218, 0.0035, 0, 0.66, 0.6289, 2, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pcolor", "arg_names": [], "import_names": [], "rhs_call_name": "pcolor", "annotation": ""}, "snippet": "pl.pcolor( XS, YS, dma_det, cmap=pl.cm.jet ) # or hot?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L206_C0", "label": "clim()", "type": "expression", "loc": [206, 206], "level": 0, "parent": null, "vector": [8, 0, 0.7254, 0.0035, 0, 0.66, 0.6392, 841, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "clim", "arg_names": [], "import_names": [], "rhs_call_name": "clim", "annotation": ""}, "snippet": "pl.clim( 0.0, 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L207_C0", "label": "colorbar()", "type": "expression", "loc": [207, 207], "level": 0, "parent": null, "vector": [8, 0, 0.7289, 0.0035, 0, 0.66, 0.6495, 915, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colorbar", "arg_names": [], "import_names": [], "rhs_call_name": "colorbar", "annotation": ""}, "snippet": "pl.colorbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L208_C0", "label": "xlabel()", "type": "expression", "loc": [208, 208], "level": 0, "parent": null, "vector": [8, 0, 0.7324, 0.0035, 0, 0.66, 0.6598, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'X-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L209_C0", "label": "ylabel()", "type": "expression", "loc": [209, 209], "level": 0, "parent": null, "vector": [8, 0, 0.7359, 0.0035, 0, 0.66, 0.6701, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( 'Y-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L210_C0", "label": "title()", "type": "expression", "loc": [210, 210], "level": 0, "parent": null, "vector": [8, 0, 0.7394, 0.0035, 0, 0.66, 0.6804, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": "pl.title( 'Probability of Tag Detection' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L211_C0", "label": "savefig()", "type": "expression", "loc": [211, 211], "level": 0, "parent": null, "vector": [8, 0, 0.743, 0.0035, 0, 0.66, 0.6907, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_tag_detect_prob.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L220_C0", "label": "get_mean", "type": "function", "loc": [220, 224], "level": 0, "parent": null, "vector": [2, 0, 0.7817, 0.0176, 0, 0.66, 0.701, 840, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "get_mean", "arg_names": ["xi", "yi"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_mean( xi, yi ):\n # Which indices (into 3xN data) correspond to this x-bin and y-bin?\n data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )\n rm = np.mean([ r for r in rssi[ data_ind ] if r != -1 ])\n return rm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L222_C4", "label": "data_ind = intersect1d()", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L220_C0", "vector": [14, 1, 0.7817, 0.0035, 1, 0.46, 0.0, 477, 3, 2, 0, 0, 645, 10, 3], "semantic": {"name": "data_ind", "arg_names": [], "import_names": [], "rhs_call_name": "intersect1d", "annotation": ""}, "snippet": " data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L223_C4", "label": "rm = mean()", "type": "assigned_variable", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L220_C0", "vector": [14, 1, 0.7852, 0.0035, 1, 0.46, 0.5, 159, 3, 1, 0, 0, 856, 10, 1], "semantic": {"name": "rm", "arg_names": [], "import_names": [], "rhs_call_name": "mean", "annotation": ""}, "snippet": " rm = np.mean([ r for r in rssi[ data_ind ] if r != -1 ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Return_L224_C4", "label": "return", "type": "return", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L220_C0", "vector": [13, 1, 0.7887, 0.0035, 1, 0.46, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L226_C0", "label": "get_std", "type": "function", "loc": [226, 230], "level": 0, "parent": null, "vector": [2, 0, 0.8028, 0.0176, 0, 0.66, 0.7113, 365, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "get_std", "arg_names": ["xi", "yi"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_std( xi, yi ):\n # Which indices (into 3xN data) correspond to this x-bin and y-bin?\n data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )\n rm = np.std([ r for r in rssi[ data_ind ] if r != -1 ])\n return rm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L228_C4", "label": "data_ind = intersect1d()", "type": "assigned_variable", "loc": [228, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L226_C0", "vector": [14, 1, 0.8028, 0.0035, 1, 0.88, 0.0, 477, 3, 2, 0, 0, 645, 10, 3], "semantic": {"name": "data_ind", "arg_names": [], "import_names": [], "rhs_call_name": "intersect1d", "annotation": ""}, "snippet": " data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L229_C4", "label": "rm = std()", "type": "assigned_variable", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L226_C0", "vector": [14, 1, 0.8063, 0.0035, 1, 0.88, 0.5, 159, 3, 1, 0, 0, 616, 10, 1], "semantic": {"name": "rm", "arg_names": [], "import_names": [], "rhs_call_name": "std", "annotation": ""}, "snippet": " rm = np.std([ r for r in rssi[ data_ind ] if r != -1 ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Return_L230_C4", "label": "return", "type": "return", "loc": [230, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L226_C0", "vector": [13, 1, 0.8099, 0.0035, 1, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L233_C0", "label": "dma_rm = array()", "type": "assigned_variable", "loc": [233, 233], "level": 0, "parent": null, "vector": [14, 0, 0.8204, 0.0035, 0, 0.66, 0.7216, 816, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "dma_rm", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "dma_rm = np.ma.array( np.copy(H_pos.T), mask=(H_pos.T<yaml_config['rssi_points_per_loc']) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L235_C0", "label": "means = copy()", "type": "assigned_variable", "loc": [235, 235], "level": 0, "parent": null, "vector": [14, 0, 0.8275, 0.0035, 0, 0.66, 0.732, 622, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "means", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": "means = np.ma.copy( dma_rm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L236_C0", "label": "for i", "type": "for", "loc": [236, 238], "level": 0, "parent": null, "vector": [6, 0, 0.8345, 0.0106, 0, 0.66, 0.7423, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i, (xi,yi) in enumerate( zip( *np.where( dma_rm.mask == False ))):\n # Note: the bin indices are relative to H-matrices, which are transposed. So we switch xi/yi\n means[xi,yi] = get_mean( xi, yi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L238_C4", "label": " = get_mean()", "type": "assigned_variable", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L236_C0", "vector": [14, 1, 0.838, 0.0035, 1, 0.73, 0.0, 0, 3, 2, 0, 0, 840, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_mean", "annotation": ""}, "snippet": " means[xi,yi] = get_mean( xi, yi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L240_C0", "label": "stddev = copy()", "type": "assigned_variable", "loc": [240, 240], "level": 0, "parent": null, "vector": [14, 0, 0.8451, 0.0035, 0, 0.66, 0.7526, 990, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "stddev", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": "stddev = np.ma.copy( dma_rm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L241_C0", "label": "for i", "type": "for", "loc": [241, 243], "level": 0, "parent": null, "vector": [6, 0, 0.8521, 0.0106, 0, 0.66, 0.7629, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i, (xi,yi) in enumerate( zip( *np.where( dma_rm.mask == False ))):\n # Note: the bin indices are relative to H-matrices, which are transposed. So we switch xi/yi\n stddev[xi,yi] = get_std( xi, yi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L243_C4", "label": " = get_std()", "type": "assigned_variable", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L241_C0", "vector": [14, 1, 0.8556, 0.0035, 1, 0.2, 0.0, 0, 3, 2, 0, 0, 365, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_std", "annotation": ""}, "snippet": " stddev[xi,yi] = get_std( xi, yi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L246_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [246, 246], "level": 0, "parent": null, "vector": [14, 0, 0.8662, 0.0035, 0, 0.66, 0.7732, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L247_C0", "label": "hold()", "type": "expression", "loc": [247, 247], "level": 0, "parent": null, "vector": [8, 0, 0.8697, 0.0035, 0, 0.66, 0.7835, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": "pl.hold(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L248_C0", "label": "pcolor()", "type": "expression", "loc": [248, 248], "level": 0, "parent": null, "vector": [8, 0, 0.8732, 0.0035, 0, 0.66, 0.7938, 2, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pcolor", "arg_names": [], "import_names": [], "rhs_call_name": "pcolor", "annotation": ""}, "snippet": "pl.pcolor( XS, YS, means, cmap=pl.cm.jet ) # or hot?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L249_C0", "label": "clim()", "type": "expression", "loc": [249, 249], "level": 0, "parent": null, "vector": [8, 0, 0.8768, 0.0035, 0, 0.66, 0.8041, 841, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "clim", "arg_names": [], "import_names": [], "rhs_call_name": "clim", "annotation": ""}, "snippet": "pl.clim( 72,96 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L250_C0", "label": "colorbar()", "type": "expression", "loc": [250, 250], "level": 0, "parent": null, "vector": [8, 0, 0.8803, 0.0035, 0, 0.66, 0.8144, 915, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colorbar", "arg_names": [], "import_names": [], "rhs_call_name": "colorbar", "annotation": ""}, "snippet": "pl.colorbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L251_C0", "label": "xlabel()", "type": "expression", "loc": [251, 251], "level": 0, "parent": null, "vector": [8, 0, 0.8838, 0.0035, 0, 0.66, 0.8247, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'X-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L252_C0", "label": "ylabel()", "type": "expression", "loc": [252, 252], "level": 0, "parent": null, "vector": [8, 0, 0.8873, 0.0035, 0, 0.66, 0.8351, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( 'Y-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L253_C0", "label": "title()", "type": "expression", "loc": [253, 253], "level": 0, "parent": null, "vector": [8, 0, 0.8908, 0.0035, 0, 0.66, 0.8454, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": "pl.title( 'Mean RSSI' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L254_C0", "label": "savefig()", "type": "expression", "loc": [254, 254], "level": 0, "parent": null, "vector": [8, 0, 0.8944, 0.0035, 0, 0.66, 0.8557, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_tag_rssi_mean.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L256_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [256, 256], "level": 0, "parent": null, "vector": [14, 0, 0.9014, 0.0035, 0, 0.66, 0.866, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L257_C0", "label": "hold()", "type": "expression", "loc": [257, 257], "level": 0, "parent": null, "vector": [8, 0, 0.9049, 0.0035, 0, 0.66, 0.8763, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": "pl.hold(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L258_C0", "label": "pcolor()", "type": "expression", "loc": [258, 258], "level": 0, "parent": null, "vector": [8, 0, 0.9085, 0.0035, 0, 0.66, 0.8866, 2, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pcolor", "arg_names": [], "import_names": [], "rhs_call_name": "pcolor", "annotation": ""}, "snippet": "pl.pcolor( XS, YS, stddev, cmap=pl.cm.jet ) # or hot?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L259_C0", "label": "colorbar()", "type": "expression", "loc": [259, 259], "level": 0, "parent": null, "vector": [8, 0, 0.912, 0.0035, 0, 0.66, 0.8969, 915, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colorbar", "arg_names": [], "import_names": [], "rhs_call_name": "colorbar", "annotation": ""}, "snippet": "pl.colorbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L260_C0", "label": "xlabel()", "type": "expression", "loc": [260, 260], "level": 0, "parent": null, "vector": [8, 0, 0.9155, 0.0035, 0, 0.66, 0.9072, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'X-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L261_C0", "label": "ylabel()", "type": "expression", "loc": [261, 261], "level": 0, "parent": null, "vector": [8, 0, 0.919, 0.0035, 0, 0.66, 0.9175, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( 'Y-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L262_C0", "label": "title()", "type": "expression", "loc": [262, 262], "level": 0, "parent": null, "vector": [8, 0, 0.9225, 0.0035, 0, 0.66, 0.9278, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": "pl.title( 'Standard Deviation of RSSI' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L263_C0", "label": "savefig()", "type": "expression", "loc": [263, 263], "level": 0, "parent": null, "vector": [8, 0, 0.9261, 0.0035, 0, 0.66, 0.9381, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_tag_rssi_std.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L266_C0", "label": "if", "type": "if", "loc": [266, 267], "level": 0, "parent": null, "vector": [4, 0, 0.9384, 0.007, 0, 0.66, 0.9485, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if PLOT:\n pl.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L267_C4", "label": "show()", "type": "expression", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L266_C0", "vector": [8, 1, 0.9401, 0.0035, 1, 0.93, 0.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " pl.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L273_C0", "label": "fname = replace()", "type": "assigned_variable", "loc": [273, 273], "level": 0, "parent": null, "vector": [14, 0, 0.9613, 0.0035, 0, 0.66, 0.9588, 190, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "fname = yaml_config['use_combined'].replace('.pkl','_MODEL.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L275_C0", "label": "MODEL =", "type": "assigned_variable", "loc": [275, 279], "level": 0, "parent": null, "vector": [14, 0, 0.9754, 0.0176, 0, 0.66, 0.9691, 428, 0, 0, 0, 0, 0, 6, 3], "semantic": {"name": "MODEL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MODEL = { 'detect_model': np.ma.copy( dma_det ),\n 'rssi_model': np.ma.copy( means ),\n 'stddev_model': np.ma.copy( stddev ),\n 'xedges': xedges, # These are necessary to define the boundaries of the bins.\n 'yedges': yedges } "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L281_C0", "label": "f = open()", "type": "assigned_variable", "loc": [281, 281], "level": 0, "parent": null, "vector": [14, 0, 0.9894, 0.0035, 0, 0.66, 0.9794, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open( fname, 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L282_C0", "label": "dump()", "type": "expression", "loc": [282, 282], "level": 0, "parent": null, "vector": [8, 0, 0.993, 0.0035, 0, 0.66, 0.9897, 952, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": "pkl.dump( MODEL, f, -1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L283_C0", "label": "close()", "type": "expression", "loc": [283, 283], "level": 0, "parent": null, "vector": [8, 0, 0.9965, 0.0035, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "f.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Return_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Return_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Return_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L226_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L226_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:FunctionDef_L226_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Return_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L236_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:For_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Assign_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99404:If_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99404:Expr_L267_C4"}] |
import numpy as np, math
import numpy
import math
import sys
##
# Bound the value of a number to be above lower, and lower than upper
# @return a number
def bound(value, lower, upper):
raise RuntimeError('math_util.bound moved to hrl_lib.util')
#sys.exit()
# if lower >= upper:
# t = lower
# lower = upper
# upper = t
# #print 'bound', value, 'lower', lower, 'upper', upper
# #return min(max(value, lower), upper)
# return min(max(value, lower), upper)
def bound_mat(m, lower, upper):
if lower >= upper:
t = lower
lower = upper
upper = t
m = m.copy()
m[np.where(m > upper)] = upper
m[np.where(m < lower)] = lower
return m
def approx_equal(a, b, epsilon=.001):
return (b < (a+epsilon)) and ((a-epsilon) < b)
def approx_equalv(a, b, epsilon=.001):
return np.all(np.abs(a - b) < epsilon)
def radians(mat):
return mat * (np.pi/180.0)
def degrees(mat):
return mat * (180.0 / np.pi)
##################################################################
# Angles related functions
##################################################################
def vec_of_ang(a):
return numpy.matrix([numpy.cos(a), numpy.sin(a)]).T
def ang_of_vec(a):
a = a / numpy.linalg.norm(a)
return math.atan2(a[1,0], a[0,0])
def avg_ang(wa, a, wb, b):
"""
Calculates the average between two angles
wa weight of first angle
a first angle
wb weight of second angle
b second angle
"""
return ang_of_vec(wa * vec_of_ang(a) + wb * vec_of_ang(b))
def blend_ang(alpha, a, b):
return avg_ang(alpha, a, 1-alpha,b)
def standard_rad(t):
if t > 0:
return ((t + numpy.pi) % (numpy.pi * 2)) - numpy.pi
else:
return ((t - numpy.pi) % (numpy.pi * -2)) + numpy.pi
def best_turn_dir(reference, new_angle):
""" positive is left, negative is right! """
return standard_rad(reference - new_angle)
def cart_of_pol(p):
""" Finds cartesian coordinates of polar points [r, t]' """
r = p[0,:]
t = p[1,:]
x = numpy.multiply(numpy.cos(t), r)
y = numpy.multiply(numpy.sin(t), r)
return numpy.vstack((x,y))
def pol_of_cart(p):
""" Find polar coordinates of cartesian points [x, y]' """
norm = numpy.linalg.norm(p)
ang = math.atan2(p[1,0], p[0,0])
return numpy.matrix([norm, ang]).T
##################################################################
# NUMPY HELPER FUNCTIONS
##################################################################
##
# Find the maximal position in a 2D array
# @return (r,c)
def argmax2d(mat):
max_1d = np.argmax(mat)
row_length = float(mat.shape[1])
row_idx = np.floor(max_1d / row_length)
col_idx = max_1d % row_length
return row_idx, col_idx
##
# Changes the range of an numpy array to betwen [0, 255] from it's [min_value, max_value]
def renormalize(npimage_gray):
min_img = np.min(npimage_gray)
max_img = np.max(npimage_gray)
ret = np.matrix(np.round(((npimage_gray - min_img) / (max_img - min_img) * 255.0)), 'uint8')
return ret
def list_mat_to_mat(list_mat, axis=0):
return np.concatenate(tuple(list_mat), axis=axis)
def list_of_mat(mat):
for i in range(mat.shape[1]):
yield mat[:,i]
def nearest(mat, target):
'''
Return a sorted list of the nearest (euclidean dist) element
of a matrix to a target value and their indeices.
@param mat mxn
@param target mx1
'''
#mat = mat.T
#target = target.T
#import util as ut
#import pdb
#ut.save_pickle(mat, 'mat.pkl')
#ut.save_pickle(target, 'target.pkl')
diff_vec = mat - target
pwr = np.ones_like(mat[0])*2
dist = np.power(np.sum(np.power(diff_vec, pwr),axis=0),0.5)
indices = dist.argsort(axis=1)
#want indices from sort order
#indices = np.concatenate((np.matrix(range(sort_order.shape[1])), sort_order), 0)[:, sort_order.A1]
#print sort_order
#print indices
#pdb.set_trace()
return mat[:, indices.A1], indices
if __name__ == '__main__':
import hrl_lib.util as ut
import pdb
mat = ut.load_pickle('mat.pkl')
target = ut.load_pickle('target.pkl')
diff_vec = mat - target
pwr = np.ones_like(mat[0])*2
dist = np.power(np.sum(np.power(diff_vec, pwr),axis=0),0.5)
sort_order = dist.argsort(axis=1)
#want indices from sort order
indices = np.concatenate((np.matrix(range(sort_order.shape[1])), sort_order), 0)[:, sort_order.A1]
print sort_order
print indices
pdb.set_trace()
#def nearest(mat, target):
# '''
# Return a sorted list of the nearest (euclidean dist) element
# of a matrix to a target value and their indeices.
# '''
# mat = mat.T
# target = target.T
# diff_vec = mat - target
# pwr = np.ones_like(mat[0])*2
# dist = np.power(np.sum(np.power(diff_vec ,pwr),axis=1),0.5)
# indices = dist.argsort(axis=0)
# return mat[indices.A1], indices
##################################################################
# MISCELLANEOUS MATH HELPER FUNCTIONS
##################################################################
def blend(alpha, a, b):
return (alpha * a) + ((1-alpha) * b)
def approx_equal(a, b, epsilon=.001):
return (b < (a+epsilon)) and ((a-epsilon) < b)
def norm(mat):
"""
Calculate L2 norm for column vectors in a matrix
"""
return np.power(np.sum(np.power(mat,2), axis=0), 0.5)
def rnd(v):
return int(round(v))
def point_to_homo(p):
""" Convert points into homogeneous coordinates """
o = numpy.matrix(numpy.ones((1, p.shape[1])))
return numpy.vstack((p,o))
""" Convert points back from homogeneous coordinates """
def homo_to_point(p):
return p[0:p.shape[0]-1,:]
| ajibawa-2023/Python-Code-Large/train/row_99405 | 103 | 204 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Import_L1_C0", "label": "numpy import np, math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Import_L2_C0", "label": "numpy import numpy", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0049, 0, 0.66, 0.0345, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["numpy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Import_L3_C0", "label": "math import math", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0147, 0.0049, 0, 0.66, 0.069, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0245, 0.0049, 0, 0.66, 0.1034, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L10_C0", "label": "bound", "type": "function", "loc": [10, 11], "level": 0, "parent": null, "vector": [2, 0, 0.0515, 0.0098, 0, 0.66, 0.1379, 996, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "bound", "arg_names": ["value", "lower", "upper"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bound(value, lower, upper):\n raise RuntimeError('math_util.bound moved to hrl_lib.util')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "label": "bound_mat", "type": "function", "loc": [21, 30], "level": 0, "parent": null, "vector": [2, 0, 0.125, 0.049, 0, 0.66, 0.1724, 563, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "bound_mat", "arg_names": ["m", "lower", "upper"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bound_mat(m, lower, upper):\n if lower >= upper:\n t = lower\n lower = upper\n upper = t\n\n m = m.copy()\n m[np.where(m > upper)] = upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L22_C4", "label": "if", "type": "if", "loc": [22, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "vector": [4, 1, 0.1152, 0.0196, 1, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lower >= upper:\n t = lower\n lower = upper\n upper = t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L23_C8", "label": "t =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L22_C4", "vector": [14, 2, 0.1127, 0.0049, 2, 0.49, 0.0, 15, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = lower"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L24_C8", "label": "lower =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L22_C4", "vector": [14, 2, 0.1176, 0.0049, 2, 0.49, 0.5, 432, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lower = upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L25_C8", "label": "upper =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L22_C4", "vector": [14, 2, 0.1225, 0.0049, 2, 0.49, 1.0, 347, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upper = t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L27_C4", "label": "m = copy()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "vector": [14, 1, 0.1324, 0.0049, 1, 0.94, 0.25, 711, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " m = m.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L28_C4", "label": "assign", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "vector": [14, 1, 0.1373, 0.0049, 1, 0.94, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m[np.where(m > upper)] = upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L29_C4", "label": "assign", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "vector": [14, 1, 0.1422, 0.0049, 1, 0.94, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m[np.where(m < lower)] = lower"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L30_C4", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "vector": [13, 1, 0.1471, 0.0049, 1, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L32_C0", "label": "approx_equal", "type": "function", "loc": [32, 33], "level": 0, "parent": null, "vector": [2, 0, 0.1593, 0.0098, 0, 0.66, 0.2069, 662, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "approx_equal", "arg_names": ["a", "b", "epsilon"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def approx_equal(a, b, epsilon=.001):\n return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L33_C4", "label": "return", "type": "return", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L32_C0", "vector": [13, 1, 0.1618, 0.0049, 1, 0.84, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L35_C0", "label": "approx_equalv", "type": "function", "loc": [35, 36], "level": 0, "parent": null, "vector": [2, 0, 0.174, 0.0098, 0, 0.66, 0.2414, 240, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "approx_equalv", "arg_names": ["a", "b", "epsilon"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def approx_equalv(a, b, epsilon=.001):\n return np.all(np.abs(a - b) < epsilon)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L36_C4", "label": "return", "type": "return", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L35_C0", "vector": [13, 1, 0.1765, 0.0049, 1, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.all(np.abs(a - b) < epsilon)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L38_C0", "label": "radians", "type": "function", "loc": [38, 39], "level": 0, "parent": null, "vector": [2, 0, 0.1887, 0.0098, 0, 0.66, 0.2759, 383, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "radians", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def radians(mat):\n return mat * (np.pi/180.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L38_C0", "vector": [13, 1, 0.1912, 0.0049, 1, 0.66, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mat * (np.pi/180.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L41_C0", "label": "degrees", "type": "function", "loc": [41, 42], "level": 0, "parent": null, "vector": [2, 0, 0.2034, 0.0098, 0, 0.66, 0.3103, 633, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "degrees", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def degrees(mat):\n return mat * (180.0 / np.pi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L42_C4", "label": "return", "type": "return", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L41_C0", "vector": [13, 1, 0.2059, 0.0049, 1, 0.11, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mat * (180.0 / np.pi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L47_C0", "label": "vec_of_ang", "type": "function", "loc": [47, 48], "level": 0, "parent": null, "vector": [2, 0, 0.2328, 0.0098, 0, 0.66, 0.3448, 956, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "vec_of_ang", "arg_names": ["a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def vec_of_ang(a):\n return numpy.matrix([numpy.cos(a), numpy.sin(a)]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L48_C4", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L47_C0", "vector": [13, 1, 0.2353, 0.0049, 1, 0.77, 0.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.matrix([numpy.cos(a), numpy.sin(a)]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L50_C0", "label": "ang_of_vec", "type": "function", "loc": [50, 52], "level": 0, "parent": null, "vector": [2, 0, 0.25, 0.0147, 0, 0.66, 0.3793, 45, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "ang_of_vec", "arg_names": ["a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ang_of_vec(a):\n a = a / numpy.linalg.norm(a)\n return math.atan2(a[1,0], a[0,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L51_C4", "label": "a =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L50_C0", "vector": [14, 1, 0.25, 0.0049, 1, 0.44, 0.0, 475, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = a / numpy.linalg.norm(a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L50_C0", "vector": [13, 1, 0.2549, 0.0049, 1, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return math.atan2(a[1,0], a[0,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L54_C0", "label": "avg_ang", "type": "function", "loc": [54, 62], "level": 0, "parent": null, "vector": [2, 0, 0.2843, 0.0441, 0, 0.66, 0.4138, 151, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "avg_ang", "arg_names": ["wa", "a", "wb", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def avg_ang(wa, a, wb, b):\n \"\"\"\n Calculates the average between two angles\n wa weight of first angle\n a first angle\n wb weight of second angle\n b second angle\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L55_C4", "label": "expression", "type": "expression", "loc": [55, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L54_C0", "vector": [8, 1, 0.2843, 0.0343, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Calculates the average between two angles\n wa weight of first angle\n a first angle\n wb weight of second angle\n b second angle\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L62_C4", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L54_C0", "vector": [13, 1, 0.3039, 0.0049, 1, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ang_of_vec(wa * vec_of_ang(a) + wb * vec_of_ang(b))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L64_C0", "label": "blend_ang", "type": "function", "loc": [64, 65], "level": 0, "parent": null, "vector": [2, 0, 0.3162, 0.0098, 0, 0.66, 0.4483, 550, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "blend_ang", "arg_names": ["alpha", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def blend_ang(alpha, a, b):\n return avg_ang(alpha, a, 1-alpha,b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L64_C0", "vector": [13, 1, 0.3186, 0.0049, 1, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return avg_ang(alpha, a, 1-alpha,b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L67_C0", "label": "standard_rad", "type": "function", "loc": [67, 71], "level": 0, "parent": null, "vector": [2, 0, 0.3382, 0.0245, 0, 0.66, 0.4828, 54, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "standard_rad", "arg_names": ["t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def standard_rad(t):\n if t > 0:\n return ((t + numpy.pi) % (numpy.pi * 2)) - numpy.pi\n else:\n return ((t - numpy.pi) % (numpy.pi * -2)) + numpy.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L68_C4", "label": "if", "type": "if", "loc": [68, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L67_C0", "vector": [4, 1, 0.3407, 0.0196, 1, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t > 0:\n return ((t + numpy.pi) % (numpy.pi * 2)) - numpy.pi\n else:\n return ((t - numpy.pi) % (numpy.pi * -2)) + numpy.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L69_C8", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L68_C4", "vector": [13, 2, 0.3382, 0.0049, 2, 0.8, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t + numpy.pi) % (numpy.pi * 2)) - numpy.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L71_C8", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L68_C4", "vector": [13, 2, 0.348, 0.0049, 2, 0.8, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t - numpy.pi) % (numpy.pi * -2)) + numpy.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L73_C0", "label": "best_turn_dir", "type": "function", "loc": [73, 75], "level": 0, "parent": null, "vector": [2, 0, 0.3627, 0.0147, 0, 0.66, 0.5172, 327, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "best_turn_dir", "arg_names": ["reference", "new_angle"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def best_turn_dir(reference, new_angle):\n \"\"\" positive is left, negative is right! \"\"\"\n return standard_rad(reference - new_angle)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L74_C4", "label": "expression", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L73_C0", "vector": [8, 1, 0.3627, 0.0049, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" positive is left, negative is right! \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L75_C4", "label": "return", "type": "return", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L73_C0", "vector": [13, 1, 0.3676, 0.0049, 1, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return standard_rad(reference - new_angle)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "label": "cart_of_pol", "type": "function", "loc": [77, 83], "level": 0, "parent": null, "vector": [2, 0, 0.3922, 0.0343, 0, 0.66, 0.5517, 212, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "cart_of_pol", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cart_of_pol(p):\n \"\"\" Finds cartesian coordinates of polar points [r, t]' \"\"\"\n r = p[0,:]\n t = p[1,:]\n x = numpy.multiply(numpy.cos(t), r)\n y = numpy.multiply(numpy.sin(t), r)\n return numpy.vstack((x,y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L78_C3", "label": "expression", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "vector": [8, 1, 0.3824, 0.0049, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Finds cartesian coordinates of polar points [r, t]' \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L79_C3", "label": "r =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "vector": [14, 1, 0.3873, 0.0049, 1, 0.25, 0.2, 436, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = p[0,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L80_C3", "label": "t =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "vector": [14, 1, 0.3922, 0.0049, 1, 0.25, 0.4, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = p[1,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L81_C3", "label": "x = multiply()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "vector": [14, 1, 0.3971, 0.0049, 1, 0.25, 0.6, 190, 3, 2, 0, 0, 960, 10, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " x = numpy.multiply(numpy.cos(t), r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L82_C3", "label": "y = multiply()", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "vector": [14, 1, 0.402, 0.0049, 1, 0.25, 0.8, 304, 3, 2, 0, 0, 960, 10, 2], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " y = numpy.multiply(numpy.sin(t), r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L83_C3", "label": "return", "type": "return", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "vector": [13, 1, 0.4069, 0.0049, 1, 0.25, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.vstack((x,y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "label": "pol_of_cart", "type": "function", "loc": [85, 89], "level": 0, "parent": null, "vector": [2, 0, 0.4265, 0.0245, 0, 0.66, 0.5862, 754, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "pol_of_cart", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pol_of_cart(p):\n \"\"\" Find polar coordinates of cartesian points [x, y]' \"\"\"\n norm = numpy.linalg.norm(p)\n ang = math.atan2(p[1,0], p[0,0])\n return numpy.matrix([norm, ang]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L86_C4", "label": "expression", "type": "expression", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "vector": [8, 1, 0.4216, 0.0049, 1, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Find polar coordinates of cartesian points [x, y]' \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L87_C4", "label": "norm = norm()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "vector": [14, 1, 0.4265, 0.0049, 1, 0.89, 0.3333, 902, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "norm", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " norm = numpy.linalg.norm(p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L88_C4", "label": "ang = atan2()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "vector": [14, 1, 0.4314, 0.0049, 1, 0.89, 0.6667, 762, 3, 2, 0, 0, 572, 10, 1], "semantic": {"name": "ang", "arg_names": [], "import_names": [], "rhs_call_name": "atan2", "annotation": ""}, "snippet": " ang = math.atan2(p[1,0], p[0,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L89_C4", "label": "return", "type": "return", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "vector": [13, 1, 0.4363, 0.0049, 1, 0.89, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.matrix([norm, ang]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "label": "argmax2d", "type": "function", "loc": [98, 103], "level": 0, "parent": null, "vector": [2, 0, 0.4926, 0.0294, 0, 0.66, 0.6207, 204, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "argmax2d", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def argmax2d(mat):\n max_1d = np.argmax(mat)\n row_length = float(mat.shape[1])\n row_idx = np.floor(max_1d / row_length)\n col_idx = max_1d % row_length\n return row_idx, col_idx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L99_C4", "label": "max_1d = argmax()", "type": "assigned_variable", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "vector": [14, 1, 0.4853, 0.0049, 1, 0.55, 0.0, 496, 3, 1, 0, 0, 593, 10, 1], "semantic": {"name": "max_1d", "arg_names": [], "import_names": [], "rhs_call_name": "argmax", "annotation": ""}, "snippet": " max_1d = np.argmax(mat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L100_C4", "label": "row_length = float()", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "vector": [14, 1, 0.4902, 0.0049, 1, 0.55, 0.25, 697, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "row_length", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " row_length = float(mat.shape[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L101_C4", "label": "row_idx = floor()", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "vector": [14, 1, 0.4951, 0.0049, 1, 0.55, 0.5, 551, 3, 1, 0, 0, 956, 10, 1], "semantic": {"name": "row_idx", "arg_names": [], "import_names": [], "rhs_call_name": "floor", "annotation": ""}, "snippet": " row_idx = np.floor(max_1d / row_length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L102_C4", "label": "col_idx =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "vector": [14, 1, 0.5, 0.0049, 1, 0.55, 0.75, 946, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "col_idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " col_idx = max_1d % row_length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L103_C4", "label": "return", "type": "return", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "vector": [13, 1, 0.5049, 0.0049, 1, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return row_idx, col_idx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "label": "renormalize", "type": "function", "loc": [107, 111], "level": 0, "parent": null, "vector": [2, 0, 0.5343, 0.0245, 0, 0.66, 0.6552, 885, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "renormalize", "arg_names": ["npimage_gray"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def renormalize(npimage_gray):\n min_img = np.min(npimage_gray)\n max_img = np.max(npimage_gray)\n ret = np.matrix(np.round(((npimage_gray - min_img) / (max_img - min_img) * 255.0)), 'uint8')\n return ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L108_C4", "label": "min_img = min()", "type": "assigned_variable", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "vector": [14, 1, 0.5294, 0.0049, 1, 0.5, 0.0, 110, 3, 1, 0, 0, 867, 10, 1], "semantic": {"name": "min_img", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " min_img = np.min(npimage_gray)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L109_C4", "label": "max_img = max()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "vector": [14, 1, 0.5343, 0.0049, 1, 0.5, 0.3333, 728, 3, 1, 0, 0, 442, 10, 1], "semantic": {"name": "max_img", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " max_img = np.max(npimage_gray)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L110_C4", "label": "ret = matrix()", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "vector": [14, 1, 0.5392, 0.0049, 1, 0.5, 0.6667, 501, 3, 2, 0, 0, 162, 10, 2], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " ret = np.matrix(np.round(((npimage_gray - min_img) / (max_img - min_img) * 255.0)), 'uint8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L111_C4", "label": "return", "type": "return", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "vector": [13, 1, 0.5441, 0.0049, 1, 0.5, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L113_C0", "label": "list_mat_to_mat", "type": "function", "loc": [113, 114], "level": 0, "parent": null, "vector": [2, 0, 0.5564, 0.0098, 0, 0.66, 0.6897, 162, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "list_mat_to_mat", "arg_names": ["list_mat", "axis"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def list_mat_to_mat(list_mat, axis=0):\n return np.concatenate(tuple(list_mat), axis=axis)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L114_C4", "label": "return", "type": "return", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L113_C0", "vector": [13, 1, 0.5588, 0.0049, 1, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.concatenate(tuple(list_mat), axis=axis)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L116_C0", "label": "list_of_mat", "type": "function", "loc": [116, 118], "level": 0, "parent": null, "vector": [2, 0, 0.5735, 0.0147, 0, 0.66, 0.7241, 941, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "list_of_mat", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def list_of_mat(mat):\n for i in range(mat.shape[1]):\n yield mat[:,i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:For_L117_C4", "label": "for i", "type": "for", "loc": [117, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L116_C0", "vector": [6, 1, 0.576, 0.0098, 1, 0.51, 0.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(mat.shape[1]):\n yield mat[:,i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L118_C8", "label": "expression", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:For_L117_C4", "vector": [8, 2, 0.5784, 0.0049, 2, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield mat[:,i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "label": "nearest", "type": "function", "loc": [120, 145], "level": 0, "parent": null, "vector": [2, 0, 0.6495, 0.1275, 0, 0.66, 0.7586, 105, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "nearest", "arg_names": ["mat", "target"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def nearest(mat, target):\n '''\n Return a sorted list of the nearest (euclidean dist) element\n of a matrix to a target value and their indeices.\n @param mat mxn\n @param target mx1\n '''\n #mat = mat.T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L121_C4", "label": "expression", "type": "expression", "loc": [121, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "vector": [8, 1, 0.6054, 0.0294, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Return a sorted list of the nearest (euclidean dist) element\n of a matrix to a target value and their indeices.\n @param mat mxn\n @param target mx1\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L134_C4", "label": "diff_vec =", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "vector": [14, 1, 0.6569, 0.0049, 1, 0.54, 0.2, 436, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "diff_vec", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diff_vec = mat - target"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L135_C4", "label": "pwr =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "vector": [14, 1, 0.6618, 0.0049, 1, 0.54, 0.4, 264, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pwr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pwr = np.ones_like(mat[0])*2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L136_C4", "label": "dist = power()", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "vector": [14, 1, 0.6667, 0.0049, 1, 0.54, 0.6, 673, 3, 2, 0, 0, 632, 10, 3], "semantic": {"name": "dist", "arg_names": [], "import_names": [], "rhs_call_name": "power", "annotation": ""}, "snippet": " dist = np.power(np.sum(np.power(diff_vec, pwr),axis=0),0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L137_C4", "label": "indices = argsort()", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "vector": [14, 1, 0.6716, 0.0049, 1, 0.54, 0.8, 478, 3, 1, 0, 0, 237, 10, 1], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "argsort", "annotation": ""}, "snippet": " indices = dist.argsort(axis=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L145_C4", "label": "return", "type": "return", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "vector": [13, 1, 0.7108, 0.0049, 1, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mat[:, indices.A1], indices"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "label": "if", "type": "if", "loc": [147, 163], "level": 0, "parent": null, "vector": [4, 0, 0.7598, 0.0833, 0, 0.66, 0.7931, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import hrl_lib.util as ut\n import pdb\n mat = ut.load_pickle('mat.pkl')\n target = ut.load_pickle('target.pkl')\n\n diff_vec = mat - target\n pwr = np.ones_like(mat[0])*2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Import_L148_C4", "label": "hrl_lib.util import ut", "type": "import", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [1, 1, 0.7255, 0.0049, 1, 0.86, 0.0, 775, 0, 1, 0, 0, 775, 0, 0], "semantic": {"name": "hrl_lib.util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hrl_lib.util as ut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Import_L149_C4", "label": "pdb import pdb", "type": "import", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [1, 1, 0.7304, 0.0049, 1, 0.86, 0.0909, 91, 0, 1, 0, 0, 91, 0, 0], "semantic": {"name": "pdb", "arg_names": [], "import_names": ["pdb"], "rhs_call_name": "", "annotation": ""}, "snippet": " import pdb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L150_C4", "label": "mat = load_pickle()", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [14, 1, 0.7353, 0.0049, 1, 0.86, 0.1818, 882, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "mat", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " mat = ut.load_pickle('mat.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L151_C4", "label": "target = load_pickle()", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [14, 1, 0.7402, 0.0049, 1, 0.86, 0.2727, 766, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " target = ut.load_pickle('target.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L153_C4", "label": "diff_vec =", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [14, 1, 0.75, 0.0049, 1, 0.86, 0.3636, 436, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "diff_vec", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diff_vec = mat - target"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L154_C4", "label": "pwr =", "type": "assigned_variable", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [14, 1, 0.7549, 0.0049, 1, 0.86, 0.4545, 264, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pwr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pwr = np.ones_like(mat[0])*2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L155_C4", "label": "dist = power()", "type": "assigned_variable", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [14, 1, 0.7598, 0.0049, 1, 0.86, 0.5455, 673, 3, 2, 0, 0, 632, 10, 3], "semantic": {"name": "dist", "arg_names": [], "import_names": [], "rhs_call_name": "power", "annotation": ""}, "snippet": " dist = np.power(np.sum(np.power(diff_vec, pwr),axis=0),0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L156_C4", "label": "sort_order = argsort()", "type": "assigned_variable", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [14, 1, 0.7647, 0.0049, 1, 0.86, 0.6364, 116, 3, 1, 0, 0, 237, 10, 1], "semantic": {"name": "sort_order", "arg_names": [], "import_names": [], "rhs_call_name": "argsort", "annotation": ""}, "snippet": " sort_order = dist.argsort(axis=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L159_C4", "label": "indices =", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [14, 1, 0.7794, 0.0049, 1, 0.86, 0.7273, 478, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " indices = np.concatenate((np.matrix(range(sort_order.shape[1])), sort_order), 0)[:, sort_order.A1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L161_C4", "label": "print()", "type": "expression", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [8, 1, 0.7892, 0.0049, 1, 0.86, 0.8182, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(sort_order)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L162_C4", "label": "print()", "type": "expression", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [8, 1, 0.7941, 0.0049, 1, 0.86, 0.9091, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(indices)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L163_C4", "label": "set_trace()", "type": "expression", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "vector": [8, 1, 0.799, 0.0049, 1, 0.86, 1.0, 796, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "set_trace", "arg_names": [], "import_names": [], "rhs_call_name": "set_trace", "annotation": ""}, "snippet": " pdb.set_trace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L182_C0", "label": "blend", "type": "function", "loc": [182, 183], "level": 0, "parent": null, "vector": [2, 0, 0.8946, 0.0098, 0, 0.66, 0.8276, 240, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "blend", "arg_names": ["alpha", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def blend(alpha, a, b):\n return (alpha * a) + ((1-alpha) * b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L183_C4", "label": "return", "type": "return", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L182_C0", "vector": [13, 1, 0.8971, 0.0049, 1, 0.69, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (alpha * a) + ((1-alpha) * b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L185_C0", "label": "approx_equal", "type": "function", "loc": [185, 186], "level": 0, "parent": null, "vector": [2, 0, 0.9093, 0.0098, 0, 0.66, 0.8621, 662, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "approx_equal", "arg_names": ["a", "b", "epsilon"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def approx_equal(a, b, epsilon=.001):\n return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L186_C4", "label": "return", "type": "return", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L185_C0", "vector": [13, 1, 0.9118, 0.0049, 1, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L188_C0", "label": "norm", "type": "function", "loc": [188, 192], "level": 0, "parent": null, "vector": [2, 0, 0.9314, 0.0245, 0, 0.66, 0.8966, 902, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "norm", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def norm(mat):\n \"\"\"\n Calculate L2 norm for column vectors in a matrix\n \"\"\"\n return np.power(np.sum(np.power(mat,2), axis=0), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L189_C4", "label": "expression", "type": "expression", "loc": [189, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L188_C0", "vector": [8, 1, 0.9314, 0.0147, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Calculate L2 norm for column vectors in a matrix\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L192_C4", "label": "return", "type": "return", "loc": [192, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L188_C0", "vector": [13, 1, 0.9412, 0.0049, 1, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.power(np.sum(np.power(mat,2), axis=0), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L194_C0", "label": "rnd", "type": "function", "loc": [194, 195], "level": 0, "parent": null, "vector": [2, 0, 0.9534, 0.0098, 0, 0.66, 0.931, 203, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "rnd", "arg_names": ["v"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def rnd(v):\n return int(round(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L195_C4", "label": "return", "type": "return", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L194_C0", "vector": [13, 1, 0.9559, 0.0049, 1, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(round(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "label": "point_to_homo", "type": "function", "loc": [197, 202], "level": 0, "parent": null, "vector": [2, 0, 0.9779, 0.0294, 0, 0.66, 0.9655, 116, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "point_to_homo", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def point_to_homo(p):\n \"\"\" Convert points into homogeneous coordinates \"\"\"\n o = numpy.matrix(numpy.ones((1, p.shape[1])))\n return numpy.vstack((p,o))\n\n \"\"\" Convert points back from homogeneous coordinates \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L198_C4", "label": "expression", "type": "expression", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "vector": [8, 1, 0.9706, 0.0049, 1, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Convert points into homogeneous coordinates \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L199_C4", "label": "o = matrix()", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "vector": [14, 1, 0.9755, 0.0049, 1, 0.95, 0.3333, 926, 3, 1, 0, 0, 162, 10, 2], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " o = numpy.matrix(numpy.ones((1, p.shape[1])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L200_C4", "label": "return", "type": "return", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "vector": [13, 1, 0.9804, 0.0049, 1, 0.95, 0.6667, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.vstack((p,o))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L202_C4", "label": "expression", "type": "expression", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "vector": [8, 1, 0.9902, 0.0049, 1, 0.95, 1.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Convert points back from homogeneous coordinates \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L203_C0", "label": "homo_to_point", "type": "function", "loc": [203, 204], "level": 0, "parent": null, "vector": [2, 0, 0.9975, 0.0098, 0, 0.66, 1.0, 897, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "homo_to_point", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def homo_to_point(p):\n return p[0:p.shape[0]-1,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L204_C4", "label": "return", "type": "return", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L203_C0", "vector": [13, 1, 1.0, 0.0049, 1, 0.17, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return p[0:p.shape[0]-1,:]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L78_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L79_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L80_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L81_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L82_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L83_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:For_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:For_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Import_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Import_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Assign_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99405:FunctionDef_L203_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99405:Return_L204_C4"}] |
#!/usr/bin/python
import roslib
roslib.load_manifest('geometry_msgs')
roslib.load_manifest('tf')
import rospy
import tf
from geometry_msgs.msg import PointStamped
import time
rospy.init_node('ground_truth_tag_pose')
listener = tf.TransformListener()
# listener.waitForTransform('/l_gripper_tool_frame', '/ear_antenna_left',
# rospy.Time(0), timeout = rospy.Duration(10) )
listener.waitForTransform('/l_gripper_tool_frame', '/map',
rospy.Time(0), timeout = rospy.Duration(10) )
rate = rospy.Rate(2)
while not rospy.is_shutdown():
p = PointStamped()
p.header.stamp = rospy.Time(0)
p.header.frame_id = '/l_gripper_tool_frame'
p.point.x = 0.015 # Frame is actually in middle of fingers. Move it out to tips
#p_earl = listener.transformPoint('/ear_antenna_left', p)
p_earl = listener.transformPoint('/map', p)
print '<x,y,z> = <%2.3f, %2.3f, %2.3f> ' % ( p_earl.point.x, p_earl.point.y, p_earl.point.z )
rate.sleep()
| ajibawa-2023/Python-Code-Large/train/row_99406 | 19 | 31 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0968, 0.0323, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.129, 0.0323, 0, 0.66, 0.0909, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('geometry_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1613, 0.0323, 0, 0.66, 0.1818, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Import_L6_C0", "label": "rospy import rospy", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1935, 0.0323, 0, 0.66, 0.2727, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Import_L7_C0", "label": "tf import tf", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.2258, 0.0323, 0, 0.66, 0.3636, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:ImportFrom_L8_C0", "label": "from geometry_msgs.msg import PointStamped", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2581, 0.0323, 0, 0.66, 0.4545, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PointStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PointStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Import_L10_C0", "label": "time import time", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.3226, 0.0323, 0, 0.66, 0.5455, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Expr_L12_C0", "label": "init_node()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.3871, 0.0323, 0, 0.66, 0.6364, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": "rospy.init_node('ground_truth_tag_pose')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L13_C0", "label": "listener = TransformListener()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.4194, 0.0323, 0, 0.66, 0.7273, 870, 3, 0, 0, 0, 108, 10, 1], "semantic": {"name": "listener", "arg_names": [], "import_names": [], "rhs_call_name": "TransformListener", "annotation": ""}, "snippet": "listener = tf.TransformListener()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Expr_L18_C0", "label": "waitForTransform()", "type": "expression", "loc": [18, 19], "level": 0, "parent": null, "vector": [8, 0, 0.5968, 0.0645, 0, 0.66, 0.8182, 900, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "waitForTransform", "arg_names": [], "import_names": [], "rhs_call_name": "waitForTransform", "annotation": ""}, "snippet": "listener.waitForTransform('/l_gripper_tool_frame', '/map',\n rospy.Time(0), timeout = rospy.Duration(10) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L21_C0", "label": "rate = Rate()", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.6774, 0.0323, 0, 0.66, 0.9091, 477, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "rate", "arg_names": [], "import_names": [], "rhs_call_name": "Rate", "annotation": ""}, "snippet": "rate = rospy.Rate(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "label": "while", "type": "while", "loc": [22, 31], "level": 0, "parent": null, "vector": [5, 0, 0.8548, 0.3226, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while not rospy.is_shutdown():\n p = PointStamped()\n p.header.stamp = rospy.Time(0)\n p.header.frame_id = '/l_gripper_tool_frame'\n p.point.x = 0.015 # Frame is actually in middle of fingers. Move it out to tips\n #p_earl = listener.transformPoint('/ear_antenna_left', p)\n p_earl = listener.transformPoint('/map', p)\n print('<x,y,z> = <%2.3f, %2.3f, %2.3f> ' % ( p_earl.point.x, p_earl.point.y, p_earl.point.z ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L23_C4", "label": "p = PointStamped()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "vector": [14, 1, 0.7419, 0.0323, 1, 0.74, 0.0, 491, 3, 0, 0, 0, 969, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "PointStamped", "annotation": ""}, "snippet": " p = PointStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L24_C4", "label": "p.header.stamp = Time()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "vector": [14, 1, 0.7742, 0.0323, 1, 0.74, 0.1667, 334, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "p.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " p.header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L25_C4", "label": "p.header.frame_id =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "vector": [14, 1, 0.8065, 0.0323, 1, 0.74, 0.3333, 17, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "p.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p.header.frame_id = '/l_gripper_tool_frame'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L26_C4", "label": "p.point.x =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "vector": [14, 1, 0.8387, 0.0323, 1, 0.74, 0.5, 10, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "p.point.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p.point.x = 0.015 # Frame is actually in middle of fingers. Move it out to tips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L28_C4", "label": "p_earl = transformPoint()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "vector": [14, 1, 0.9032, 0.0323, 1, 0.74, 0.6667, 871, 3, 2, 0, 0, 987, 10, 1], "semantic": {"name": "p_earl", "arg_names": [], "import_names": [], "rhs_call_name": "transformPoint", "annotation": ""}, "snippet": " p_earl = listener.transformPoint('/map', p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Expr_L29_C4", "label": "print()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "vector": [8, 1, 0.9355, 0.0323, 1, 0.74, 0.8333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('<x,y,z> = <%2.3f, %2.3f, %2.3f> ' % ( p_earl.point.x, p_earl.point.y, p_earl.point.z ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99406:Expr_L31_C4", "label": "sleep()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "vector": [8, 1, 1.0, 0.0323, 1, 0.74, 1.0, 476, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rate.sleep()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99406:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99406:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99406:While_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99406:Expr_L31_C4"}] |
#!/usr/bin/python
# Basically a giant script.
import roslib
roslib.load_manifest( 'geometry_msgs' ) # the pickle files containe Point and Pose Stamped.
import rospy
from geometry_msgs.msg import PointStamped, PoseStamped
import sys
import glob
import yaml
import time
import optparse
import cPickle as pkl
import numpy as np, math
import pylab as pl
import string
from scipy.spatial import KDTree
import matplotlib as mpl
import friis
import math_util as mu
PLOT = False
if __name__ == '__main__':
p = optparse.OptionParser()
p.add_option('--yaml', action='store', type='string', dest='yaml', default='',
help='yaml file that describes this run.')
p.add_option('--plot', action='store_true', dest='plot',
help='Pop-up the resulting plot')
opt, args = p.parse_args()
yaml_fname = opt.yaml
PLOT = opt.plot
else:
yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/dir_est_head_datacap.yaml'
# yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/dir_est_shoulder_datacap.yaml'
if not yaml_fname:
print 'YAML file required!'
exit()
else:
f = open( yaml_fname )
yaml_config = yaml.load( f )
f.close()
def desired_ant( r ):
if dict.fromkeys(yaml_config['filters']['antennas']).has_key( r[2][1] ):
return True
else:
return False
# def xy( reading ):
# # Model estimate of P^inc_tag.
# # r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading
# d_rdr = reading[0]
# d_tag = reading[1]
# read = reading[2]
# d_rot = reading[3]
# ps = reading[4]
# tag_map, rdr_map, rot_map, base_map = ps
# return [ base_map.pose.position.x, base_map.pose.position.y ]
class Scan():
def __init__( self, d, tagid, fname ):
self.d = d
self.tagid = tagid
self.fname = fname
if not self.d.has_key( self.tagid ):
print 'ERROR: %s does not have tagid \'%s\'' % (self.fname, self.tagid)
exit()
self.theta_rot_map = [ r[3][0] for r in self.d[ self.tagid ] if desired_ant( r )]
self.theta_tag_map = [ r[3][1] for r in self.d[ self.tagid ] if desired_ant( r )]
self.rssi = [ r[2][0] for r in self.d[ self.tagid ] if r[2][1] if desired_ant( r )]
self.dat = np.row_stack([ np.array( self.theta_rot_map ),
np.array( self.theta_tag_map ),
np.array( self.rssi ) ])
self.theta_tag_gt = np.mean( self.dat[1] ) # The actual estimates for gt will fluctuate per read due to tf
# We want to know if the tag was inview and if there were positive reads
self.h, self.bins = np.histogram( self.dat[0], 36, (-np.pi, np.pi )) # 10-deg width bins
self.bin_centers = (self.bins[:-1] + self.bins[1:]) / 2.0
self.ind_all = np.sum( self.dat[0][:,np.newaxis] > self.bins[:-1], axis = 1) - 1 # gives indices for each datapoint into corresponding bin
self.ind_tag = np.sum( np.array([ self.theta_tag_gt ])[:,np.newaxis] > self.bins[:-1], axis = 1) - 1
self.inview = np.sum( self.ind_all == self.ind_tag ) > 0 # was there at least one reading in the ground-truth bin?
self.hasposreads = np.sum( self.dat != -1 ) > 0
# Histmax estimate only uses positive readings
self.m_rssi = [ np.mean( self.dat[2,np.intersect1d( np.where( self.ind_all == i )[0],
np.where( self.dat[2] != -1 )[0] )])
for i in xrange(len(self.h))]
self.m_rssi = np.nan_to_num( np.array( self.m_rssi )) # convert all the places with nan (mean of zero readings) to
self.ind_max = np.argmax( self.m_rssi )
self.max_m_rssi = self.m_rssi[ self.ind_max ]
self.histmax_est = self.bin_centers[ self.ind_max ]
self.histmax_err = mu.standard_rad( self.histmax_est - self.theta_tag_gt )
# Static estimation: pick the midpoint angle.
# We assume theta_rot_map will be contiguous between [-pi,pi] --> choose a good rotation frame.
self.static_est = np.min(self.dat[0]) + ( np.max(self.dat[0]) - np.min(self.dat[0]) ) / 2.0
self.static_err = mu.standard_rad( self.static_est - self.theta_tag_gt )
first_read = self.d[ self.tagid ][0]
pose_robot = first_read[4][3]
prx = pose_robot.pose.position.x
pry = pose_robot.pose.position.y
pose_tag = first_read[4][0]
ptx = pose_tag.pose.position.x
pty = pose_tag.pose.position.y
dist = np.sqrt( (prx-ptx)**2.0 + (pry-pty)**2.0 )
self.stats = [ prx,
pry,
dist,
self.max_m_rssi,
self.histmax_est,
self.histmax_err,
self.static_est,
self.static_err ]
return
fnames = reduce( lambda x,y: x+y, [ glob.glob(i) for i in yaml_config['glob_files'] ], [] )
# Load all pkl files into one huge dictionary.
# d = { 'tagid1': [ PROC_READ1, PROC_READ2, ... ],
# ...
# }
scans = []
for i,fname in enumerate( fnames ):
print 'Loading (%d of %d): %s' % (i+1, len(fnames), fname)
f = open( fname, 'r' )
d_new = pkl.load( f )
f.close()
for k in d_new.keys():
if dict.fromkeys(yaml_config['filters']['tags']).has_key( k ):
scans += [ Scan( d_new, k, fname ) ]
skipped = 0
stats = []
for s in scans:
if not s.inview or not s.hasposreads:
skipped += 1
else:
if PLOT:
f = pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pl.plot( s.dat[0] * 180.0 / np.pi, np.clip(s.dat[2],69,110), 'rx' )
pl.hold( True )
pl.plot( [ s.theta_tag_gt * 180.0 / np.pi ], [ np.max(s.dat[2])+2 ], 'bo' ) # tag groundtruth
pl.plot( [ s.histmax_est * 180.0 / np.pi ], [ np.max(s.dat[2])+1 ], 'ko' ) # histmax estiamte
pl.ylim( (68,105) )
pl.xlim( (-180,180) )
pl.xlabel( 'Rotation Angle (degrees)')
pl.ylabel( 'RSSI')
pl.title( 'RSSI versus rotation angle' )
pl.legend(['RFID reads', 'Groundtruth', 'ARGMAX Est'], loc=(1.03,0.2))
f = s.fname
sr = string.rfind( f, '/' )
pl.savefig( yaml_config['outimage'] + f[sr+1:sr+string.find(f[sr:],'.')] + '_pincrdr.png' )
pl.close()
stats.append( s.stats )
npstats = np.array( stats ).T
print 'Skipped (not in view or no positive reads): ', skipped
print 'ARGMAX Stats:'
herr = npstats[5]
magherr = np.abs( herr )
print '\tmean err: ', math.degrees(np.mean( herr ))
print '\tstd err: ', math.degrees(np.std( herr ))
print '\tRMS err (should be same as stderr): ', math.degrees( np.sqrt(np.mean(np.power(herr, 2.0))) )
print '\tmean magerr: ', math.degrees(np.mean( magherr ))
print '\tstddev magerr: ', math.degrees(np.std( magherr ))
print 'STATIC Stats:'
serr = npstats[7]
magserr = np.abs( serr )
print '\tmean err: ', math.degrees(np.mean( serr ))
print '\tstd err: ', math.degrees(np.std( serr ))
print '\tRMS err (should be same as stderr): ', math.degrees( np.sqrt(np.mean(np.power(serr, 2.0))) )
print '\tmean magerr: ', math.degrees(np.mean( magserr ))
print '\tstddev magerr: ', math.degrees(np.std( magserr ))
# Setup for plots below
dist = npstats[2]
h_d,bins_d = np.histogram( dist, 8, range=(0.0,8.0)) # we want to consider distances out to 0m-8m
ind_d = np.sum( dist[:,np.newaxis] > bins_d[:-1], axis=1) - 1
num_d = np.array([ len( np.where( ind_d == i )[0] ) for i in xrange(len(h_d)) ])
rssi = npstats[3]
h_r,bins_r = np.histogram( rssi, 8, range=(71,101)) # we want to consider distances out to 0m-8m
ind_r = np.sum( rssi[:,np.newaxis] > bins_r[:-1], axis=1) - 1
num_r = np.array([ len( np.where( ind_r == i )[0] ) for i in xrange(len(h_r)) ])
# Means (md) and StandardDev (sd) at Distance (in Degrees)
magherr_md = np.array([ np.mean( magherr[ np.where( ind_d == i )[0] ]) for i in xrange(len(h_d)) ]) * 180.0 / np.pi
magherr_sd = np.array([ np.std( magherr[ np.where( ind_d == i )[0] ]) for i in xrange(len(h_d)) ]) * 180.0 / np.pi
magherr_sd[ np.where( num_d < 3 )[0] ] = 0 # Only put errorbars where we have sufficient data!
magserr_md = np.array([ np.mean( magserr[ np.where( ind_d == i )[0] ]) for i in xrange(len(h_d)) ]) * 180.0 / np.pi
magserr_sd = np.array([ np.std( magserr[ np.where( ind_d == i )[0] ]) for i in xrange(len(h_d)) ]) * 180.0 / np.pi
magserr_sd[ np.where( num_d < 3 )[0] ] = 0 # Only put errorbars where we have sufficient data!
# Means (mr) and StandardDev (sr) at MaxRSSI (in Degrees)
magherr_mr = np.array([ np.mean( magherr[ np.where( ind_r == i )[0] ]) for i in xrange(len(h_r)) ]) * 180.0 / np.pi
magherr_sr = np.array([ np.std( magherr[ np.where( ind_r == i )[0] ]) for i in xrange(len(h_r)) ]) * 180.0 / np.pi
magherr_sr[ np.where( num_r < 3 )[0] ] = 0 # Only put errorbars where we have sufficient data!
magserr_mr = np.array([ np.mean( magserr[ np.where( ind_r == i )[0] ]) for i in xrange(len(h_r)) ]) * 180.0 / np.pi
magserr_sr = np.array([ np.std( magserr[ np.where( ind_r == i )[0] ]) for i in xrange(len(h_r)) ]) * 180.0 / np.pi
magserr_sr[ np.where( num_r < 3 )[0] ] = 0 # Only put errorbars where we have sufficient data!
# | Err | vs. distance (Bar Plot)
f = pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pl.bar( bins_d[:-1], magherr_md, 1.0, color='g', yerr=magherr_sd )
pl.xlim( (0.0,8.0) )
pl.ylim( (-20.0,180) )
pl.xlabel( 'Distance From Tag (m)')
pl.ylabel( '|Angular Error| (degrees)')
# pl.title( 'ARGMAX' )
pl.savefig( yaml_config['outimage'] + '_magherr_vs_dist.png' )
pl.close()
f = pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pl.bar( bins_d[:-1], magserr_md, 1.0, color='r', yerr=magserr_sd )
pl.xlim( (0.0,8.0) )
pl.ylim( (-20.0,180) )
pl.xlabel( 'Distance From Tag (m)')
pl.ylabel( '|Angular Error| (degrees)')
# pl.title( 'STATIC' )
pl.savefig( yaml_config['outimage'] + '_magserr_vs_dist.png' )
# | Err | vs. MaxRSSI (Bar Plot)
f = pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pl.bar( bins_r[:-1], magherr_mr, bins_r[1] - bins_r[0], color='g', yerr=magherr_sr )
pl.xlim( (69,105) )
print 'Max RSSI (argmax):'
print '\t', bins_r[:-1]
print '\t', magherr_mr
print '\t', magherr_sr
pl.ylim( (-20.0,180) )
pl.xlabel( r'Max $\mathsf{E}[P(RSSI|\tau)]$')
pl.ylabel( '|Angular Error| (degrees)')
# pl.title( 'ARGMAX' )
pl.savefig( yaml_config['outimage'] + '_magherr_vs_mrssi.png' )
pl.close()
f = pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pl.bar( bins_r[:-1], magserr_mr, bins_r[1] - bins_r[0], color='r', yerr=magserr_sr )
print 'Max RSSI (static):'
print '\t', bins_r[:-1]
print '\t', magserr_mr
print '\t', magserr_sr
pl.xlim( (69,105) )
pl.ylim( (-20.0,180) )
pl.xlabel( r'Max $\mathsf{E}[P(RSSI|\tau)]$')
pl.ylabel( '|Angular Error| (degrees)')
# pl.title( 'ARGMAX' )
pl.savefig( yaml_config['outimage'] + '_magserr_vs_mrssi.png' )
pl.close()
# | Err | vs. location (Surface Plot)
XBINS = 9
YBINS = 5
XMIN = 0.0
XMAX = 11.0
YMIN = 0.0
YMAX = 7.0
xy = np.row_stack([ npstats[0],
npstats[1] ]) # xy as 2xN
H,xedges,yedges = np.histogram2d( xy[0], xy[1],
bins=(XBINS,YBINS),
range=[[XMIN,XMAX],
[YMIN,YMAX]])
XS,YS = np.meshgrid( xedges, yedges )
bins_ind_x = np.sum( xy[0][:,np.newaxis] > xedges[:-1], axis = 1 ) - 1 # Tells the index for each of the reads
bins_ind_y = np.sum( xy[1][:,np.newaxis] > yedges[:-1], axis = 1 ) - 1
def get_mean( xi, yi, darr ):
# Which indices (into 3xN data) correspond to this x-bin and y-bin?
data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )
return np.mean( darr[ data_ind ]) * 180 / np.pi
# import pdb
# pdb.set_trace()
magherr_Z = np.ma.array( np.copy(H.T), mask=(H.T < 1) )
magserr_Z = np.ma.array( np.copy(H.T), mask=(H.T < 1) )
# pdb.set_trace()
for i, (xi,yi) in enumerate( zip( *np.where( magherr_Z.mask == False ))):
magherr_Z[xi,yi] = get_mean( xi, yi, magherr )
magserr_Z[xi,yi] = get_mean( xi, yi, magserr )
# pdb.set_trace()
f = pl.figure( figsize=(10,6) )
pl.hold(True)
pl.pcolor( XS, YS, magherr_Z, cmap=pl.cm.jet ) # or hot?
pl.xlim( (-1,12) )
pl.ylim( (-1,8) )
pl.axis( 'equal' )
pl.clim( 0.0, 180.0 )
pl.colorbar()
pl.xlabel( 'X-Coordinate (meters)' )
pl.ylabel( 'Y-Coordinate (meters)' )
pl.savefig( yaml_config['outimage'] + '_magherr_contour.png' )
pl.close()
f = pl.figure( figsize=(10,6) )
pl.hold(True)
pl.pcolor( XS, YS, magserr_Z, cmap=pl.cm.jet ) # or hot?
pl.xlim( (-1,12) )
pl.ylim( (-1,8) )
pl.axis( 'equal' )
pl.clim( 0.0, 180.0 )
pl.colorbar()
pl.xlabel( 'X-Coordinate (meters)' )
pl.ylabel( 'Y-Coordinate (meters)' )
pl.savefig( yaml_config['outimage'] + '_magserr_contour.png' )
pl.close()
| ajibawa-2023/Python-Code-Large/train/row_99407 | 228 | 360 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L5_C0", "label": "roslib import roslib", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0139, 0.0028, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0167, 0.0028, 0, 0.66, 0.0068, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'geometry_msgs' ) # the pickle files containe Point and Pose Stamped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L7_C0", "label": "rospy import rospy", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0194, 0.0028, 0, 0.66, 0.0136, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:ImportFrom_L9_C0", "label": "from geometry_msgs.msg import PointStamped, PoseStamped", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.025, 0.0028, 0, 0.66, 0.0204, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PointStamped", "PoseStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PointStamped, PoseStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L12_C0", "label": "sys import sys", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0333, 0.0028, 0, 0.66, 0.0272, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L13_C0", "label": "glob import glob", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0361, 0.0028, 0, 0.66, 0.034, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L14_C0", "label": "yaml import yaml", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0389, 0.0028, 0, 0.66, 0.0408, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L15_C0", "label": "time import time", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0028, 0, 0.66, 0.0476, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L16_C0", "label": "optparse import optparse", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0444, 0.0028, 0, 0.66, 0.0544, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L17_C0", "label": "cPickle import pkl", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0472, 0.0028, 0, 0.66, 0.0612, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L18_C0", "label": "numpy import np, math", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.0028, 0, 0.66, 0.068, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L19_C0", "label": "pylab import pl", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0528, 0.0028, 0, 0.66, 0.0748, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L20_C0", "label": "string import string", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0028, 0, 0.66, 0.0816, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:ImportFrom_L21_C0", "label": "from scipy.spatial import KDTree", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0583, 0.0028, 0, 0.66, 0.0884, 384, 0, 1, 0, 0, 384, 0, 0], "semantic": {"name": "scipy.spatial", "arg_names": [], "import_names": ["KDTree"], "rhs_call_name": "", "annotation": ""}, "snippet": "from scipy.spatial import KDTree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L22_C0", "label": "matplotlib import mpl", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0611, 0.0028, 0, 0.66, 0.0952, 75, 0, 1, 0, 0, 75, 0, 0], "semantic": {"name": "matplotlib", "arg_names": [], "import_names": ["mpl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import matplotlib as mpl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L24_C0", "label": "friis import friis", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0028, 0, 0.66, 0.102, 769, 0, 1, 0, 0, 769, 0, 0], "semantic": {"name": "friis", "arg_names": [], "import_names": ["friis"], "rhs_call_name": "", "annotation": ""}, "snippet": "import friis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Import_L25_C0", "label": "math_util import mu", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0694, 0.0028, 0, 0.66, 0.1088, 359, 0, 1, 0, 0, 359, 0, 0], "semantic": {"name": "math_util", "arg_names": [], "import_names": ["mu"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math_util as mu"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L27_C0", "label": "PLOT =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.075, 0.0028, 0, 0.66, 0.1156, 614, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "PLOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PLOT = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "label": "if", "type": "if", "loc": [29, 40], "level": 0, "parent": null, "vector": [4, 0, 0.0958, 0.0333, 0, 0.66, 0.1224, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n p = optparse.OptionParser()\n p.add_option('--yaml', action='store', type='string', dest='yaml', default='',\n help='yaml file that describes this run.')\n p.add_option('--plot', action='store_true', dest='plot',\n help='Pop-up the resulting plot')\n opt, args = p.parse_args()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L30_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "vector": [14, 1, 0.0833, 0.0028, 1, 0.24, 0.0, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L31_C4", "label": "add_option()", "type": "expression", "loc": [31, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "vector": [8, 1, 0.0875, 0.0056, 1, 0.24, 0.1667, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--yaml', action='store', type='string', dest='yaml', default='',\n help='yaml file that describes this run.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L33_C4", "label": "add_option()", "type": "expression", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "vector": [8, 1, 0.0931, 0.0056, 1, 0.24, 0.3333, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--plot', action='store_true', dest='plot',\n help='Pop-up the resulting plot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L35_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "vector": [14, 1, 0.0972, 0.0028, 1, 0.24, 0.5, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L37_C4", "label": "yaml_fname =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "vector": [14, 1, 0.1028, 0.0028, 1, 0.24, 0.6667, 590, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yaml_fname = opt.yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L38_C4", "label": "PLOT =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "vector": [14, 1, 0.1056, 0.0028, 1, 0.24, 0.8333, 614, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "PLOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PLOT = opt.plot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L40_C4", "label": "yaml_fname =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "vector": [14, 1, 0.1111, 0.0028, 1, 0.24, 1.0, 590, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/dir_est_head_datacap.yaml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "label": "if", "type": "if", "loc": [43, 49], "level": 0, "parent": null, "vector": [4, 0, 0.1278, 0.0194, 0, 0.66, 0.1293, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not yaml_fname:\n print('YAML file required!')\n exit()\nelse:\n f = open( yaml_fname )\n yaml_config = yaml.load( f )\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L44_C4", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "vector": [8, 1, 0.1222, 0.0028, 1, 0.88, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('YAML file required!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L45_C4", "label": "exit()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "vector": [8, 1, 0.125, 0.0028, 1, 0.88, 0.25, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L47_C4", "label": "f = open()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "vector": [14, 1, 0.1306, 0.0028, 1, 0.88, 0.5, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L48_C4", "label": "yaml_config = load()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "vector": [14, 1, 0.1333, 0.0028, 1, 0.88, 0.75, 248, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "yaml_config", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " yaml_config = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L49_C4", "label": "close()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "vector": [8, 1, 0.1361, 0.0028, 1, 0.88, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L51_C0", "label": "desired_ant", "type": "function", "loc": [51, 55], "level": 0, "parent": null, "vector": [2, 0, 0.1472, 0.0139, 0, 0.66, 0.1361, 526, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "desired_ant", "arg_names": ["r"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def desired_ant( r ):\n if dict.fromkeys(yaml_config['filters']['antennas']).has_key( r[2][1] ):\n return True\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L52_C4", "label": "if", "type": "if", "loc": [52, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L51_C0", "vector": [4, 1, 0.1486, 0.0111, 1, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dict.fromkeys(yaml_config['filters']['antennas']).has_key( r[2][1] ):\n return True\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L52_C4", "vector": [13, 2, 0.1472, 0.0028, 2, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L52_C4", "vector": [13, 2, 0.1528, 0.0028, 2, 0.17, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:ClassDef_L70_C0", "label": "Scan", "type": "class", "loc": [70, 134], "level": 0, "parent": null, "vector": [3, 0, 0.2833, 0.1806, 0, 0.66, 0.1429, 516, 0, 1, 0, 0, 0, 0, 32], "semantic": {"name": "Scan", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Scan():\n def __init__( self, d, tagid, fname ):\n self.d = d\n self.tagid = tagid\n self.fname = fname\n \n if not self.d.has_key( self.tagid ):\n print('ERROR: %s does not have tagid \\'%s\\'' % (self.fname, self.tagid))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "label": "__init__", "type": "function", "loc": [71, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:ClassDef_L70_C0", "vector": [2, 1, 0.2847, 0.1778, 1, 0.42, 0.0, 555, 0, 4, 0, 0, 0, 0, 32], "semantic": {"name": "__init__", "arg_names": ["self", "d", "tagid", "fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, d, tagid, fname ):\n self.d = d\n self.tagid = tagid\n self.fname = fname\n \n if not self.d.has_key( self.tagid ):\n print('ERROR: %s does not have tagid \\'%s\\'' % (self.fname, self.tagid))\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L72_C8", "label": "self.d =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2, 0.0028, 2, 0.19, 0.0, 745, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.d = d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L73_C8", "label": "self.tagid =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2028, 0.0028, 2, 0.19, 0.0312, 251, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tagid = tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L74_C8", "label": "self.fname =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2056, 0.0028, 2, 0.19, 0.0625, 935, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.fname = fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L76_C8", "label": "if", "type": "if", "loc": [76, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [4, 2, 0.2139, 0.0083, 2, 0.19, 0.0938, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.d.has_key( self.tagid ):\n print('ERROR: %s does not have tagid \\'%s\\'' % (self.fname, self.tagid))\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L77_C12", "label": "print()", "type": "expression", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L76_C8", "vector": [8, 3, 0.2139, 0.0028, 3, 0.21, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('ERROR: %s does not have tagid \\'%s\\'' % (self.fname, self.tagid))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L78_C12", "label": "exit()", "type": "expression", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L76_C8", "vector": [8, 3, 0.2167, 0.0028, 3, 0.21, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L80_C8", "label": "self.theta_rot_map =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2222, 0.0028, 2, 0.19, 0.125, 200, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.theta_rot_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.theta_rot_map = [ r[3][0] for r in self.d[ self.tagid ] if desired_ant( r )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L81_C8", "label": "self.theta_tag_map =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.225, 0.0028, 2, 0.19, 0.1562, 914, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.theta_tag_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.theta_tag_map = [ r[3][1] for r in self.d[ self.tagid ] if desired_ant( r )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L82_C8", "label": "self.rssi =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2278, 0.0028, 2, 0.19, 0.1875, 11, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.rssi = [ r[2][0] for r in self.d[ self.tagid ] if r[2][1] if desired_ant( r )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L84_C8", "label": "self.dat = row_stack()", "type": "assigned_variable", "loc": [84, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2361, 0.0083, 2, 0.19, 0.2188, 176, 3, 1, 0, 0, 612, 10, 4], "semantic": {"name": "self.dat", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": " self.dat = np.row_stack([ np.array( self.theta_rot_map ),\n np.array( self.theta_tag_map ),\n np.array( self.rssi ) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L88_C8", "label": "self.theta_tag_gt = mean()", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2444, 0.0028, 2, 0.19, 0.25, 112, 3, 1, 0, 0, 856, 10, 1], "semantic": {"name": "self.theta_tag_gt", "arg_names": [], "import_names": [], "rhs_call_name": "mean", "annotation": ""}, "snippet": " self.theta_tag_gt = np.mean( self.dat[1] ) # The actual estimates for gt will fluctuate per read due to tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L91_C8", "label": " = histogram()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2528, 0.0028, 2, 0.19, 0.2812, 0, 3, 3, 0, 0, 428, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "histogram", "annotation": ""}, "snippet": " self.h, self.bins = np.histogram( self.dat[0], 36, (-np.pi, np.pi )) # 10-deg width bins"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L92_C8", "label": "self.bin_centers =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2556, 0.0028, 2, 0.19, 0.3125, 332, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.bin_centers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.bin_centers = (self.bins[:-1] + self.bins[1:]) / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L93_C8", "label": "self.ind_all =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2583, 0.0028, 2, 0.19, 0.3438, 109, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.ind_all", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ind_all = np.sum( self.dat[0][:,np.newaxis] > self.bins[:-1], axis = 1) - 1 # gives indices for each datapoint into corresponding bin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L95_C8", "label": "self.ind_tag =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2639, 0.0028, 2, 0.19, 0.375, 951, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "self.ind_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ind_tag = np.sum( np.array([ self.theta_tag_gt ])[:,np.newaxis] > self.bins[:-1], axis = 1) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L96_C8", "label": "self.inview =", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2667, 0.0028, 2, 0.19, 0.4062, 705, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.inview", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.inview = np.sum( self.ind_all == self.ind_tag ) > 0 # was there at least one reading in the ground-truth bin?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L97_C8", "label": "self.hasposreads =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2694, 0.0028, 2, 0.19, 0.4375, 630, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.hasposreads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.hasposreads = np.sum( self.dat != -1 ) > 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L100_C8", "label": "self.m_rssi =", "type": "assigned_variable", "loc": [100, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2806, 0.0083, 2, 0.19, 0.4688, 600, 5, 0, 0, 0, 0, 0, 6], "semantic": {"name": "self.m_rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.m_rssi = [ np.mean( self.dat[2,np.intersect1d( np.where( self.ind_all == i )[0],\n np.where( self.dat[2] != -1 )[0] )])\n for i in xrange(len(self.h))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L103_C8", "label": "self.m_rssi = nan_to_num()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2861, 0.0028, 2, 0.19, 0.5, 600, 3, 1, 0, 0, 521, 10, 2], "semantic": {"name": "self.m_rssi", "arg_names": [], "import_names": [], "rhs_call_name": "nan_to_num", "annotation": ""}, "snippet": " self.m_rssi = np.nan_to_num( np.array( self.m_rssi )) # convert all the places with nan (mean of zero readings) to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L105_C8", "label": "self.ind_max = argmax()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2917, 0.0028, 2, 0.19, 0.5312, 896, 3, 1, 0, 0, 593, 10, 1], "semantic": {"name": "self.ind_max", "arg_names": [], "import_names": [], "rhs_call_name": "argmax", "annotation": ""}, "snippet": " self.ind_max = np.argmax( self.m_rssi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L106_C8", "label": "self.max_m_rssi =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2944, 0.0028, 2, 0.19, 0.5625, 174, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.max_m_rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.max_m_rssi = self.m_rssi[ self.ind_max ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L107_C8", "label": "self.histmax_est =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.2972, 0.0028, 2, 0.19, 0.5938, 384, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.histmax_est", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.histmax_est = self.bin_centers[ self.ind_max ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L108_C8", "label": "self.histmax_err = standard_rad()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3, 0.0028, 2, 0.19, 0.625, 352, 3, 1, 0, 0, 54, 10, 1], "semantic": {"name": "self.histmax_err", "arg_names": [], "import_names": [], "rhs_call_name": "standard_rad", "annotation": ""}, "snippet": " self.histmax_err = mu.standard_rad( self.histmax_est - self.theta_tag_gt )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L112_C8", "label": "self.static_est =", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3111, 0.0028, 2, 0.19, 0.6562, 56, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "self.static_est", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.static_est = np.min(self.dat[0]) + ( np.max(self.dat[0]) - np.min(self.dat[0]) ) / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L113_C8", "label": "self.static_err = standard_rad()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3139, 0.0028, 2, 0.19, 0.6875, 496, 3, 1, 0, 0, 54, 10, 1], "semantic": {"name": "self.static_err", "arg_names": [], "import_names": [], "rhs_call_name": "standard_rad", "annotation": ""}, "snippet": " self.static_err = mu.standard_rad( self.static_est - self.theta_tag_gt )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L115_C8", "label": "first_read =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3194, 0.0028, 2, 0.19, 0.7188, 304, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "first_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first_read = self.d[ self.tagid ][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L116_C8", "label": "pose_robot =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3222, 0.0028, 2, 0.19, 0.75, 941, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pose_robot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pose_robot = first_read[4][3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L117_C8", "label": "prx =", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.325, 0.0028, 2, 0.19, 0.7812, 27, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prx = pose_robot.pose.position.x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L118_C8", "label": "pry =", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3278, 0.0028, 2, 0.19, 0.8125, 854, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pry = pose_robot.pose.position.y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L120_C8", "label": "pose_tag =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3333, 0.0028, 2, 0.19, 0.8438, 995, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pose_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pose_tag = first_read[4][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L121_C8", "label": "ptx =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3361, 0.0028, 2, 0.19, 0.875, 306, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptx = pose_tag.pose.position.x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L122_C8", "label": "pty =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3389, 0.0028, 2, 0.19, 0.9062, 588, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pty", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pty = pose_tag.pose.position.y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L124_C8", "label": "dist = sqrt()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3444, 0.0028, 2, 0.19, 0.9375, 673, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "dist", "arg_names": [], "import_names": [], "rhs_call_name": "sqrt", "annotation": ""}, "snippet": " dist = np.sqrt( (prx-ptx)**2.0 + (pry-pty)**2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L126_C8", "label": "self.stats =", "type": "assigned_variable", "loc": [126, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [14, 2, 0.3597, 0.0222, 2, 0.19, 0.9688, 665, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.stats", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stats = [ prx,\n pry,\n dist,\n self.max_m_rssi,\n self.histmax_est,\n self.histmax_err,\n self.static_est,\n self.static_err ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Return_L134_C8", "label": "return", "type": "return", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "vector": [13, 2, 0.3722, 0.0028, 2, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L137_C0", "label": "fnames = reduce()", "type": "assigned_variable", "loc": [137, 137], "level": 0, "parent": null, "vector": [14, 0, 0.3806, 0.0028, 0, 0.66, 0.1497, 641, 3, 3, 0, 0, 622, 10, 2], "semantic": {"name": "fnames", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": "fnames = reduce( lambda x,y: x+y, [ glob.glob(i) for i in yaml_config['glob_files'] ], [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L144_C0", "label": "scans =", "type": "assigned_variable", "loc": [144, 144], "level": 0, "parent": null, "vector": [14, 0, 0.4, 0.0028, 0, 0.66, 0.1565, 971, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "scans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "scans = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "label": "for i, fname", "type": "for", "loc": [145, 153], "level": 0, "parent": null, "vector": [6, 0, 0.4139, 0.025, 0, 0.66, 0.1633, 641, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "i, fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i,fname in enumerate( fnames ):\n print('Loading (%d of %d): %s' % (i+1, len(fnames), fname))\n f = open( fname, 'r' )\n d_new = pkl.load( f )\n f.close()\n\n for k in d_new.keys():\n if dict.fromkeys(yaml_config['filters']['tags']).has_key( k ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L146_C4", "label": "print()", "type": "expression", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "vector": [8, 1, 0.4056, 0.0028, 1, 0.19, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading (%d of %d): %s' % (i+1, len(fnames), fname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L147_C4", "label": "f = open()", "type": "assigned_variable", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "vector": [14, 1, 0.4083, 0.0028, 1, 0.19, 0.25, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L148_C4", "label": "d_new = load()", "type": "assigned_variable", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "vector": [14, 1, 0.4111, 0.0028, 1, 0.19, 0.5, 388, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "d_new", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " d_new = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L149_C4", "label": "close()", "type": "expression", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "vector": [8, 1, 0.4139, 0.0028, 1, 0.19, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L151_C4", "label": "for k", "type": "for", "loc": [151, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "vector": [6, 1, 0.4222, 0.0083, 1, 0.19, 1.0, 954, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in d_new.keys():\n if dict.fromkeys(yaml_config['filters']['tags']).has_key( k ):\n scans += [ Scan( d_new, k, fname ) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L152_C8", "label": "if", "type": "if", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L151_C4", "vector": [4, 2, 0.4236, 0.0056, 2, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dict.fromkeys(yaml_config['filters']['tags']).has_key( k ):\n scans += [ Scan( d_new, k, fname ) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L155_C0", "label": "skipped =", "type": "assigned_variable", "loc": [155, 155], "level": 0, "parent": null, "vector": [14, 0, 0.4306, 0.0028, 0, 0.66, 0.1701, 348, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "skipped", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "skipped = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L156_C0", "label": "stats =", "type": "assigned_variable", "loc": [156, 156], "level": 0, "parent": null, "vector": [14, 0, 0.4333, 0.0028, 0, 0.66, 0.1769, 318, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "stats", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "stats = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L158_C0", "label": "for s", "type": "for", "loc": [158, 181], "level": 0, "parent": null, "vector": [6, 0, 0.4708, 0.0667, 0, 0.66, 0.1837, 553, 2, 0, 0, 0, 0, 0, 20], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for s in scans:\n if not s.inview or not s.hasposreads:\n skipped += 1\n else:\n if PLOT:\n f = pl.figure( figsize=(10,6) )\n pl.axes([0.1,0.1,0.65,0.8])\n pl.plot( s.dat[0] * 180.0 / np.pi, np.clip(s.dat[2],69,110), 'rx' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L159_C4", "label": "if", "type": "if", "loc": [159, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L158_C0", "vector": [4, 1, 0.4722, 0.0639, 1, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not s.inview or not s.hasposreads:\n skipped += 1\n else:\n if PLOT:\n f = pl.figure( figsize=(10,6) )\n pl.axes([0.1,0.1,0.65,0.8])\n pl.plot( s.dat[0] * 180.0 / np.pi, np.clip(s.dat[2],69,110), 'rx' )\n pl.hold( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "label": "if", "type": "if", "loc": [162, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L159_C4", "vector": [4, 2, 0.4736, 0.05, 2, 0.91, 0.0, 0, 2, 0, 0, 0, 0, 0, 19], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if PLOT:\n f = pl.figure( figsize=(10,6) )\n pl.axes([0.1,0.1,0.65,0.8])\n pl.plot( s.dat[0] * 180.0 / np.pi, np.clip(s.dat[2],69,110), 'rx' )\n pl.hold( True )\n pl.plot( [ s.theta_tag_gt * 180.0 / np.pi ], [ np.max(s.dat[2])+2 ], 'bo' ) # tag groundtruth\n pl.plot( [ s.histmax_est * 180.0 / np.pi ], [ np.max(s.dat[2])+1 ], 'ko' ) # histmax estiamte\n pl.ylim( (68,105) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L163_C12", "label": "f = figure()", "type": "assigned_variable", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [14, 3, 0.4528, 0.0028, 3, 0.3, 0.0, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L164_C12", "label": "axes()", "type": "expression", "loc": [164, 164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4556, 0.0028, 3, 0.3, 0.0667, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": " pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L165_C12", "label": "plot()", "type": "expression", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4583, 0.0028, 3, 0.3, 0.1333, 929, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot( s.dat[0] * 180.0 / np.pi, np.clip(s.dat[2],69,110), 'rx' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L166_C12", "label": "hold()", "type": "expression", "loc": [166, 166], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4611, 0.0028, 3, 0.3, 0.2, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": " pl.hold( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L167_C12", "label": "plot()", "type": "expression", "loc": [167, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4639, 0.0028, 3, 0.3, 0.2667, 929, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot( [ s.theta_tag_gt * 180.0 / np.pi ], [ np.max(s.dat[2])+2 ], 'bo' ) # tag groundtruth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L168_C12", "label": "plot()", "type": "expression", "loc": [168, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4667, 0.0028, 3, 0.3, 0.3333, 929, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot( [ s.histmax_est * 180.0 / np.pi ], [ np.max(s.dat[2])+1 ], 'ko' ) # histmax estiamte"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L169_C12", "label": "ylim()", "type": "expression", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4694, 0.0028, 3, 0.3, 0.4, 247, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylim", "arg_names": [], "import_names": [], "rhs_call_name": "ylim", "annotation": ""}, "snippet": " pl.ylim( (68,105) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L170_C12", "label": "xlim()", "type": "expression", "loc": [170, 170], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4722, 0.0028, 3, 0.3, 0.4667, 907, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlim", "arg_names": [], "import_names": [], "rhs_call_name": "xlim", "annotation": ""}, "snippet": " pl.xlim( (-180,180) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L171_C12", "label": "xlabel()", "type": "expression", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.475, 0.0028, 3, 0.3, 0.5333, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": " pl.xlabel( 'Rotation Angle (degrees)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L172_C12", "label": "ylabel()", "type": "expression", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4778, 0.0028, 3, 0.3, 0.6, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": " pl.ylabel( 'RSSI')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L173_C12", "label": "title()", "type": "expression", "loc": [173, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4806, 0.0028, 3, 0.3, 0.6667, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " pl.title( 'RSSI versus rotation angle' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L174_C12", "label": "legend()", "type": "expression", "loc": [174, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4833, 0.0028, 3, 0.3, 0.7333, 880, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pl.legend(['RFID reads', 'Groundtruth', 'ARGMAX Est'], loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L176_C12", "label": "f =", "type": "assigned_variable", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [14, 3, 0.4889, 0.0028, 3, 0.3, 0.8, 899, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f = s.fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L177_C12", "label": "sr = rfind()", "type": "assigned_variable", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [14, 3, 0.4917, 0.0028, 3, 0.3, 0.8667, 498, 3, 2, 0, 0, 634, 10, 1], "semantic": {"name": "sr", "arg_names": [], "import_names": [], "rhs_call_name": "rfind", "annotation": ""}, "snippet": " sr = string.rfind( f, '/' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L178_C12", "label": "savefig()", "type": "expression", "loc": [178, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4944, 0.0028, 3, 0.3, 0.9333, 677, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " pl.savefig( yaml_config['outimage'] + f[sr+1:sr+string.find(f[sr:],'.')] + '_pincrdr.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L179_C12", "label": "close()", "type": "expression", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "vector": [8, 3, 0.4972, 0.0028, 3, 0.3, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " pl.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L181_C8", "label": "append()", "type": "expression", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L159_C4", "vector": [8, 2, 0.5028, 0.0028, 2, 0.91, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " stats.append( s.stats )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L183_C0", "label": "npstats =", "type": "assigned_variable", "loc": [183, 183], "level": 0, "parent": null, "vector": [14, 0, 0.5083, 0.0028, 0, 0.66, 0.1905, 127, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "npstats", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "npstats = np.array( stats ).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L185_C0", "label": "print()", "type": "expression", "loc": [185, 185], "level": 0, "parent": null, "vector": [8, 0, 0.5139, 0.0028, 0, 0.66, 0.1973, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Skipped (not in view or no positive reads): ', skipped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L187_C0", "label": "print()", "type": "expression", "loc": [187, 187], "level": 0, "parent": null, "vector": [8, 0, 0.5194, 0.0028, 0, 0.66, 0.2041, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('ARGMAX Stats:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L188_C0", "label": "herr =", "type": "assigned_variable", "loc": [188, 188], "level": 0, "parent": null, "vector": [14, 0, 0.5222, 0.0028, 0, 0.66, 0.2109, 10, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "herr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "herr = npstats[5]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L189_C0", "label": "magherr = abs()", "type": "assigned_variable", "loc": [189, 189], "level": 0, "parent": null, "vector": [14, 0, 0.525, 0.0028, 0, 0.66, 0.2177, 167, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "magherr", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": "magherr = np.abs( herr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L190_C0", "label": "print()", "type": "expression", "loc": [190, 190], "level": 0, "parent": null, "vector": [8, 0, 0.5278, 0.0028, 0, 0.66, 0.2245, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tmean err: ', math.degrees(np.mean( herr )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L191_C0", "label": "print()", "type": "expression", "loc": [191, 191], "level": 0, "parent": null, "vector": [8, 0, 0.5306, 0.0028, 0, 0.66, 0.2313, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tstd err: ', math.degrees(np.std( herr )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L192_C0", "label": "print()", "type": "expression", "loc": [192, 192], "level": 0, "parent": null, "vector": [8, 0, 0.5333, 0.0028, 0, 0.66, 0.2381, 535, 3, 2, 0, 0, 0, 0, 5], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tRMS err (should be same as stderr): ', math.degrees( np.sqrt(np.mean(np.power(herr, 2.0))) ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L193_C0", "label": "print()", "type": "expression", "loc": [193, 193], "level": 0, "parent": null, "vector": [8, 0, 0.5361, 0.0028, 0, 0.66, 0.2449, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tmean magerr: ', math.degrees(np.mean( magherr )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L194_C0", "label": "print()", "type": "expression", "loc": [194, 194], "level": 0, "parent": null, "vector": [8, 0, 0.5389, 0.0028, 0, 0.66, 0.2517, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tstddev magerr: ', math.degrees(np.std( magherr )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L197_C0", "label": "print()", "type": "expression", "loc": [197, 197], "level": 0, "parent": null, "vector": [8, 0, 0.5472, 0.0028, 0, 0.66, 0.2585, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('STATIC Stats:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L198_C0", "label": "serr =", "type": "assigned_variable", "loc": [198, 198], "level": 0, "parent": null, "vector": [14, 0, 0.55, 0.0028, 0, 0.66, 0.2653, 203, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "serr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "serr = npstats[7]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L199_C0", "label": "magserr = abs()", "type": "assigned_variable", "loc": [199, 199], "level": 0, "parent": null, "vector": [14, 0, 0.5528, 0.0028, 0, 0.66, 0.2721, 343, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "magserr", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": "magserr = np.abs( serr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L200_C0", "label": "print()", "type": "expression", "loc": [200, 200], "level": 0, "parent": null, "vector": [8, 0, 0.5556, 0.0028, 0, 0.66, 0.2789, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tmean err: ', math.degrees(np.mean( serr )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L201_C0", "label": "print()", "type": "expression", "loc": [201, 201], "level": 0, "parent": null, "vector": [8, 0, 0.5583, 0.0028, 0, 0.66, 0.2857, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tstd err: ', math.degrees(np.std( serr )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L202_C0", "label": "print()", "type": "expression", "loc": [202, 202], "level": 0, "parent": null, "vector": [8, 0, 0.5611, 0.0028, 0, 0.66, 0.2925, 535, 3, 2, 0, 0, 0, 0, 5], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tRMS err (should be same as stderr): ', math.degrees( np.sqrt(np.mean(np.power(serr, 2.0))) ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L203_C0", "label": "print()", "type": "expression", "loc": [203, 203], "level": 0, "parent": null, "vector": [8, 0, 0.5639, 0.0028, 0, 0.66, 0.2993, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tmean magerr: ', math.degrees(np.mean( magserr )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L204_C0", "label": "print()", "type": "expression", "loc": [204, 204], "level": 0, "parent": null, "vector": [8, 0, 0.5667, 0.0028, 0, 0.66, 0.3061, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\tstddev magerr: ', math.degrees(np.std( magserr )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L209_C0", "label": "dist =", "type": "assigned_variable", "loc": [209, 209], "level": 0, "parent": null, "vector": [14, 0, 0.5806, 0.0028, 0, 0.66, 0.3129, 673, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dist = npstats[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L210_C0", "label": "h_d, bins_d = histogram()", "type": "assigned_variable", "loc": [210, 210], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0028, 0, 0.66, 0.3197, 794, 3, 3, 0, 0, 428, 10, 1], "semantic": {"name": "h_d, bins_d", "arg_names": [], "import_names": [], "rhs_call_name": "histogram", "annotation": ""}, "snippet": "h_d,bins_d = np.histogram( dist, 8, range=(0.0,8.0)) # we want to consider distances out to 0m-8m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L211_C0", "label": "ind_d =", "type": "assigned_variable", "loc": [211, 211], "level": 0, "parent": null, "vector": [14, 0, 0.5861, 0.0028, 0, 0.66, 0.3265, 208, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind_d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ind_d = np.sum( dist[:,np.newaxis] > bins_d[:-1], axis=1) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L212_C0", "label": "num_d = array()", "type": "assigned_variable", "loc": [212, 212], "level": 0, "parent": null, "vector": [14, 0, 0.5889, 0.0028, 0, 0.66, 0.3333, 446, 3, 1, 0, 0, 80, 10, 5], "semantic": {"name": "num_d", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "num_d = np.array([ len( np.where( ind_d == i )[0] ) for i in xrange(len(h_d)) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L214_C0", "label": "rssi =", "type": "assigned_variable", "loc": [214, 214], "level": 0, "parent": null, "vector": [14, 0, 0.5944, 0.0028, 0, 0.66, 0.3401, 906, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "rssi = npstats[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L215_C0", "label": "h_r, bins_r = histogram()", "type": "assigned_variable", "loc": [215, 215], "level": 0, "parent": null, "vector": [14, 0, 0.5972, 0.0028, 0, 0.66, 0.3469, 550, 3, 3, 0, 0, 428, 10, 1], "semantic": {"name": "h_r, bins_r", "arg_names": [], "import_names": [], "rhs_call_name": "histogram", "annotation": ""}, "snippet": "h_r,bins_r = np.histogram( rssi, 8, range=(71,101)) # we want to consider distances out to 0m-8m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L216_C0", "label": "ind_r =", "type": "assigned_variable", "loc": [216, 216], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.0028, 0, 0.66, 0.3537, 954, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind_r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ind_r = np.sum( rssi[:,np.newaxis] > bins_r[:-1], axis=1) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L217_C0", "label": "num_r = array()", "type": "assigned_variable", "loc": [217, 217], "level": 0, "parent": null, "vector": [14, 0, 0.6028, 0.0028, 0, 0.66, 0.3605, 621, 3, 1, 0, 0, 80, 10, 5], "semantic": {"name": "num_r", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "num_r = np.array([ len( np.where( ind_r == i )[0] ) for i in xrange(len(h_r)) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L220_C0", "label": "magherr_md =", "type": "assigned_variable", "loc": [220, 220], "level": 0, "parent": null, "vector": [14, 0, 0.6111, 0.0028, 0, 0.66, 0.3673, 751, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "magherr_md", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magherr_md = np.array([ np.mean( magherr[ np.where( ind_d == i )[0] ]) for i in xrange(len(h_d)) ]) * 180.0 / np.pi "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L221_C0", "label": "magherr_sd =", "type": "assigned_variable", "loc": [221, 221], "level": 0, "parent": null, "vector": [14, 0, 0.6139, 0.0028, 0, 0.66, 0.3741, 672, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "magherr_sd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magherr_sd = np.array([ np.std( magherr[ np.where( ind_d == i )[0] ]) for i in xrange(len(h_d)) ]) * 180.0 / np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L222_C0", "label": "assign", "type": "assigned_variable", "loc": [222, 222], "level": 0, "parent": null, "vector": [14, 0, 0.6167, 0.0028, 0, 0.66, 0.381, 0, 1, 0, 0, 0, 0, 1, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magherr_sd[ np.where( num_d < 3 )[0] ] = 0 # Only put errorbars where we have sufficient data!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L224_C0", "label": "magserr_md =", "type": "assigned_variable", "loc": [224, 224], "level": 0, "parent": null, "vector": [14, 0, 0.6222, 0.0028, 0, 0.66, 0.3878, 549, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "magserr_md", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magserr_md = np.array([ np.mean( magserr[ np.where( ind_d == i )[0] ]) for i in xrange(len(h_d)) ]) * 180.0 / np.pi "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L225_C0", "label": "magserr_sd =", "type": "assigned_variable", "loc": [225, 225], "level": 0, "parent": null, "vector": [14, 0, 0.625, 0.0028, 0, 0.66, 0.3946, 461, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "magserr_sd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magserr_sd = np.array([ np.std( magserr[ np.where( ind_d == i )[0] ]) for i in xrange(len(h_d)) ]) * 180.0 / np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L226_C0", "label": "assign", "type": "assigned_variable", "loc": [226, 226], "level": 0, "parent": null, "vector": [14, 0, 0.6278, 0.0028, 0, 0.66, 0.4014, 0, 1, 0, 0, 0, 0, 1, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magserr_sd[ np.where( num_d < 3 )[0] ] = 0 # Only put errorbars where we have sufficient data!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L229_C0", "label": "magherr_mr =", "type": "assigned_variable", "loc": [229, 229], "level": 0, "parent": null, "vector": [14, 0, 0.6361, 0.0028, 0, 0.66, 0.4082, 813, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "magherr_mr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magherr_mr = np.array([ np.mean( magherr[ np.where( ind_r == i )[0] ]) for i in xrange(len(h_r)) ]) * 180.0 / np.pi "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L230_C0", "label": "magherr_sr =", "type": "assigned_variable", "loc": [230, 230], "level": 0, "parent": null, "vector": [14, 0, 0.6389, 0.0028, 0, 0.66, 0.415, 751, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "magherr_sr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magherr_sr = np.array([ np.std( magherr[ np.where( ind_r == i )[0] ]) for i in xrange(len(h_r)) ]) * 180.0 / np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L231_C0", "label": "assign", "type": "assigned_variable", "loc": [231, 231], "level": 0, "parent": null, "vector": [14, 0, 0.6417, 0.0028, 0, 0.66, 0.4218, 0, 1, 0, 0, 0, 0, 1, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magherr_sr[ np.where( num_r < 3 )[0] ] = 0 # Only put errorbars where we have sufficient data!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L233_C0", "label": "magserr_mr =", "type": "assigned_variable", "loc": [233, 233], "level": 0, "parent": null, "vector": [14, 0, 0.6472, 0.0028, 0, 0.66, 0.4286, 188, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "magserr_mr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magserr_mr = np.array([ np.mean( magserr[ np.where( ind_r == i )[0] ]) for i in xrange(len(h_r)) ]) * 180.0 / np.pi "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L234_C0", "label": "magserr_sr =", "type": "assigned_variable", "loc": [234, 234], "level": 0, "parent": null, "vector": [14, 0, 0.65, 0.0028, 0, 0.66, 0.4354, 822, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "magserr_sr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magserr_sr = np.array([ np.std( magserr[ np.where( ind_r == i )[0] ]) for i in xrange(len(h_r)) ]) * 180.0 / np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L235_C0", "label": "assign", "type": "assigned_variable", "loc": [235, 235], "level": 0, "parent": null, "vector": [14, 0, 0.6528, 0.0028, 0, 0.66, 0.4422, 0, 1, 0, 0, 0, 0, 1, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "magserr_sr[ np.where( num_r < 3 )[0] ] = 0 # Only put errorbars where we have sufficient data!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L240_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [240, 240], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0028, 0, 0.66, 0.449, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L241_C0", "label": "axes()", "type": "expression", "loc": [241, 241], "level": 0, "parent": null, "vector": [8, 0, 0.6694, 0.0028, 0, 0.66, 0.4558, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": "pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L242_C0", "label": "bar()", "type": "expression", "loc": [242, 242], "level": 0, "parent": null, "vector": [8, 0, 0.6722, 0.0028, 0, 0.66, 0.4626, 300, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "bar", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": "pl.bar( bins_d[:-1], magherr_md, 1.0, color='g', yerr=magherr_sd )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L243_C0", "label": "xlim()", "type": "expression", "loc": [243, 243], "level": 0, "parent": null, "vector": [8, 0, 0.675, 0.0028, 0, 0.66, 0.4694, 907, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlim", "arg_names": [], "import_names": [], "rhs_call_name": "xlim", "annotation": ""}, "snippet": "pl.xlim( (0.0,8.0) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L244_C0", "label": "ylim()", "type": "expression", "loc": [244, 244], "level": 0, "parent": null, "vector": [8, 0, 0.6778, 0.0028, 0, 0.66, 0.4762, 247, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylim", "arg_names": [], "import_names": [], "rhs_call_name": "ylim", "annotation": ""}, "snippet": "pl.ylim( (-20.0,180) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L245_C0", "label": "xlabel()", "type": "expression", "loc": [245, 245], "level": 0, "parent": null, "vector": [8, 0, 0.6806, 0.0028, 0, 0.66, 0.483, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'Distance From Tag (m)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L246_C0", "label": "ylabel()", "type": "expression", "loc": [246, 246], "level": 0, "parent": null, "vector": [8, 0, 0.6833, 0.0028, 0, 0.66, 0.4898, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( '|Angular Error| (degrees)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L248_C0", "label": "savefig()", "type": "expression", "loc": [248, 248], "level": 0, "parent": null, "vector": [8, 0, 0.6889, 0.0028, 0, 0.66, 0.4966, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_magherr_vs_dist.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L249_C0", "label": "close()", "type": "expression", "loc": [249, 249], "level": 0, "parent": null, "vector": [8, 0, 0.6917, 0.0028, 0, 0.66, 0.5034, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "pl.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L251_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [251, 251], "level": 0, "parent": null, "vector": [14, 0, 0.6972, 0.0028, 0, 0.66, 0.5102, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L252_C0", "label": "axes()", "type": "expression", "loc": [252, 252], "level": 0, "parent": null, "vector": [8, 0, 0.7, 0.0028, 0, 0.66, 0.517, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": "pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L253_C0", "label": "bar()", "type": "expression", "loc": [253, 253], "level": 0, "parent": null, "vector": [8, 0, 0.7028, 0.0028, 0, 0.66, 0.5238, 300, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "bar", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": "pl.bar( bins_d[:-1], magserr_md, 1.0, color='r', yerr=magserr_sd )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L254_C0", "label": "xlim()", "type": "expression", "loc": [254, 254], "level": 0, "parent": null, "vector": [8, 0, 0.7056, 0.0028, 0, 0.66, 0.5306, 907, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlim", "arg_names": [], "import_names": [], "rhs_call_name": "xlim", "annotation": ""}, "snippet": "pl.xlim( (0.0,8.0) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L255_C0", "label": "ylim()", "type": "expression", "loc": [255, 255], "level": 0, "parent": null, "vector": [8, 0, 0.7083, 0.0028, 0, 0.66, 0.5374, 247, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylim", "arg_names": [], "import_names": [], "rhs_call_name": "ylim", "annotation": ""}, "snippet": "pl.ylim( (-20.0,180) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L256_C0", "label": "xlabel()", "type": "expression", "loc": [256, 256], "level": 0, "parent": null, "vector": [8, 0, 0.7111, 0.0028, 0, 0.66, 0.5442, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'Distance From Tag (m)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L257_C0", "label": "ylabel()", "type": "expression", "loc": [257, 257], "level": 0, "parent": null, "vector": [8, 0, 0.7139, 0.0028, 0, 0.66, 0.551, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( '|Angular Error| (degrees)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L259_C0", "label": "savefig()", "type": "expression", "loc": [259, 259], "level": 0, "parent": null, "vector": [8, 0, 0.7194, 0.0028, 0, 0.66, 0.5578, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_magserr_vs_dist.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L264_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [264, 264], "level": 0, "parent": null, "vector": [14, 0, 0.7333, 0.0028, 0, 0.66, 0.5646, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L265_C0", "label": "axes()", "type": "expression", "loc": [265, 265], "level": 0, "parent": null, "vector": [8, 0, 0.7361, 0.0028, 0, 0.66, 0.5714, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": "pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L266_C0", "label": "bar()", "type": "expression", "loc": [266, 266], "level": 0, "parent": null, "vector": [8, 0, 0.7389, 0.0028, 0, 0.66, 0.5782, 300, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "bar", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": "pl.bar( bins_r[:-1], magherr_mr, bins_r[1] - bins_r[0], color='g', yerr=magherr_sr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L267_C0", "label": "xlim()", "type": "expression", "loc": [267, 267], "level": 0, "parent": null, "vector": [8, 0, 0.7417, 0.0028, 0, 0.66, 0.585, 907, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlim", "arg_names": [], "import_names": [], "rhs_call_name": "xlim", "annotation": ""}, "snippet": "pl.xlim( (69,105) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L268_C0", "label": "print()", "type": "expression", "loc": [268, 268], "level": 0, "parent": null, "vector": [8, 0, 0.7444, 0.0028, 0, 0.66, 0.5918, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Max RSSI (argmax):')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L269_C0", "label": "print()", "type": "expression", "loc": [269, 269], "level": 0, "parent": null, "vector": [8, 0, 0.7472, 0.0028, 0, 0.66, 0.5986, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\t', bins_r[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L270_C0", "label": "print()", "type": "expression", "loc": [270, 270], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.0028, 0, 0.66, 0.6054, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\t', magherr_mr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L271_C0", "label": "print()", "type": "expression", "loc": [271, 271], "level": 0, "parent": null, "vector": [8, 0, 0.7528, 0.0028, 0, 0.66, 0.6122, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\t', magherr_sr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L272_C0", "label": "ylim()", "type": "expression", "loc": [272, 272], "level": 0, "parent": null, "vector": [8, 0, 0.7556, 0.0028, 0, 0.66, 0.619, 247, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylim", "arg_names": [], "import_names": [], "rhs_call_name": "ylim", "annotation": ""}, "snippet": "pl.ylim( (-20.0,180) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L273_C0", "label": "xlabel()", "type": "expression", "loc": [273, 273], "level": 0, "parent": null, "vector": [8, 0, 0.7583, 0.0028, 0, 0.66, 0.6259, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( r'Max $\\mathsf{E}[P(RSSI|\\tau)]$')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L274_C0", "label": "ylabel()", "type": "expression", "loc": [274, 274], "level": 0, "parent": null, "vector": [8, 0, 0.7611, 0.0028, 0, 0.66, 0.6327, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( '|Angular Error| (degrees)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L276_C0", "label": "savefig()", "type": "expression", "loc": [276, 276], "level": 0, "parent": null, "vector": [8, 0, 0.7667, 0.0028, 0, 0.66, 0.6395, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_magherr_vs_mrssi.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L277_C0", "label": "close()", "type": "expression", "loc": [277, 277], "level": 0, "parent": null, "vector": [8, 0, 0.7694, 0.0028, 0, 0.66, 0.6463, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "pl.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L279_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [279, 279], "level": 0, "parent": null, "vector": [14, 0, 0.775, 0.0028, 0, 0.66, 0.6531, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L280_C0", "label": "axes()", "type": "expression", "loc": [280, 280], "level": 0, "parent": null, "vector": [8, 0, 0.7778, 0.0028, 0, 0.66, 0.6599, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": "pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L281_C0", "label": "bar()", "type": "expression", "loc": [281, 281], "level": 0, "parent": null, "vector": [8, 0, 0.7806, 0.0028, 0, 0.66, 0.6667, 300, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "bar", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": "pl.bar( bins_r[:-1], magserr_mr, bins_r[1] - bins_r[0], color='r', yerr=magserr_sr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L282_C0", "label": "print()", "type": "expression", "loc": [282, 282], "level": 0, "parent": null, "vector": [8, 0, 0.7833, 0.0028, 0, 0.66, 0.6735, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Max RSSI (static):')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L283_C0", "label": "print()", "type": "expression", "loc": [283, 283], "level": 0, "parent": null, "vector": [8, 0, 0.7861, 0.0028, 0, 0.66, 0.6803, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\t', bins_r[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L284_C0", "label": "print()", "type": "expression", "loc": [284, 284], "level": 0, "parent": null, "vector": [8, 0, 0.7889, 0.0028, 0, 0.66, 0.6871, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\t', magserr_mr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L285_C0", "label": "print()", "type": "expression", "loc": [285, 285], "level": 0, "parent": null, "vector": [8, 0, 0.7917, 0.0028, 0, 0.66, 0.6939, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('\\t', magserr_sr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L286_C0", "label": "xlim()", "type": "expression", "loc": [286, 286], "level": 0, "parent": null, "vector": [8, 0, 0.7944, 0.0028, 0, 0.66, 0.7007, 907, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlim", "arg_names": [], "import_names": [], "rhs_call_name": "xlim", "annotation": ""}, "snippet": "pl.xlim( (69,105) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L287_C0", "label": "ylim()", "type": "expression", "loc": [287, 287], "level": 0, "parent": null, "vector": [8, 0, 0.7972, 0.0028, 0, 0.66, 0.7075, 247, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylim", "arg_names": [], "import_names": [], "rhs_call_name": "ylim", "annotation": ""}, "snippet": "pl.ylim( (-20.0,180) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L288_C0", "label": "xlabel()", "type": "expression", "loc": [288, 288], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.0028, 0, 0.66, 0.7143, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( r'Max $\\mathsf{E}[P(RSSI|\\tau)]$')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L289_C0", "label": "ylabel()", "type": "expression", "loc": [289, 289], "level": 0, "parent": null, "vector": [8, 0, 0.8028, 0.0028, 0, 0.66, 0.7211, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( '|Angular Error| (degrees)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L291_C0", "label": "savefig()", "type": "expression", "loc": [291, 291], "level": 0, "parent": null, "vector": [8, 0, 0.8083, 0.0028, 0, 0.66, 0.7279, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_magserr_vs_mrssi.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L292_C0", "label": "close()", "type": "expression", "loc": [292, 292], "level": 0, "parent": null, "vector": [8, 0, 0.8111, 0.0028, 0, 0.66, 0.7347, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "pl.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L297_C0", "label": "XBINS =", "type": "assigned_variable", "loc": [297, 297], "level": 0, "parent": null, "vector": [14, 0, 0.825, 0.0028, 0, 0.66, 0.7415, 821, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "XBINS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "XBINS = 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L298_C0", "label": "YBINS =", "type": "assigned_variable", "loc": [298, 298], "level": 0, "parent": null, "vector": [14, 0, 0.8278, 0.0028, 0, 0.66, 0.7483, 847, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "YBINS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "YBINS = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L299_C0", "label": "XMIN =", "type": "assigned_variable", "loc": [299, 299], "level": 0, "parent": null, "vector": [14, 0, 0.8306, 0.0028, 0, 0.66, 0.7551, 194, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "XMIN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "XMIN = 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L300_C0", "label": "XMAX =", "type": "assigned_variable", "loc": [300, 300], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.0028, 0, 0.66, 0.7619, 896, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "XMAX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "XMAX = 11.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L301_C0", "label": "YMIN =", "type": "assigned_variable", "loc": [301, 301], "level": 0, "parent": null, "vector": [14, 0, 0.8361, 0.0028, 0, 0.66, 0.7687, 287, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "YMIN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "YMIN = 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L302_C0", "label": "YMAX =", "type": "assigned_variable", "loc": [302, 302], "level": 0, "parent": null, "vector": [14, 0, 0.8389, 0.0028, 0, 0.66, 0.7755, 136, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "YMAX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "YMAX = 7.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L304_C0", "label": "xy = row_stack()", "type": "assigned_variable", "loc": [304, 305], "level": 0, "parent": null, "vector": [14, 0, 0.8458, 0.0056, 0, 0.66, 0.7823, 358, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "xy", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": "xy = np.row_stack([ npstats[0],\n npstats[1] ]) # xy as 2xN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L307_C0", "label": "H, xedges, yedges = histogram2d()", "type": "assigned_variable", "loc": [307, 310], "level": 0, "parent": null, "vector": [14, 0, 0.8569, 0.0111, 0, 0.66, 0.7891, 90, 3, 4, 0, 0, 666, 10, 1], "semantic": {"name": "H, xedges, yedges", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2d", "annotation": ""}, "snippet": "H,xedges,yedges = np.histogram2d( xy[0], xy[1],\n bins=(XBINS,YBINS),\n range=[[XMIN,XMAX],\n [YMIN,YMAX]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L311_C0", "label": "XS, YS = meshgrid()", "type": "assigned_variable", "loc": [311, 311], "level": 0, "parent": null, "vector": [14, 0, 0.8639, 0.0028, 0, 0.66, 0.7959, 47, 3, 2, 0, 0, 500, 10, 1], "semantic": {"name": "XS, YS", "arg_names": [], "import_names": [], "rhs_call_name": "meshgrid", "annotation": ""}, "snippet": "XS,YS = np.meshgrid( xedges, yedges )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L313_C0", "label": "bins_ind_x =", "type": "assigned_variable", "loc": [313, 313], "level": 0, "parent": null, "vector": [14, 0, 0.8694, 0.0028, 0, 0.66, 0.8027, 920, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bins_ind_x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "bins_ind_x = np.sum( xy[0][:,np.newaxis] > xedges[:-1], axis = 1 ) - 1 # Tells the index for each of the reads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L314_C0", "label": "bins_ind_y =", "type": "assigned_variable", "loc": [314, 314], "level": 0, "parent": null, "vector": [14, 0, 0.8722, 0.0028, 0, 0.66, 0.8095, 80, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bins_ind_y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "bins_ind_y = np.sum( xy[1][:,np.newaxis] > yedges[:-1], axis = 1 ) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L316_C0", "label": "get_mean", "type": "function", "loc": [316, 319], "level": 0, "parent": null, "vector": [2, 0, 0.8819, 0.0111, 0, 0.66, 0.8163, 840, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "get_mean", "arg_names": ["xi", "yi", "darr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_mean( xi, yi, darr ):\n # Which indices (into 3xN data) correspond to this x-bin and y-bin?\n data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )\n return np.mean( darr[ data_ind ]) * 180 / np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L318_C4", "label": "data_ind = intersect1d()", "type": "assigned_variable", "loc": [318, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L316_C0", "vector": [14, 1, 0.8833, 0.0028, 1, 0.08, 0.0, 477, 3, 2, 0, 0, 645, 10, 3], "semantic": {"name": "data_ind", "arg_names": [], "import_names": [], "rhs_call_name": "intersect1d", "annotation": ""}, "snippet": " data_ind = np.intersect1d( np.where( bins_ind_x == yi )[0], np.where( bins_ind_y == xi )[0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Return_L319_C4", "label": "return", "type": "return", "loc": [319, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L316_C0", "vector": [13, 1, 0.8861, 0.0028, 1, 0.08, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.mean( darr[ data_ind ]) * 180 / np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L324_C0", "label": "magherr_Z = array()", "type": "assigned_variable", "loc": [324, 324], "level": 0, "parent": null, "vector": [14, 0, 0.9, 0.0028, 0, 0.66, 0.8231, 962, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "magherr_Z", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "magherr_Z = np.ma.array( np.copy(H.T), mask=(H.T < 1) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L325_C0", "label": "magserr_Z = array()", "type": "assigned_variable", "loc": [325, 325], "level": 0, "parent": null, "vector": [14, 0, 0.9028, 0.0028, 0, 0.66, 0.8299, 179, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "magserr_Z", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "magserr_Z = np.ma.array( np.copy(H.T), mask=(H.T < 1) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L329_C0", "label": "for i", "type": "for", "loc": [329, 331], "level": 0, "parent": null, "vector": [6, 0, 0.9167, 0.0083, 0, 0.66, 0.8367, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i, (xi,yi) in enumerate( zip( *np.where( magherr_Z.mask == False ))):\n magherr_Z[xi,yi] = get_mean( xi, yi, magherr )\n magserr_Z[xi,yi] = get_mean( xi, yi, magserr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L330_C4", "label": " = get_mean()", "type": "assigned_variable", "loc": [330, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L329_C0", "vector": [14, 1, 0.9167, 0.0028, 1, 0.54, 0.0, 0, 3, 3, 0, 0, 840, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_mean", "annotation": ""}, "snippet": " magherr_Z[xi,yi] = get_mean( xi, yi, magherr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L331_C4", "label": " = get_mean()", "type": "assigned_variable", "loc": [331, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L329_C0", "vector": [14, 1, 0.9194, 0.0028, 1, 0.54, 1.0, 0, 3, 3, 0, 0, 840, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_mean", "annotation": ""}, "snippet": " magserr_Z[xi,yi] = get_mean( xi, yi, magserr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L335_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [335, 335], "level": 0, "parent": null, "vector": [14, 0, 0.9306, 0.0028, 0, 0.66, 0.8435, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L336_C0", "label": "hold()", "type": "expression", "loc": [336, 336], "level": 0, "parent": null, "vector": [8, 0, 0.9333, 0.0028, 0, 0.66, 0.8503, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": "pl.hold(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L337_C0", "label": "pcolor()", "type": "expression", "loc": [337, 337], "level": 0, "parent": null, "vector": [8, 0, 0.9361, 0.0028, 0, 0.66, 0.8571, 2, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pcolor", "arg_names": [], "import_names": [], "rhs_call_name": "pcolor", "annotation": ""}, "snippet": "pl.pcolor( XS, YS, magherr_Z, cmap=pl.cm.jet ) # or hot?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L338_C0", "label": "xlim()", "type": "expression", "loc": [338, 338], "level": 0, "parent": null, "vector": [8, 0, 0.9389, 0.0028, 0, 0.66, 0.8639, 907, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlim", "arg_names": [], "import_names": [], "rhs_call_name": "xlim", "annotation": ""}, "snippet": "pl.xlim( (-1,12) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L339_C0", "label": "ylim()", "type": "expression", "loc": [339, 339], "level": 0, "parent": null, "vector": [8, 0, 0.9417, 0.0028, 0, 0.66, 0.8707, 247, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylim", "arg_names": [], "import_names": [], "rhs_call_name": "ylim", "annotation": ""}, "snippet": "pl.ylim( (-1,8) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L340_C0", "label": "axis()", "type": "expression", "loc": [340, 340], "level": 0, "parent": null, "vector": [8, 0, 0.9444, 0.0028, 0, 0.66, 0.8776, 860, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axis", "arg_names": [], "import_names": [], "rhs_call_name": "axis", "annotation": ""}, "snippet": "pl.axis( 'equal' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L341_C0", "label": "clim()", "type": "expression", "loc": [341, 341], "level": 0, "parent": null, "vector": [8, 0, 0.9472, 0.0028, 0, 0.66, 0.8844, 841, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "clim", "arg_names": [], "import_names": [], "rhs_call_name": "clim", "annotation": ""}, "snippet": "pl.clim( 0.0, 180.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L342_C0", "label": "colorbar()", "type": "expression", "loc": [342, 342], "level": 0, "parent": null, "vector": [8, 0, 0.95, 0.0028, 0, 0.66, 0.8912, 915, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colorbar", "arg_names": [], "import_names": [], "rhs_call_name": "colorbar", "annotation": ""}, "snippet": "pl.colorbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L343_C0", "label": "xlabel()", "type": "expression", "loc": [343, 343], "level": 0, "parent": null, "vector": [8, 0, 0.9528, 0.0028, 0, 0.66, 0.898, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'X-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L344_C0", "label": "ylabel()", "type": "expression", "loc": [344, 344], "level": 0, "parent": null, "vector": [8, 0, 0.9556, 0.0028, 0, 0.66, 0.9048, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( 'Y-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L345_C0", "label": "savefig()", "type": "expression", "loc": [345, 345], "level": 0, "parent": null, "vector": [8, 0, 0.9583, 0.0028, 0, 0.66, 0.9116, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_magherr_contour.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L346_C0", "label": "close()", "type": "expression", "loc": [346, 346], "level": 0, "parent": null, "vector": [8, 0, 0.9611, 0.0028, 0, 0.66, 0.9184, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "pl.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L349_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [349, 349], "level": 0, "parent": null, "vector": [14, 0, 0.9694, 0.0028, 0, 0.66, 0.9252, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L350_C0", "label": "hold()", "type": "expression", "loc": [350, 350], "level": 0, "parent": null, "vector": [8, 0, 0.9722, 0.0028, 0, 0.66, 0.932, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": "pl.hold(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L351_C0", "label": "pcolor()", "type": "expression", "loc": [351, 351], "level": 0, "parent": null, "vector": [8, 0, 0.975, 0.0028, 0, 0.66, 0.9388, 2, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pcolor", "arg_names": [], "import_names": [], "rhs_call_name": "pcolor", "annotation": ""}, "snippet": "pl.pcolor( XS, YS, magserr_Z, cmap=pl.cm.jet ) # or hot?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L352_C0", "label": "xlim()", "type": "expression", "loc": [352, 352], "level": 0, "parent": null, "vector": [8, 0, 0.9778, 0.0028, 0, 0.66, 0.9456, 907, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlim", "arg_names": [], "import_names": [], "rhs_call_name": "xlim", "annotation": ""}, "snippet": "pl.xlim( (-1,12) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L353_C0", "label": "ylim()", "type": "expression", "loc": [353, 353], "level": 0, "parent": null, "vector": [8, 0, 0.9806, 0.0028, 0, 0.66, 0.9524, 247, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylim", "arg_names": [], "import_names": [], "rhs_call_name": "ylim", "annotation": ""}, "snippet": "pl.ylim( (-1,8) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L354_C0", "label": "axis()", "type": "expression", "loc": [354, 354], "level": 0, "parent": null, "vector": [8, 0, 0.9833, 0.0028, 0, 0.66, 0.9592, 860, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axis", "arg_names": [], "import_names": [], "rhs_call_name": "axis", "annotation": ""}, "snippet": "pl.axis( 'equal' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L355_C0", "label": "clim()", "type": "expression", "loc": [355, 355], "level": 0, "parent": null, "vector": [8, 0, 0.9861, 0.0028, 0, 0.66, 0.966, 841, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "clim", "arg_names": [], "import_names": [], "rhs_call_name": "clim", "annotation": ""}, "snippet": "pl.clim( 0.0, 180.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L356_C0", "label": "colorbar()", "type": "expression", "loc": [356, 356], "level": 0, "parent": null, "vector": [8, 0, 0.9889, 0.0028, 0, 0.66, 0.9728, 915, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colorbar", "arg_names": [], "import_names": [], "rhs_call_name": "colorbar", "annotation": ""}, "snippet": "pl.colorbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L357_C0", "label": "xlabel()", "type": "expression", "loc": [357, 357], "level": 0, "parent": null, "vector": [8, 0, 0.9917, 0.0028, 0, 0.66, 0.9796, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( 'X-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L358_C0", "label": "ylabel()", "type": "expression", "loc": [358, 358], "level": 0, "parent": null, "vector": [8, 0, 0.9944, 0.0028, 0, 0.66, 0.9864, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( 'Y-Coordinate (meters)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L359_C0", "label": "savefig()", "type": "expression", "loc": [359, 359], "level": 0, "parent": null, "vector": [8, 0, 0.9972, 0.0028, 0, 0.66, 0.9932, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_magserr_contour.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L360_C0", "label": "close()", "type": "expression", "loc": [360, 360], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0028, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "pl.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Return_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L151_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L166_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L167_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L168_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L178_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Expr_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Return_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L329_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99407:For_L329_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99407:Assign_L331_C4"}] |
import numpy as np, math
import numpy
import math
import sys
##
# Bound the value of a number to be above lower, and lower than upper
# @return a number
def bound(value, lower, upper):
raise RuntimeError('math_util.bound moved to hrl_lib.util')
#sys.exit()
# if lower >= upper:
# t = lower
# lower = upper
# upper = t
# #print 'bound', value, 'lower', lower, 'upper', upper
# #return min(max(value, lower), upper)
# return min(max(value, lower), upper)
def bound_mat(m, lower, upper):
if lower >= upper:
t = lower
lower = upper
upper = t
m = m.copy()
m[np.where(m > upper)] = upper
m[np.where(m < lower)] = lower
return m
def approx_equal(a, b, epsilon=.001):
return (b < (a+epsilon)) and ((a-epsilon) < b)
def approx_equalv(a, b, epsilon=.001):
return np.all(np.abs(a - b) < epsilon)
def radians(mat):
return mat * (np.pi/180.0)
def degrees(mat):
return mat * (180.0 / np.pi)
##################################################################
# Angles related functions
##################################################################
def vec_of_ang(a):
return numpy.matrix([numpy.cos(a), numpy.sin(a)]).T
def ang_of_vec(a):
a = a / numpy.linalg.norm(a)
return math.atan2(a[1,0], a[0,0])
def avg_ang(wa, a, wb, b):
"""
Calculates the average between two angles
wa weight of first angle
a first angle
wb weight of second angle
b second angle
"""
return ang_of_vec(wa * vec_of_ang(a) + wb * vec_of_ang(b))
def blend_ang(alpha, a, b):
return avg_ang(alpha, a, 1-alpha,b)
def standard_rad(t):
if t > 0:
return ((t + numpy.pi) % (numpy.pi * 2)) - numpy.pi
else:
return ((t - numpy.pi) % (numpy.pi * -2)) + numpy.pi
def best_turn_dir(reference, new_angle):
""" positive is left, negative is right! """
return standard_rad(reference - new_angle)
def cart_of_pol(p):
""" Finds cartesian coordinates of polar points [r, t]' """
r = p[0,:]
t = p[1,:]
x = numpy.multiply(numpy.cos(t), r)
y = numpy.multiply(numpy.sin(t), r)
return numpy.vstack((x,y))
def pol_of_cart(p):
""" Find polar coordinates of cartesian points [x, y]' """
norm = numpy.linalg.norm(p)
ang = math.atan2(p[1,0], p[0,0])
return numpy.matrix([norm, ang]).T
##################################################################
# NUMPY HELPER FUNCTIONS
##################################################################
##
# Find the maximal position in a 2D array
# @return (r,c)
def argmax2d(mat):
max_1d = np.argmax(mat)
row_length = float(mat.shape[1])
row_idx = np.floor(max_1d / row_length)
col_idx = max_1d % row_length
return row_idx, col_idx
##
# Changes the range of an numpy array to betwen [0, 255] from it's [min_value, max_value]
def renormalize(npimage_gray):
min_img = np.min(npimage_gray)
max_img = np.max(npimage_gray)
ret = np.matrix(np.round(((npimage_gray - min_img) / (max_img - min_img) * 255.0)), 'uint8')
return ret
def list_mat_to_mat(list_mat, axis=0):
return np.concatenate(tuple(list_mat), axis=axis)
def list_of_mat(mat):
for i in range(mat.shape[1]):
yield mat[:,i]
def nearest(mat, target):
'''
Return a sorted list of the nearest (euclidean dist) element
of a matrix to a target value and their indeices.
@param mat mxn
@param target mx1
'''
#mat = mat.T
#target = target.T
#import util as ut
#import pdb
#ut.save_pickle(mat, 'mat.pkl')
#ut.save_pickle(target, 'target.pkl')
diff_vec = mat - target
pwr = np.ones_like(mat[0])*2
dist = np.power(np.sum(np.power(diff_vec, pwr),axis=0),0.5)
indices = dist.argsort(axis=1)
#want indices from sort order
#indices = np.concatenate((np.matrix(range(sort_order.shape[1])), sort_order), 0)[:, sort_order.A1]
#print sort_order
#print indices
#pdb.set_trace()
return mat[:, indices.A1], indices
if __name__ == '__main__':
import hrl_lib.util as ut
import pdb
mat = ut.load_pickle('mat.pkl')
target = ut.load_pickle('target.pkl')
diff_vec = mat - target
pwr = np.ones_like(mat[0])*2
dist = np.power(np.sum(np.power(diff_vec, pwr),axis=0),0.5)
sort_order = dist.argsort(axis=1)
#want indices from sort order
indices = np.concatenate((np.matrix(range(sort_order.shape[1])), sort_order), 0)[:, sort_order.A1]
print sort_order
print indices
pdb.set_trace()
#def nearest(mat, target):
# '''
# Return a sorted list of the nearest (euclidean dist) element
# of a matrix to a target value and their indeices.
# '''
# mat = mat.T
# target = target.T
# diff_vec = mat - target
# pwr = np.ones_like(mat[0])*2
# dist = np.power(np.sum(np.power(diff_vec ,pwr),axis=1),0.5)
# indices = dist.argsort(axis=0)
# return mat[indices.A1], indices
##################################################################
# MISCELLANEOUS MATH HELPER FUNCTIONS
##################################################################
def blend(alpha, a, b):
return (alpha * a) + ((1-alpha) * b)
def approx_equal(a, b, epsilon=.001):
return (b < (a+epsilon)) and ((a-epsilon) < b)
def norm(mat):
"""
Calculate L2 norm for column vectors in a matrix
"""
return np.power(np.sum(np.power(mat,2), axis=0), 0.5)
def rnd(v):
return int(round(v))
def point_to_homo(p):
""" Convert points into homogeneous coordinates """
o = numpy.matrix(numpy.ones((1, p.shape[1])))
return numpy.vstack((p,o))
""" Convert points back from homogeneous coordinates """
def homo_to_point(p):
return p[0:p.shape[0]-1,:]
| ajibawa-2023/Python-Code-Large/train/row_99408 | 103 | 204 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Import_L1_C0", "label": "numpy import np, math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Import_L2_C0", "label": "numpy import numpy", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0049, 0, 0.66, 0.0345, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["numpy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Import_L3_C0", "label": "math import math", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0147, 0.0049, 0, 0.66, 0.069, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0245, 0.0049, 0, 0.66, 0.1034, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L10_C0", "label": "bound", "type": "function", "loc": [10, 11], "level": 0, "parent": null, "vector": [2, 0, 0.0515, 0.0098, 0, 0.66, 0.1379, 996, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "bound", "arg_names": ["value", "lower", "upper"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bound(value, lower, upper):\n raise RuntimeError('math_util.bound moved to hrl_lib.util')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "label": "bound_mat", "type": "function", "loc": [21, 30], "level": 0, "parent": null, "vector": [2, 0, 0.125, 0.049, 0, 0.66, 0.1724, 563, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "bound_mat", "arg_names": ["m", "lower", "upper"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bound_mat(m, lower, upper):\n if lower >= upper:\n t = lower\n lower = upper\n upper = t\n\n m = m.copy()\n m[np.where(m > upper)] = upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L22_C4", "label": "if", "type": "if", "loc": [22, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "vector": [4, 1, 0.1152, 0.0196, 1, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lower >= upper:\n t = lower\n lower = upper\n upper = t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L23_C8", "label": "t =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L22_C4", "vector": [14, 2, 0.1127, 0.0049, 2, 0.1, 0.0, 15, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = lower"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L24_C8", "label": "lower =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L22_C4", "vector": [14, 2, 0.1176, 0.0049, 2, 0.1, 0.5, 432, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lower = upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L25_C8", "label": "upper =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L22_C4", "vector": [14, 2, 0.1225, 0.0049, 2, 0.1, 1.0, 347, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upper = t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L27_C4", "label": "m = copy()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "vector": [14, 1, 0.1324, 0.0049, 1, 0.93, 0.25, 711, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " m = m.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L28_C4", "label": "assign", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "vector": [14, 1, 0.1373, 0.0049, 1, 0.93, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m[np.where(m > upper)] = upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L29_C4", "label": "assign", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "vector": [14, 1, 0.1422, 0.0049, 1, 0.93, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m[np.where(m < lower)] = lower"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L30_C4", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "vector": [13, 1, 0.1471, 0.0049, 1, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L32_C0", "label": "approx_equal", "type": "function", "loc": [32, 33], "level": 0, "parent": null, "vector": [2, 0, 0.1593, 0.0098, 0, 0.66, 0.2069, 662, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "approx_equal", "arg_names": ["a", "b", "epsilon"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def approx_equal(a, b, epsilon=.001):\n return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L33_C4", "label": "return", "type": "return", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L32_C0", "vector": [13, 1, 0.1618, 0.0049, 1, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L35_C0", "label": "approx_equalv", "type": "function", "loc": [35, 36], "level": 0, "parent": null, "vector": [2, 0, 0.174, 0.0098, 0, 0.66, 0.2414, 240, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "approx_equalv", "arg_names": ["a", "b", "epsilon"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def approx_equalv(a, b, epsilon=.001):\n return np.all(np.abs(a - b) < epsilon)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L36_C4", "label": "return", "type": "return", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L35_C0", "vector": [13, 1, 0.1765, 0.0049, 1, 0.69, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.all(np.abs(a - b) < epsilon)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L38_C0", "label": "radians", "type": "function", "loc": [38, 39], "level": 0, "parent": null, "vector": [2, 0, 0.1887, 0.0098, 0, 0.66, 0.2759, 383, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "radians", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def radians(mat):\n return mat * (np.pi/180.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L38_C0", "vector": [13, 1, 0.1912, 0.0049, 1, 0.56, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mat * (np.pi/180.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L41_C0", "label": "degrees", "type": "function", "loc": [41, 42], "level": 0, "parent": null, "vector": [2, 0, 0.2034, 0.0098, 0, 0.66, 0.3103, 633, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "degrees", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def degrees(mat):\n return mat * (180.0 / np.pi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L42_C4", "label": "return", "type": "return", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L41_C0", "vector": [13, 1, 0.2059, 0.0049, 1, 0.76, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mat * (180.0 / np.pi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L47_C0", "label": "vec_of_ang", "type": "function", "loc": [47, 48], "level": 0, "parent": null, "vector": [2, 0, 0.2328, 0.0098, 0, 0.66, 0.3448, 956, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "vec_of_ang", "arg_names": ["a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def vec_of_ang(a):\n return numpy.matrix([numpy.cos(a), numpy.sin(a)]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L48_C4", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L47_C0", "vector": [13, 1, 0.2353, 0.0049, 1, 0.15, 0.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.matrix([numpy.cos(a), numpy.sin(a)]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L50_C0", "label": "ang_of_vec", "type": "function", "loc": [50, 52], "level": 0, "parent": null, "vector": [2, 0, 0.25, 0.0147, 0, 0.66, 0.3793, 45, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "ang_of_vec", "arg_names": ["a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ang_of_vec(a):\n a = a / numpy.linalg.norm(a)\n return math.atan2(a[1,0], a[0,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L51_C4", "label": "a =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L50_C0", "vector": [14, 1, 0.25, 0.0049, 1, 0.83, 0.0, 475, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = a / numpy.linalg.norm(a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L50_C0", "vector": [13, 1, 0.2549, 0.0049, 1, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return math.atan2(a[1,0], a[0,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L54_C0", "label": "avg_ang", "type": "function", "loc": [54, 62], "level": 0, "parent": null, "vector": [2, 0, 0.2843, 0.0441, 0, 0.66, 0.4138, 151, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "avg_ang", "arg_names": ["wa", "a", "wb", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def avg_ang(wa, a, wb, b):\n \"\"\"\n Calculates the average between two angles\n wa weight of first angle\n a first angle\n wb weight of second angle\n b second angle\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L55_C4", "label": "expression", "type": "expression", "loc": [55, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L54_C0", "vector": [8, 1, 0.2843, 0.0343, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Calculates the average between two angles\n wa weight of first angle\n a first angle\n wb weight of second angle\n b second angle\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L62_C4", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L54_C0", "vector": [13, 1, 0.3039, 0.0049, 1, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ang_of_vec(wa * vec_of_ang(a) + wb * vec_of_ang(b))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L64_C0", "label": "blend_ang", "type": "function", "loc": [64, 65], "level": 0, "parent": null, "vector": [2, 0, 0.3162, 0.0098, 0, 0.66, 0.4483, 550, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "blend_ang", "arg_names": ["alpha", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def blend_ang(alpha, a, b):\n return avg_ang(alpha, a, 1-alpha,b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L64_C0", "vector": [13, 1, 0.3186, 0.0049, 1, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return avg_ang(alpha, a, 1-alpha,b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L67_C0", "label": "standard_rad", "type": "function", "loc": [67, 71], "level": 0, "parent": null, "vector": [2, 0, 0.3382, 0.0245, 0, 0.66, 0.4828, 54, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "standard_rad", "arg_names": ["t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def standard_rad(t):\n if t > 0:\n return ((t + numpy.pi) % (numpy.pi * 2)) - numpy.pi\n else:\n return ((t - numpy.pi) % (numpy.pi * -2)) + numpy.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L68_C4", "label": "if", "type": "if", "loc": [68, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L67_C0", "vector": [4, 1, 0.3407, 0.0196, 1, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t > 0:\n return ((t + numpy.pi) % (numpy.pi * 2)) - numpy.pi\n else:\n return ((t - numpy.pi) % (numpy.pi * -2)) + numpy.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L69_C8", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L68_C4", "vector": [13, 2, 0.3382, 0.0049, 2, 0.93, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t + numpy.pi) % (numpy.pi * 2)) - numpy.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L71_C8", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L68_C4", "vector": [13, 2, 0.348, 0.0049, 2, 0.93, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t - numpy.pi) % (numpy.pi * -2)) + numpy.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L73_C0", "label": "best_turn_dir", "type": "function", "loc": [73, 75], "level": 0, "parent": null, "vector": [2, 0, 0.3627, 0.0147, 0, 0.66, 0.5172, 327, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "best_turn_dir", "arg_names": ["reference", "new_angle"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def best_turn_dir(reference, new_angle):\n \"\"\" positive is left, negative is right! \"\"\"\n return standard_rad(reference - new_angle)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L74_C4", "label": "expression", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L73_C0", "vector": [8, 1, 0.3627, 0.0049, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" positive is left, negative is right! \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L75_C4", "label": "return", "type": "return", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L73_C0", "vector": [13, 1, 0.3676, 0.0049, 1, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return standard_rad(reference - new_angle)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "label": "cart_of_pol", "type": "function", "loc": [77, 83], "level": 0, "parent": null, "vector": [2, 0, 0.3922, 0.0343, 0, 0.66, 0.5517, 212, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "cart_of_pol", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cart_of_pol(p):\n \"\"\" Finds cartesian coordinates of polar points [r, t]' \"\"\"\n r = p[0,:]\n t = p[1,:]\n x = numpy.multiply(numpy.cos(t), r)\n y = numpy.multiply(numpy.sin(t), r)\n return numpy.vstack((x,y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L78_C3", "label": "expression", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "vector": [8, 1, 0.3824, 0.0049, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Finds cartesian coordinates of polar points [r, t]' \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L79_C3", "label": "r =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "vector": [14, 1, 0.3873, 0.0049, 1, 0.09, 0.2, 436, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = p[0,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L80_C3", "label": "t =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "vector": [14, 1, 0.3922, 0.0049, 1, 0.09, 0.4, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = p[1,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L81_C3", "label": "x = multiply()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "vector": [14, 1, 0.3971, 0.0049, 1, 0.09, 0.6, 190, 3, 2, 0, 0, 960, 10, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " x = numpy.multiply(numpy.cos(t), r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L82_C3", "label": "y = multiply()", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "vector": [14, 1, 0.402, 0.0049, 1, 0.09, 0.8, 304, 3, 2, 0, 0, 960, 10, 2], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " y = numpy.multiply(numpy.sin(t), r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L83_C3", "label": "return", "type": "return", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "vector": [13, 1, 0.4069, 0.0049, 1, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.vstack((x,y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "label": "pol_of_cart", "type": "function", "loc": [85, 89], "level": 0, "parent": null, "vector": [2, 0, 0.4265, 0.0245, 0, 0.66, 0.5862, 754, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "pol_of_cart", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pol_of_cart(p):\n \"\"\" Find polar coordinates of cartesian points [x, y]' \"\"\"\n norm = numpy.linalg.norm(p)\n ang = math.atan2(p[1,0], p[0,0])\n return numpy.matrix([norm, ang]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L86_C4", "label": "expression", "type": "expression", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "vector": [8, 1, 0.4216, 0.0049, 1, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Find polar coordinates of cartesian points [x, y]' \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L87_C4", "label": "norm = norm()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "vector": [14, 1, 0.4265, 0.0049, 1, 0.89, 0.3333, 902, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "norm", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " norm = numpy.linalg.norm(p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L88_C4", "label": "ang = atan2()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "vector": [14, 1, 0.4314, 0.0049, 1, 0.89, 0.6667, 762, 3, 2, 0, 0, 572, 10, 1], "semantic": {"name": "ang", "arg_names": [], "import_names": [], "rhs_call_name": "atan2", "annotation": ""}, "snippet": " ang = math.atan2(p[1,0], p[0,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L89_C4", "label": "return", "type": "return", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "vector": [13, 1, 0.4363, 0.0049, 1, 0.89, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.matrix([norm, ang]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "label": "argmax2d", "type": "function", "loc": [98, 103], "level": 0, "parent": null, "vector": [2, 0, 0.4926, 0.0294, 0, 0.66, 0.6207, 204, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "argmax2d", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def argmax2d(mat):\n max_1d = np.argmax(mat)\n row_length = float(mat.shape[1])\n row_idx = np.floor(max_1d / row_length)\n col_idx = max_1d % row_length\n return row_idx, col_idx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L99_C4", "label": "max_1d = argmax()", "type": "assigned_variable", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "vector": [14, 1, 0.4853, 0.0049, 1, 0.41, 0.0, 496, 3, 1, 0, 0, 593, 10, 1], "semantic": {"name": "max_1d", "arg_names": [], "import_names": [], "rhs_call_name": "argmax", "annotation": ""}, "snippet": " max_1d = np.argmax(mat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L100_C4", "label": "row_length = float()", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "vector": [14, 1, 0.4902, 0.0049, 1, 0.41, 0.25, 697, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "row_length", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " row_length = float(mat.shape[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L101_C4", "label": "row_idx = floor()", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "vector": [14, 1, 0.4951, 0.0049, 1, 0.41, 0.5, 551, 3, 1, 0, 0, 956, 10, 1], "semantic": {"name": "row_idx", "arg_names": [], "import_names": [], "rhs_call_name": "floor", "annotation": ""}, "snippet": " row_idx = np.floor(max_1d / row_length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L102_C4", "label": "col_idx =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "vector": [14, 1, 0.5, 0.0049, 1, 0.41, 0.75, 946, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "col_idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " col_idx = max_1d % row_length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L103_C4", "label": "return", "type": "return", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "vector": [13, 1, 0.5049, 0.0049, 1, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return row_idx, col_idx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "label": "renormalize", "type": "function", "loc": [107, 111], "level": 0, "parent": null, "vector": [2, 0, 0.5343, 0.0245, 0, 0.66, 0.6552, 885, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "renormalize", "arg_names": ["npimage_gray"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def renormalize(npimage_gray):\n min_img = np.min(npimage_gray)\n max_img = np.max(npimage_gray)\n ret = np.matrix(np.round(((npimage_gray - min_img) / (max_img - min_img) * 255.0)), 'uint8')\n return ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L108_C4", "label": "min_img = min()", "type": "assigned_variable", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "vector": [14, 1, 0.5294, 0.0049, 1, 0.24, 0.0, 110, 3, 1, 0, 0, 867, 10, 1], "semantic": {"name": "min_img", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " min_img = np.min(npimage_gray)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L109_C4", "label": "max_img = max()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "vector": [14, 1, 0.5343, 0.0049, 1, 0.24, 0.3333, 728, 3, 1, 0, 0, 442, 10, 1], "semantic": {"name": "max_img", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " max_img = np.max(npimage_gray)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L110_C4", "label": "ret = matrix()", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "vector": [14, 1, 0.5392, 0.0049, 1, 0.24, 0.6667, 501, 3, 2, 0, 0, 162, 10, 2], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " ret = np.matrix(np.round(((npimage_gray - min_img) / (max_img - min_img) * 255.0)), 'uint8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L111_C4", "label": "return", "type": "return", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "vector": [13, 1, 0.5441, 0.0049, 1, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L113_C0", "label": "list_mat_to_mat", "type": "function", "loc": [113, 114], "level": 0, "parent": null, "vector": [2, 0, 0.5564, 0.0098, 0, 0.66, 0.6897, 162, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "list_mat_to_mat", "arg_names": ["list_mat", "axis"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def list_mat_to_mat(list_mat, axis=0):\n return np.concatenate(tuple(list_mat), axis=axis)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L114_C4", "label": "return", "type": "return", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L113_C0", "vector": [13, 1, 0.5588, 0.0049, 1, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.concatenate(tuple(list_mat), axis=axis)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L116_C0", "label": "list_of_mat", "type": "function", "loc": [116, 118], "level": 0, "parent": null, "vector": [2, 0, 0.5735, 0.0147, 0, 0.66, 0.7241, 941, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "list_of_mat", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def list_of_mat(mat):\n for i in range(mat.shape[1]):\n yield mat[:,i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:For_L117_C4", "label": "for i", "type": "for", "loc": [117, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L116_C0", "vector": [6, 1, 0.576, 0.0098, 1, 0.86, 0.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(mat.shape[1]):\n yield mat[:,i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L118_C8", "label": "expression", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:For_L117_C4", "vector": [8, 2, 0.5784, 0.0049, 2, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield mat[:,i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "label": "nearest", "type": "function", "loc": [120, 145], "level": 0, "parent": null, "vector": [2, 0, 0.6495, 0.1275, 0, 0.66, 0.7586, 105, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "nearest", "arg_names": ["mat", "target"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def nearest(mat, target):\n '''\n Return a sorted list of the nearest (euclidean dist) element\n of a matrix to a target value and their indeices.\n @param mat mxn\n @param target mx1\n '''\n #mat = mat.T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L121_C4", "label": "expression", "type": "expression", "loc": [121, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "vector": [8, 1, 0.6054, 0.0294, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Return a sorted list of the nearest (euclidean dist) element\n of a matrix to a target value and their indeices.\n @param mat mxn\n @param target mx1\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L134_C4", "label": "diff_vec =", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "vector": [14, 1, 0.6569, 0.0049, 1, 0.2, 0.2, 436, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "diff_vec", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diff_vec = mat - target"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L135_C4", "label": "pwr =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "vector": [14, 1, 0.6618, 0.0049, 1, 0.2, 0.4, 264, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pwr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pwr = np.ones_like(mat[0])*2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L136_C4", "label": "dist = power()", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "vector": [14, 1, 0.6667, 0.0049, 1, 0.2, 0.6, 673, 3, 2, 0, 0, 632, 10, 3], "semantic": {"name": "dist", "arg_names": [], "import_names": [], "rhs_call_name": "power", "annotation": ""}, "snippet": " dist = np.power(np.sum(np.power(diff_vec, pwr),axis=0),0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L137_C4", "label": "indices = argsort()", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "vector": [14, 1, 0.6716, 0.0049, 1, 0.2, 0.8, 478, 3, 1, 0, 0, 237, 10, 1], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "argsort", "annotation": ""}, "snippet": " indices = dist.argsort(axis=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L145_C4", "label": "return", "type": "return", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "vector": [13, 1, 0.7108, 0.0049, 1, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mat[:, indices.A1], indices"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "label": "if", "type": "if", "loc": [147, 163], "level": 0, "parent": null, "vector": [4, 0, 0.7598, 0.0833, 0, 0.66, 0.7931, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import hrl_lib.util as ut\n import pdb\n mat = ut.load_pickle('mat.pkl')\n target = ut.load_pickle('target.pkl')\n\n diff_vec = mat - target\n pwr = np.ones_like(mat[0])*2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Import_L148_C4", "label": "hrl_lib.util import ut", "type": "import", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [1, 1, 0.7255, 0.0049, 1, 0.74, 0.0, 775, 0, 1, 0, 0, 775, 0, 0], "semantic": {"name": "hrl_lib.util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hrl_lib.util as ut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Import_L149_C4", "label": "pdb import pdb", "type": "import", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [1, 1, 0.7304, 0.0049, 1, 0.74, 0.0909, 91, 0, 1, 0, 0, 91, 0, 0], "semantic": {"name": "pdb", "arg_names": [], "import_names": ["pdb"], "rhs_call_name": "", "annotation": ""}, "snippet": " import pdb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L150_C4", "label": "mat = load_pickle()", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [14, 1, 0.7353, 0.0049, 1, 0.74, 0.1818, 882, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "mat", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " mat = ut.load_pickle('mat.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L151_C4", "label": "target = load_pickle()", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [14, 1, 0.7402, 0.0049, 1, 0.74, 0.2727, 766, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " target = ut.load_pickle('target.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L153_C4", "label": "diff_vec =", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [14, 1, 0.75, 0.0049, 1, 0.74, 0.3636, 436, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "diff_vec", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diff_vec = mat - target"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L154_C4", "label": "pwr =", "type": "assigned_variable", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [14, 1, 0.7549, 0.0049, 1, 0.74, 0.4545, 264, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pwr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pwr = np.ones_like(mat[0])*2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L155_C4", "label": "dist = power()", "type": "assigned_variable", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [14, 1, 0.7598, 0.0049, 1, 0.74, 0.5455, 673, 3, 2, 0, 0, 632, 10, 3], "semantic": {"name": "dist", "arg_names": [], "import_names": [], "rhs_call_name": "power", "annotation": ""}, "snippet": " dist = np.power(np.sum(np.power(diff_vec, pwr),axis=0),0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L156_C4", "label": "sort_order = argsort()", "type": "assigned_variable", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [14, 1, 0.7647, 0.0049, 1, 0.74, 0.6364, 116, 3, 1, 0, 0, 237, 10, 1], "semantic": {"name": "sort_order", "arg_names": [], "import_names": [], "rhs_call_name": "argsort", "annotation": ""}, "snippet": " sort_order = dist.argsort(axis=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L159_C4", "label": "indices =", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [14, 1, 0.7794, 0.0049, 1, 0.74, 0.7273, 478, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " indices = np.concatenate((np.matrix(range(sort_order.shape[1])), sort_order), 0)[:, sort_order.A1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L161_C4", "label": "print()", "type": "expression", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [8, 1, 0.7892, 0.0049, 1, 0.74, 0.8182, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(sort_order)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L162_C4", "label": "print()", "type": "expression", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [8, 1, 0.7941, 0.0049, 1, 0.74, 0.9091, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(indices)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L163_C4", "label": "set_trace()", "type": "expression", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "vector": [8, 1, 0.799, 0.0049, 1, 0.74, 1.0, 796, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "set_trace", "arg_names": [], "import_names": [], "rhs_call_name": "set_trace", "annotation": ""}, "snippet": " pdb.set_trace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L182_C0", "label": "blend", "type": "function", "loc": [182, 183], "level": 0, "parent": null, "vector": [2, 0, 0.8946, 0.0098, 0, 0.66, 0.8276, 240, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "blend", "arg_names": ["alpha", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def blend(alpha, a, b):\n return (alpha * a) + ((1-alpha) * b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L183_C4", "label": "return", "type": "return", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L182_C0", "vector": [13, 1, 0.8971, 0.0049, 1, 0.82, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (alpha * a) + ((1-alpha) * b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L185_C0", "label": "approx_equal", "type": "function", "loc": [185, 186], "level": 0, "parent": null, "vector": [2, 0, 0.9093, 0.0098, 0, 0.66, 0.8621, 662, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "approx_equal", "arg_names": ["a", "b", "epsilon"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def approx_equal(a, b, epsilon=.001):\n return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L186_C4", "label": "return", "type": "return", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L185_C0", "vector": [13, 1, 0.9118, 0.0049, 1, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L188_C0", "label": "norm", "type": "function", "loc": [188, 192], "level": 0, "parent": null, "vector": [2, 0, 0.9314, 0.0245, 0, 0.66, 0.8966, 902, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "norm", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def norm(mat):\n \"\"\"\n Calculate L2 norm for column vectors in a matrix\n \"\"\"\n return np.power(np.sum(np.power(mat,2), axis=0), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L189_C4", "label": "expression", "type": "expression", "loc": [189, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L188_C0", "vector": [8, 1, 0.9314, 0.0147, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Calculate L2 norm for column vectors in a matrix\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L192_C4", "label": "return", "type": "return", "loc": [192, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L188_C0", "vector": [13, 1, 0.9412, 0.0049, 1, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.power(np.sum(np.power(mat,2), axis=0), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L194_C0", "label": "rnd", "type": "function", "loc": [194, 195], "level": 0, "parent": null, "vector": [2, 0, 0.9534, 0.0098, 0, 0.66, 0.931, 203, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "rnd", "arg_names": ["v"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def rnd(v):\n return int(round(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L195_C4", "label": "return", "type": "return", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L194_C0", "vector": [13, 1, 0.9559, 0.0049, 1, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(round(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "label": "point_to_homo", "type": "function", "loc": [197, 202], "level": 0, "parent": null, "vector": [2, 0, 0.9779, 0.0294, 0, 0.66, 0.9655, 116, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "point_to_homo", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def point_to_homo(p):\n \"\"\" Convert points into homogeneous coordinates \"\"\"\n o = numpy.matrix(numpy.ones((1, p.shape[1])))\n return numpy.vstack((p,o))\n\n \"\"\" Convert points back from homogeneous coordinates \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L198_C4", "label": "expression", "type": "expression", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "vector": [8, 1, 0.9706, 0.0049, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Convert points into homogeneous coordinates \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L199_C4", "label": "o = matrix()", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "vector": [14, 1, 0.9755, 0.0049, 1, 0.78, 0.3333, 926, 3, 1, 0, 0, 162, 10, 2], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " o = numpy.matrix(numpy.ones((1, p.shape[1])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L200_C4", "label": "return", "type": "return", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "vector": [13, 1, 0.9804, 0.0049, 1, 0.78, 0.6667, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.vstack((p,o))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L202_C4", "label": "expression", "type": "expression", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "vector": [8, 1, 0.9902, 0.0049, 1, 0.78, 1.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Convert points back from homogeneous coordinates \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L203_C0", "label": "homo_to_point", "type": "function", "loc": [203, 204], "level": 0, "parent": null, "vector": [2, 0, 0.9975, 0.0098, 0, 0.66, 1.0, 897, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "homo_to_point", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def homo_to_point(p):\n return p[0:p.shape[0]-1,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L204_C4", "label": "return", "type": "return", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L203_C0", "vector": [13, 1, 1.0, 0.0049, 1, 0.59, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return p[0:p.shape[0]-1,:]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L78_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L79_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L80_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L81_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L82_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L83_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:For_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:For_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Import_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Import_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:If_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Assign_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99408:FunctionDef_L203_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99408:Return_L204_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('move_base_msgs')
roslib.load_manifest('pr2_controllers_msgs')
roslib.load_manifest('rfid_hardware')
import rospy
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
from move_base_msgs.msg import MoveBaseAction
from pr2_controllers_msgs.msg import PointHeadAction, PointHeadGoal
from rfid_datacapture.srv import BagCapture, BagCaptureRequest
from hrl_rfid.srv import RfidSrv
import rfid_datacapture.utils as rdut
import numpy as np, math
class RfidStart(smach.State):
def __init__(self, srv_path ):
smach.State.__init__(self,
outcomes=['succeeded', 'aborted'],
input_keys = ['tagid'])
self.srv_path = srv_path
self.init = False
def execute(self, userdata):
if not self.init:
rospy.wait_for_service( self.srv_path )
self.srv = rospy.ServiceProxy( self.srv_path, RfidSrv )
self.init = True
rv = self.srv([ 'track', userdata.tagid ])
if rv:
return 'succeeded'
else:
return 'aborted' # done!
class RfidStop(smach.State):
def __init__(self, srv_path ):
smach.State.__init__(self, outcomes=['succeeded', 'aborted'])
self.srv_path = srv_path
self.init = False
def execute(self, userdata):
if not self.init:
rospy.wait_for_service( self.srv_path )
self.srv = rospy.ServiceProxy( self.srv_path, RfidSrv )
self.init = True
rv = self.srv([ 'stop' ])
if rv:
return 'succeeded'
else:
return 'aborted' # done!
def sm_cap_360( yaml_fname ):
# Create a SMACH state machine
sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'],
input_keys = ['track_mode'])
# Open the container
with sm:
# Lots of head moving -- abstract into function
def PointAdd( x, y, z, dur, state, res ):
pgoal = PointHeadGoal()
pgoal.target.header.frame_id = '/torso_lift_link'
pgoal.target.point.x = x
pgoal.target.point.y = y
pgoal.target.point.z = z
pgoal.min_duration = rospy.Duration( dur )
pgoal.max_velocity = 1.0
smach.StateMachine.add(
state,
SimpleActionState( '/head_traj_controller/point_head_action',
PointHeadAction,
goal = pgoal ),
transitions = { 'succeeded' : res })
return
PointAdd( 1.0, 0.0, 0.35, 5.0, 'INIT_HEAD', 'CAP_START' ) # Go to safe initial conditions
PointAdd( -1.0, -0.25, 0.35, 7.0, 'CAP_START', 'CAPTURE_POSITIONS' ) # Prepare for lots of "neck craning"
smach.StateMachine.add(
'CAPTURE_POSITIONS',
rdut.YAMLprocPoses( yaml_fname ),
remapping = {'next_move_pose':'next_move_pose'}, # output
transitions = {'aborted':'succeeded',
'succeeded':'READY_MOVE'})
smach.StateMachine.add(
'READY_MOVE',
rdut.MoveNotify(),
transitions = {'succeeded':'MOVE_POSITION'})
smach.StateMachine.add(
'MOVE_POSITION',
SimpleActionState( '/move_base',
MoveBaseAction,
goal_slots = [ 'target_pose' ]),
remapping = { 'target_pose' : 'next_move_pose' }, # input
transitions = {'aborted':'MANUAL_SKIP',
'preempted':'aborted',
'succeeded':'CAPTURE_TAGS'})
smach.StateMachine.add(
'MANUAL_SKIP',
rdut.ManualSkip(),
transitions = {'succeeded':'CAPTURE_TAGS', # We already manually positioned the robot
'aborted':'CAPTURE_POSITIONS'}) # skip this position and go to next
# This isn't realy necessary, but it provides a nice way to reuse code.
smach.StateMachine.add(
'CAPTURE_TAGS',
rdut.YAMLprocMultitag( yaml_fname ),
remapping = {'bagfile_name':'bagfile_name', # output
'bagfile_topics':'bagfile_topics', # output
'panrate':'panrate',
'tagid':'tagid',
'tilt_left':'tilt_left',
'tilt_right':'tilt_right',
'tilt_rate':'tilt_rate',
'tilt_block':'tilt_block'}, # output
transitions = {'aborted':'CAPTURE_POSITIONS', # move to next location
'succeeded':'START_BAG_CAPTURE'}) # capture bag
smach.StateMachine.add(
'START_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request_slots = ['topics','dest'] ),
remapping = {'topics':'bagfile_topics',
'dest':'bagfile_name'},
transitions = {'succeeded':'RFID_START'})
# Initialize RFID reader!
# rosservice call /rfid/head_mode -- ['track','OrangeMedBot']
# Am having issues with service states with request_cb, so just making my own....
smach.StateMachine.add(
'RFID_START',
RfidStart( '/rfid/head_mode' ),
remapping = {'tagid':'tagid'},
transitions = {'succeeded':'LOOK_LEFT'})
PointAdd( -1.0, 0.25, 0.35, 27.0, 'LOOK_LEFT', 'RFID_STOP' )
smach.StateMachine.add(
'RFID_STOP',
RfidStop( '/rfid/head_mode' ),
transitions = {'succeeded':'STOP_BAG_CAPTURE'})
smach.StateMachine.add(
'STOP_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request = BagCaptureRequest('','') ),
transitions = {'succeeded':'LOOK_RIGHT'})
PointAdd( -1.0, -0.25, 0.35, 8.0, 'LOOK_RIGHT', 'CAPTURE_TAGS' )
return sm
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--yaml', action='store', type='string', dest='yaml',
help='Capture description yaml file', default='')
opt, args = p.parse_args()
if opt.yaml == '':
print 'ERROR: Must specify YAML file.'
exit()
rospy.init_node('rfid_head_capture')
sm = sm_cap_360( opt.yaml )
sm.userdata.track_mode = 'track'
outcome = sm.execute()
| ajibawa-2023/Python-Code-Large/train/row_99409 | 81 | 191 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0105, 0.0052, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0157, 0.0052, 0, 0.66, 0.0556, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0209, 0.0052, 0, 0.66, 0.1111, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('move_base_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0262, 0.0052, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('pr2_controllers_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0314, 0.0052, 0, 0.66, 0.2222, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_hardware')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Import_L7_C0", "label": "rospy import rospy", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0366, 0.0052, 0, 0.66, 0.2778, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Import_L9_C0", "label": "smach import smach", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0471, 0.0052, 0, 0.66, 0.3333, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:ImportFrom_L10_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0524, 0.0052, 0, 0.66, 0.3889, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Import_L11_C0", "label": "actionlib import actionlib", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0576, 0.0052, 0, 0.66, 0.4444, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:ImportFrom_L13_C0", "label": "from move_base_msgs.msg import MoveBaseAction", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0681, 0.0052, 0, 0.66, 0.5, 440, 0, 1, 0, 0, 440, 0, 0], "semantic": {"name": "move_base_msgs.msg", "arg_names": [], "import_names": ["MoveBaseAction"], "rhs_call_name": "", "annotation": ""}, "snippet": "from move_base_msgs.msg import MoveBaseAction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:ImportFrom_L14_C0", "label": "from pr2_controllers_msgs.msg import PointHeadAction, PointHeadGoal", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0733, 0.0052, 0, 0.66, 0.5556, 457, 0, 2, 0, 0, 457, 0, 0], "semantic": {"name": "pr2_controllers_msgs.msg", "arg_names": [], "import_names": ["PointHeadAction", "PointHeadGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pr2_controllers_msgs.msg import PointHeadAction, PointHeadGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:ImportFrom_L15_C0", "label": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0785, 0.0052, 0, 0.66, 0.6111, 252, 0, 2, 0, 0, 252, 0, 0], "semantic": {"name": "rfid_datacapture.srv", "arg_names": [], "import_names": ["BagCapture", "BagCaptureRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:ImportFrom_L16_C0", "label": "from hrl_rfid.srv import RfidSrv", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0838, 0.0052, 0, 0.66, 0.6667, 592, 0, 1, 0, 0, 592, 0, 0], "semantic": {"name": "hrl_rfid.srv", "arg_names": [], "import_names": ["RfidSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.srv import RfidSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Import_L18_C0", "label": "rfid_datacapture.utils import rdut", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0942, 0.0052, 0, 0.66, 0.7222, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "rfid_datacapture.utils", "arg_names": [], "import_names": ["rdut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_datacapture.utils as rdut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Import_L20_C0", "label": "numpy import np, math", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1047, 0.0052, 0, 0.66, 0.7778, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L23_C0", "label": "RfidStart", "type": "class", "loc": [23, 41], "level": 0, "parent": null, "vector": [3, 0, 0.1675, 0.0995, 0, 0.66, 0.8333, 10, 0, 2, 0, 0, 892, 0, 4], "semantic": {"name": "RfidStart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RfidStart(smach.State):\n def __init__(self, srv_path ):\n smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n input_keys = ['tagid'])\n self.srv_path = srv_path\n self.init = False\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L24_C4", "label": "__init__", "type": "function", "loc": [24, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L23_C0", "vector": [2, 1, 0.1387, 0.0314, 1, 0.99, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "srv_path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, srv_path ):\n smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n input_keys = ['tagid'])\n self.srv_path = srv_path\n self.init = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L25_C8", "label": "__init__()", "type": "expression", "loc": [25, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L24_C4", "vector": [8, 2, 0.1361, 0.0157, 2, 0.08, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n input_keys = ['tagid'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L28_C8", "label": "self.srv_path =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L24_C4", "vector": [14, 2, 0.1466, 0.0052, 2, 0.08, 0.5, 713, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srv_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.srv_path = srv_path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L29_C8", "label": "self.init =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L24_C4", "vector": [14, 2, 0.1518, 0.0052, 2, 0.08, 1.0, 656, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L31_C4", "label": "execute", "type": "function", "loc": [31, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L23_C0", "vector": [2, 1, 0.1885, 0.0576, 1, 0.99, 1.0, 569, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n if not self.init:\n rospy.wait_for_service( self.srv_path )\n self.srv = rospy.ServiceProxy( self.srv_path, RfidSrv )\n self.init = True\n \n rv = self.srv([ 'track', userdata.tagid ])\n if rv:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L32_C8", "label": "if", "type": "if", "loc": [32, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L31_C4", "vector": [4, 2, 0.1754, 0.0209, 2, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.init:\n rospy.wait_for_service( self.srv_path )\n self.srv = rospy.ServiceProxy( self.srv_path, RfidSrv )\n self.init = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L33_C12", "label": "wait_for_service()", "type": "expression", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L32_C8", "vector": [8, 3, 0.1728, 0.0052, 3, 0.54, 0.0, 617, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service( self.srv_path )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L34_C12", "label": "self.srv = ServiceProxy()", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L32_C8", "vector": [14, 3, 0.178, 0.0052, 3, 0.54, 0.5, 721, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self.srv", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self.srv = rospy.ServiceProxy( self.srv_path, RfidSrv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L35_C12", "label": "self.init =", "type": "assigned_variable", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L32_C8", "vector": [14, 3, 0.1832, 0.0052, 3, 0.54, 1.0, 656, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L37_C8", "label": "rv = srv()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L31_C4", "vector": [14, 2, 0.1937, 0.0052, 2, 0.78, 0.5, 222, 3, 1, 0, 0, 445, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "srv", "annotation": ""}, "snippet": " rv = self.srv([ 'track', userdata.tagid ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L38_C8", "label": "if", "type": "if", "loc": [38, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L31_C4", "vector": [4, 2, 0.2068, 0.0209, 2, 0.78, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rv:\n return 'succeeded'\n else:\n return 'aborted' # done!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L39_C12", "label": "return", "type": "return", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L38_C8", "vector": [13, 3, 0.2042, 0.0052, 3, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L41_C12", "label": "return", "type": "return", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L38_C8", "vector": [13, 3, 0.2147, 0.0052, 3, 0.38, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'aborted' # done!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L43_C0", "label": "RfidStop", "type": "class", "loc": [43, 59], "level": 0, "parent": null, "vector": [3, 0, 0.267, 0.089, 0, 0.66, 0.8889, 986, 0, 2, 0, 0, 892, 0, 4], "semantic": {"name": "RfidStop", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RfidStop(smach.State):\n def __init__(self, srv_path ):\n smach.State.__init__(self, outcomes=['succeeded', 'aborted'])\n self.srv_path = srv_path\n self.init = False\n\n def execute(self, userdata):\n if not self.init:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L44_C4", "label": "__init__", "type": "function", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L43_C0", "vector": [2, 1, 0.2382, 0.0209, 1, 0.29, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "srv_path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, srv_path ):\n smach.State.__init__(self, outcomes=['succeeded', 'aborted'])\n self.srv_path = srv_path\n self.init = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L45_C8", "label": "__init__()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L44_C4", "vector": [8, 2, 0.2356, 0.0052, 2, 0.68, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self, outcomes=['succeeded', 'aborted'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L46_C8", "label": "self.srv_path =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L44_C4", "vector": [14, 2, 0.2408, 0.0052, 2, 0.68, 0.5, 713, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srv_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.srv_path = srv_path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L47_C8", "label": "self.init =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L44_C4", "vector": [14, 2, 0.2461, 0.0052, 2, 0.68, 1.0, 656, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L49_C4", "label": "execute", "type": "function", "loc": [49, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L43_C0", "vector": [2, 1, 0.2827, 0.0576, 1, 0.29, 1.0, 569, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n if not self.init:\n rospy.wait_for_service( self.srv_path )\n self.srv = rospy.ServiceProxy( self.srv_path, RfidSrv )\n self.init = True\n \n rv = self.srv([ 'stop' ])\n if rv:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L50_C8", "label": "if", "type": "if", "loc": [50, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L49_C4", "vector": [4, 2, 0.2696, 0.0209, 2, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.init:\n rospy.wait_for_service( self.srv_path )\n self.srv = rospy.ServiceProxy( self.srv_path, RfidSrv )\n self.init = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L51_C12", "label": "wait_for_service()", "type": "expression", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L50_C8", "vector": [8, 3, 0.267, 0.0052, 3, 0.21, 0.0, 617, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service( self.srv_path )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L52_C12", "label": "self.srv = ServiceProxy()", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L50_C8", "vector": [14, 3, 0.2723, 0.0052, 3, 0.21, 0.5, 721, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self.srv", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self.srv = rospy.ServiceProxy( self.srv_path, RfidSrv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L53_C12", "label": "self.init =", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L50_C8", "vector": [14, 3, 0.2775, 0.0052, 3, 0.21, 1.0, 656, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L55_C8", "label": "rv = srv()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L49_C4", "vector": [14, 2, 0.288, 0.0052, 2, 0.88, 0.5, 222, 3, 1, 0, 0, 445, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "srv", "annotation": ""}, "snippet": " rv = self.srv([ 'stop' ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L56_C8", "label": "if", "type": "if", "loc": [56, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L49_C4", "vector": [4, 2, 0.301, 0.0209, 2, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rv:\n return 'succeeded'\n else:\n return 'aborted' # done!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L56_C8", "vector": [13, 3, 0.2984, 0.0052, 3, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L56_C8", "vector": [13, 3, 0.3089, 0.0052, 3, 0.23, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'aborted' # done!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "label": "sm_cap_360", "type": "function", "loc": [62, 168], "level": 0, "parent": null, "vector": [2, 0, 0.6021, 0.5602, 0, 0.66, 0.9444, 174, 0, 1, 1, 0, 0, 0, 28], "semantic": {"name": "sm_cap_360", "arg_names": ["yaml_fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sm_cap_360( yaml_fname ):\n # Create a SMACH state machine\n sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'],\n input_keys = ['track_mode'])\n\n # Open the container\n with sm:\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L64_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [14, 1, 0.3377, 0.0105, 1, 0.05, 0.0, 21, 3, 2, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'],\n input_keys = ['track_mode'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "label": "PointAdd", "type": "function", "loc": [71, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [2, 1, 0.4084, 0.0785, 1, 0.05, 0.0, 429, 0, 6, 0, 0, 0, 0, 4], "semantic": {"name": "PointAdd", "arg_names": ["x", "y", "z", "dur", "state", "res"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def PointAdd( x, y, z, dur, state, res ):\n pgoal = PointHeadGoal()\n pgoal.target.header.frame_id = '/torso_lift_link'\n pgoal.target.point.x = x\n pgoal.target.point.y = y\n pgoal.target.point.z = z\n pgoal.min_duration = rospy.Duration( dur )\n pgoal.max_velocity = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L72_C12", "label": "pgoal = PointHeadGoal()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [14, 2, 0.377, 0.0052, 2, 0.95, 0.0, 882, 3, 0, 0, 0, 479, 10, 1], "semantic": {"name": "pgoal", "arg_names": [], "import_names": [], "rhs_call_name": "PointHeadGoal", "annotation": ""}, "snippet": " pgoal = PointHeadGoal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L73_C12", "label": "pgoal.target.header.frame_id =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [14, 2, 0.3822, 0.0052, 2, 0.95, 0.125, 99, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pgoal.target.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.target.header.frame_id = '/torso_lift_link'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L74_C12", "label": "pgoal.target.point.x =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [14, 2, 0.3874, 0.0052, 2, 0.95, 0.25, 801, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pgoal.target.point.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.target.point.x = x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L75_C12", "label": "pgoal.target.point.y =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [14, 2, 0.3927, 0.0052, 2, 0.95, 0.375, 59, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pgoal.target.point.y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.target.point.y = y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L76_C12", "label": "pgoal.target.point.z =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [14, 2, 0.3979, 0.0052, 2, 0.95, 0.5, 591, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pgoal.target.point.z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.target.point.z = z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L77_C12", "label": "pgoal.min_duration = Duration()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [14, 2, 0.4031, 0.0052, 2, 0.95, 0.625, 457, 3, 1, 0, 0, 972, 10, 1], "semantic": {"name": "pgoal.min_duration", "arg_names": [], "import_names": [], "rhs_call_name": "Duration", "annotation": ""}, "snippet": " pgoal.min_duration = rospy.Duration( dur )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L78_C12", "label": "pgoal.max_velocity =", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [14, 2, 0.4084, 0.0052, 2, 0.95, 0.75, 412, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "pgoal.max_velocity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.max_velocity = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L79_C12", "label": "add()", "type": "expression", "loc": [79, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [8, 2, 0.4267, 0.0314, 2, 0.95, 0.875, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n state,\n SimpleActionState( '/head_traj_controller/point_head_action',\n PointHeadAction,\n goal = pgoal ),\n transitions = { 'succeeded' : res })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L85_C12", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "vector": [13, 2, 0.445, 0.0052, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L87_C8", "label": "PointAdd()", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.4555, 0.0052, 1, 0.05, 0.0769, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( 1.0, 0.0, 0.35, 5.0, 'INIT_HEAD', 'CAP_START' ) # Go to safe initial conditions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L88_C8", "label": "PointAdd()", "type": "expression", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.4607, 0.0052, 1, 0.05, 0.1538, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( -1.0, -0.25, 0.35, 7.0, 'CAP_START', 'CAPTURE_POSITIONS' ) # Prepare for lots of \"neck craning\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L90_C8", "label": "add()", "type": "expression", "loc": [90, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.4843, 0.0314, 1, 0.05, 0.2308, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'CAPTURE_POSITIONS',\n rdut.YAMLprocPoses( yaml_fname ),\n remapping = {'next_move_pose':'next_move_pose'}, # output\n transitions = {'aborted':'succeeded',\n 'succeeded':'READY_MOVE'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L97_C8", "label": "add()", "type": "expression", "loc": [97, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.5157, 0.0209, 1, 0.05, 0.3077, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'READY_MOVE',\n rdut.MoveNotify(),\n transitions = {'succeeded':'MOVE_POSITION'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L102_C8", "label": "add()", "type": "expression", "loc": [102, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.555, 0.0471, 1, 0.05, 0.3846, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'MOVE_POSITION',\n SimpleActionState( '/move_base',\n MoveBaseAction,\n goal_slots = [ 'target_pose' ]),\n remapping = { 'target_pose' : 'next_move_pose' }, # input\n transitions = {'aborted':'MANUAL_SKIP',\n 'preempted':'aborted',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L112_C8", "label": "add()", "type": "expression", "loc": [112, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.5969, 0.0262, 1, 0.05, 0.4615, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'MANUAL_SKIP',\n rdut.ManualSkip(),\n transitions = {'succeeded':'CAPTURE_TAGS', # We already manually positioned the robot\n 'aborted':'CAPTURE_POSITIONS'}) # skip this position and go to next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L119_C8", "label": "add()", "type": "expression", "loc": [119, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.6545, 0.0681, 1, 0.05, 0.5385, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'CAPTURE_TAGS',\n rdut.YAMLprocMultitag( yaml_fname ),\n remapping = {'bagfile_name':'bagfile_name', # output\n 'bagfile_topics':'bagfile_topics', # output\n 'panrate':'panrate',\n 'tagid':'tagid',\n 'tilt_left':'tilt_left',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L133_C8", "label": "add()", "type": "expression", "loc": [133, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.7147, 0.0419, 1, 0.05, 0.6154, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'START_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request_slots = ['topics','dest'] ),\n remapping = {'topics':'bagfile_topics',\n 'dest':'bagfile_name'},\n transitions = {'succeeded':'RFID_START'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L146_C8", "label": "add()", "type": "expression", "loc": [146, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.7749, 0.0262, 1, 0.05, 0.6923, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'RFID_START',\n RfidStart( '/rfid/head_mode' ),\n remapping = {'tagid':'tagid'},\n transitions = {'succeeded':'LOOK_LEFT'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L152_C8", "label": "PointAdd()", "type": "expression", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.7958, 0.0052, 1, 0.05, 0.7692, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( -1.0, 0.25, 0.35, 27.0, 'LOOK_LEFT', 'RFID_STOP' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L154_C8", "label": "add()", "type": "expression", "loc": [154, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.8141, 0.0209, 1, 0.05, 0.8462, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'RFID_STOP',\n RfidStop( '/rfid/head_mode' ),\n transitions = {'succeeded':'STOP_BAG_CAPTURE'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L159_C8", "label": "add()", "type": "expression", "loc": [159, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.8455, 0.0314, 1, 0.05, 0.9231, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'STOP_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request = BagCaptureRequest('','') ),\n transitions = {'succeeded':'LOOK_RIGHT'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L166_C8", "label": "PointAdd()", "type": "expression", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [8, 1, 0.8691, 0.0052, 1, 0.05, 1.0, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( -1.0, -0.25, 0.35, 8.0, 'LOOK_RIGHT', 'CAPTURE_TAGS' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L168_C4", "label": "return", "type": "return", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "vector": [13, 1, 0.8796, 0.0052, 1, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "label": "if", "type": "if", "loc": [171, 187], "level": 0, "parent": null, "vector": [4, 0, 0.9372, 0.089, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--yaml', action='store', type='string', dest='yaml',\n help='Capture description yaml file', default='')\n opt, args = p.parse_args()\n\n if opt.yaml == '':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Import_L172_C4", "label": "optparse import optparse", "type": "import", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [1, 1, 0.9005, 0.0052, 1, 0.93, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L173_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [173, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [14, 1, 0.9058, 0.0052, 1, 0.93, 0.125, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L174_C4", "label": "add_option()", "type": "expression", "loc": [174, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [8, 1, 0.9136, 0.0105, 1, 0.93, 0.25, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--yaml', action='store', type='string', dest='yaml',\n help='Capture description yaml file', default='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L176_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [14, 1, 0.9215, 0.0052, 1, 0.93, 0.375, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L178_C4", "label": "if", "type": "if", "loc": [178, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [4, 1, 0.9372, 0.0157, 1, 0.93, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.yaml == '':\n print('ERROR: Must specify YAML file.')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L179_C8", "label": "print()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L178_C4", "vector": [8, 2, 0.9372, 0.0052, 2, 0.07, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('ERROR: Must specify YAML file.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L180_C8", "label": "exit()", "type": "expression", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L178_C4", "vector": [8, 2, 0.9424, 0.0052, 2, 0.07, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L182_C4", "label": "init_node()", "type": "expression", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [8, 1, 0.9529, 0.0052, 1, 0.93, 0.625, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('rfid_head_capture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L184_C4", "label": "sm = sm_cap_360()", "type": "assigned_variable", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [14, 1, 0.9634, 0.0052, 1, 0.93, 0.75, 21, 3, 1, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "sm_cap_360", "annotation": ""}, "snippet": " sm = sm_cap_360( opt.yaml )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L186_C4", "label": "sm.userdata.track_mode =", "type": "assigned_variable", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [14, 1, 0.9738, 0.0052, 1, 0.93, 0.875, 445, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sm.userdata.track_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.track_mode = 'track'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L187_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [187, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "vector": [14, 1, 0.9791, 0.0052, 1, 0.93, 1.0, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Return_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Import_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99409:If_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99409:Assign_L187_C4"}] |
#!/usr/bin/python
# Basically a giant script.
import roslib
roslib.load_manifest( 'geometry_msgs' ) # the pickle files containe Point and Pose Stamped.
import rospy
from geometry_msgs.msg import PointStamped, PoseStamped
import sys
import glob
import yaml
import time
import optparse
import cPickle as pkl
import numpy as np, math
import pylab as pl
import friis
PLOT = False
# glob_files: '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/datacap/*.pkl'
# filters:
# antennas:
# PR2_Head: '/head_rfid'
# tags:
# 'datacap ':
if __name__ == '__main__':
p = optparse.OptionParser()
p.add_option('--yaml', action='store', type='string', dest='yaml', default='',
help='yaml file that describes this run.')
p.add_option('--plot', action='store_true', dest='plot',
help='Pop-up the resulting plot')
opt, args = p.parse_args()
yaml_fname = opt.yaml
PLOT = opt.plot
else:
yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/friis_plot_datacap.yaml'
# SCRIPT:
if not yaml_fname:
print 'YAML file required!'
exit()
else:
f = open( yaml_fname )
yaml_config = yaml.load( f )
f.close()
# Load all pkl files into one huge dictionary.
# d = { 'tagid1': [ PROC_READ1, PROC_READ2, ... ],
# ...
# }
def add_files( d, arg ):
fname, fcount = arg
print 'Loading (%d of %d): %s' % (fcount, len(fnames), fname)
f = open( fname, 'r' )
d_new = pkl.load( f )
f.close()
for k in d_new.keys():
if not d.has_key( k ):
d[k] = []
d[k] += d_new[k]
return d
# Calculate Useful Values
def friis_pwr_tag( reading ):
# Model estimate of P^inc_tag.
# r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading
d_rdr = reading[0]
d_tag = reading[1]
read = reading[2]
d_rot = reading[3]
ps = reading[4]
r_rdr, theta_rdr, phi_rdr = d_rdr
r_tag, theta_tag, phi_tag = d_tag
watts = friis.pwr_inc_tag( r_rdr,
friis.patch.G, theta_rdr, phi_rdr,
friis.dipole.G, theta_tag, phi_tag )
return friis.WattsToDBm( watts )
def friis_pwr_rdr( reading ):
# Model estimate of P^inc_rdr.
# r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading
d_rdr = reading[0]
d_tag = reading[1]
read = reading[2]
d_rot = reading[3]
ps = reading[4]
r_rdr, theta_rdr, phi_rdr = d_rdr
r_tag, theta_tag, phi_tag = d_tag
watts = friis.pwr_inc_rdr( r_rdr,
friis.patch.G, theta_rdr, phi_rdr,
friis.dipole.G, theta_tag, phi_tag )
return friis.WattsToDBm( watts )
fnames = reduce( lambda x,y: x+y, [ glob.glob(i) for i in yaml_config['glob_files'] ], [] )
if len(glob.glob(yaml_config['use_combined'])) > 0:
print 'Loading pickle: %s' % (yaml_config['use_combined'])
f = open( yaml_config['use_combined'], 'r' )
data = pkl.load( f )
f.close()
print 'Done.'
else:
f = open( yaml_config['use_combined'], 'w' )
d = reduce( add_files, zip(fnames,range(len(fnames))), {} )
# Apply Filters:
# Start with just the desired tagids
all_reads = reduce( lambda x,y: x+y,
[ d[k] for k in yaml_config['filters']['tags'] if d.has_key(k) ],
[] )
print '*** File \'%s\' had a total of %d reads ***' % ( yaml_fname, len( all_reads ))
# Filter based on antennas
# return [ [r_rdr, theta_rdr, phi_rdr], # all floats
# [r_tag, theta_tag, phi_tag], # all floats
# [rr.rssi, rr.antenna_name, rr.tagID ], # int, string, string
# [theta_rot_map, theta_tag_map], # floats (radians)
# [ tag_map, rdr_map, rot_map ] ] # geometry_msgs/PoseStamped
ant_dict = dict.fromkeys( yaml_config['filters']['antennas'] )
filt_reads = [ r for r in all_reads if ant_dict.has_key( r[2][1] ) ]
reads = filt_reads
p_inc_tag = np.array([ friis_pwr_tag( r ) for r in reads ]) # in dBm!
p_inc_rdr = np.array([ friis_pwr_rdr( r ) for r in reads ]) # in dBm!
rssi = np.array([ r[2][0] for r in reads ])
data = np.row_stack([ p_inc_tag,
p_inc_rdr,
rssi ])
print 'Dumping data into combined pickle file: %s ' % (yaml_config['use_combined'])
pkl.dump( data, f, -1 )
f.close()
print 'Done. Re-run.'
exit()
p_inc_tag = data[0]
p_inc_rdr = data[1]
rssi = data[2]
pos_mask = rssi != -1
neg_mask = rssi == -1
if len(pos_mask) == 0:
print '### File \'%s\' had no positive reads -- exiting ###' % ( yaml_fname )
exit()
if len(neg_mask) == 0:
print '### File \'%s\' had no positive reads -- exiting ###' % ( yaml_fname )
exit()
# P^inc_rdr vs. RSSI.
def plot_pincrdr( f = None ):
if not f:
f = pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pl.plot( p_inc_rdr[pos_mask], rssi[pos_mask], 'bx', alpha = 0.5 )
pl.xlabel( '$P^{inc}_{rdr}$ (dBm)')
pl.ylabel( 'RSSI')
pl.title( 'Measured RSSI vs Predicted Power at Reader' )
xval = None
yval = None
if yaml_config.has_key( 'rdr_calcfriis' ):
# Old way: take max Pincrdr
# ind = p_inc_rdr >= np.max( p_inc_rdr ) - yaml_config['rdr_calcfriis']['within_max']
# New way: take region we know to be linear in Friis. Note, this also elimates negative reads!
ind = np.all( np.row_stack([
rssi >= yaml_config['rdr_calcfriis']['rssi_min'],
rssi <= yaml_config['rdr_calcfriis']['rssi_max'] ]), axis = 0)
xval = np.mean( p_inc_rdr[ ind ] ) # Friis line runs throught this point
yval = np.mean( rssi[ ind ] )
# CURIOUS: Both methods are the same. I could probably show that, but I'm tired!
# We know the slope is 0.75. y = 0.75 * x + c ==> c = mean( y - 0.75 x )
# c = np.mean( rssi[ind] - 0.75 * p_inc_rdr[ind] )
# xval = -19.19 # arbitrary, but convenient
# yval = 0.75 * xval + c
print 'Calculated Friis Line:\n\txval: %3.2f\n\tyval: %3.2f' % (xval,yval)
if yaml_config.has_key( 'rdr_drawfriis' ):
xval = yaml_config[ 'rdr_drawfriis' ][ 'xval' ]
yval = yaml_config[ 'rdr_drawfriis' ][ 'yval' ]
if xval and yval:
pl.hold( True )
# Slope of line (from Matt's measurements) should be 0.75
xs = np.linspace( yaml_config['rdr_axis'][0], yaml_config['rdr_axis'][1], 100 )
ys = 0.75 * ( xs - xval ) + yval # pt-slope form
pl.plot( xs, ys, 'g-', linewidth = 2.0 )
pl.legend(['Positive Reads','Friis Model Fit'], loc=(1.03,0.2))
else:
pl.legend(['Positive Reads'], loc=(1.03,0.2))
pl.axis( yaml_config['rdr_axis'] )
return f
plot_pincrdr()
pl.savefig( yaml_config['outimage'] + '_pincrdr.png' )
# P^inc_rdr vs. P(read)
def plot_pincrdr_probs( f = None ):
hist, bins = np.histogram( p_inc_rdr,
bins = yaml_config['rdr_histbins']['bins'],
range = (yaml_config['rdr_histbins']['min'],
yaml_config['rdr_histbins']['max']) )
bin_width = bins[1] - bins[0]
# Find out which bin each read belongs to.
# Sanity check: print [ sum( bins_ind == i ) for i in xrange(len(hist)) ] => equals hist
bins_ind = np.sum( p_inc_rdr[:,np.newaxis] > bins[:-1], axis = 1 ) - 1
prob_read = [ sum(rssi[bins_ind == i] != -1)*1.0 / hist[i] # positive reads / total reads for bin i
for i in xrange(len(hist)) # same as len(bins)-1
if hist[i] != 0 ] # only where we have data! (also prevents div by 0)
if not f:
f = pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pos_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!
prob_read, # This is only defined for ones that have data!
width = bin_width,
color = 'b',
alpha = 0.7 )
pl.hold( True )
neg_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!
[ 1.0 - p for p in prob_read ], # This is only defined for ones that have data!
width = bin_width,
bottom = prob_read,
color = 'r',
alpha = 0.7 )
pl.axis([ yaml_config['rdr_axis'][0], yaml_config['rdr_axis'][1], 0.0, 1.0 ])
pl.xlabel( '$P^{inc}_{rdr}$ (dBm)')
pl.ylabel( 'Probability of Tag Read / No-Read')
pl.title( 'Probability of Tag Read / No-Read vs Predicted Power at Reader ' )
pl.legend((pos_bars[0], neg_bars[0]), ('P( read )', 'P( no read )'), loc=(1.03,0.2))
return f
plot_pincrdr_probs()
pl.savefig( yaml_config['outimage'] + '_pincrdr_probs.png' )
# P^inc_tag vs. P(read)
def plot_pinctag_probs( f = None ):
pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pl.plot( p_inc_tag[pos_mask], rssi[pos_mask], 'bx', alpha = 0.5 )
pl.xlabel( '$P^{inc}_{tag}$ (dBm)')
pl.ylabel( 'RSSI')
pl.title( 'Measured RSSI vs Predicted Power at Tag' )
pl.legend(['Positive Reads'], loc=(1.03,0.2))
pl.axis( yaml_config['tag_axis'] )
pl.savefig( yaml_config['outimage'] + '_pinctag.png' )
hist, bins = np.histogram( p_inc_tag,
bins = yaml_config['tag_histbins']['bins'],
range = (yaml_config['tag_histbins']['min'],
yaml_config['tag_histbins']['max']) )
bin_width = bins[1] - bins[0]
# Find out which bin each read belongs to.
# Sanity check: print [ sum( bins_ind == i ) for i in xrange(len(hist)) ] => equals hist
bins_ind = np.sum( p_inc_tag[:,np.newaxis] > bins[:-1], axis = 1 ) - 1
prob_read = [ sum(rssi[bins_ind == i] != -1)*1.0 / hist[i] # positive reads / total reads for bin i
for i in xrange(len(hist)) # same as len(bins)-1
if hist[i] != 0 ] # only where we have data! (also prevents div by 0)
if not f:
f = pl.figure( figsize=(10,6) )
pl.axes([0.1,0.1,0.65,0.8])
pos_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!
prob_read, # This is only defined for ones that have data!
width = bin_width,
color = 'b',
alpha = 0.7 )
pl.hold( True )
neg_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!
[ 1.0 - p for p in prob_read ], # This is only defined for ones that have data!
width = bin_width,
bottom = prob_read,
color = 'r',
alpha = 0.7)
pl.axis([ yaml_config['tag_axis'][0], yaml_config['tag_axis'][1], 0.0, 1.0 ])
pl.xlabel( '$P^{inc}_{tag}$ (dBm)')
pl.ylabel( 'Probability of Tag Read / No-Read')
pl.title( 'Probability of Tag Read / No-Read vs Predicted Power at Tag' )
pl.legend((pos_bars[0], neg_bars[0]), ('P( read )', 'P( no read )'), loc=(1.03,0.2))
# pl.legend(['P( read )'], loc=(1.03,0.2))
pl.savefig( yaml_config['outimage'] + '_pinctag_probs.png' )
# return f
plot_pinctag_probs()
if PLOT:
pl.show()
| ajibawa-2023/Python-Code-Large/train/row_99410 | 169 | 328 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L5_C0", "label": "roslib import roslib", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0152, 0.003, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0183, 0.003, 0, 0.66, 0.0278, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'geometry_msgs' ) # the pickle files containe Point and Pose Stamped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L7_C0", "label": "rospy import rospy", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.003, 0, 0.66, 0.0556, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:ImportFrom_L9_C0", "label": "from geometry_msgs.msg import PointStamped, PoseStamped", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0274, 0.003, 0, 0.66, 0.0833, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PointStamped", "PoseStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PointStamped, PoseStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L12_C0", "label": "sys import sys", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0366, 0.003, 0, 0.66, 0.1111, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L13_C0", "label": "glob import glob", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0396, 0.003, 0, 0.66, 0.1389, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L14_C0", "label": "yaml import yaml", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0427, 0.003, 0, 0.66, 0.1667, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L15_C0", "label": "time import time", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0457, 0.003, 0, 0.66, 0.1944, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L16_C0", "label": "optparse import optparse", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0488, 0.003, 0, 0.66, 0.2222, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L17_C0", "label": "cPickle import pkl", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0518, 0.003, 0, 0.66, 0.25, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L18_C0", "label": "numpy import np, math", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0549, 0.003, 0, 0.66, 0.2778, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L19_C0", "label": "pylab import pl", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0579, 0.003, 0, 0.66, 0.3056, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Import_L21_C0", "label": "friis import friis", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.064, 0.003, 0, 0.66, 0.3333, 769, 0, 1, 0, 0, 769, 0, 0], "semantic": {"name": "friis", "arg_names": [], "import_names": ["friis"], "rhs_call_name": "", "annotation": ""}, "snippet": "import friis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L23_C0", "label": "PLOT =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.0701, 0.003, 0, 0.66, 0.3611, 614, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "PLOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PLOT = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "label": "if", "type": "if", "loc": [32, 43], "level": 0, "parent": null, "vector": [4, 0, 0.1143, 0.0366, 0, 0.66, 0.3889, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n p = optparse.OptionParser()\n p.add_option('--yaml', action='store', type='string', dest='yaml', default='',\n help='yaml file that describes this run.')\n p.add_option('--plot', action='store_true', dest='plot',\n help='Pop-up the resulting plot')\n opt, args = p.parse_args()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L33_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "vector": [14, 1, 0.1006, 0.003, 1, 0.5, 0.0, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L34_C4", "label": "add_option()", "type": "expression", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "vector": [8, 1, 0.1052, 0.0061, 1, 0.5, 0.1667, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--yaml', action='store', type='string', dest='yaml', default='',\n help='yaml file that describes this run.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L36_C4", "label": "add_option()", "type": "expression", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "vector": [8, 1, 0.1113, 0.0061, 1, 0.5, 0.3333, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--plot', action='store_true', dest='plot',\n help='Pop-up the resulting plot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L38_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "vector": [14, 1, 0.1159, 0.003, 1, 0.5, 0.5, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L40_C4", "label": "yaml_fname =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "vector": [14, 1, 0.122, 0.003, 1, 0.5, 0.6667, 590, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yaml_fname = opt.yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L41_C4", "label": "PLOT =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "vector": [14, 1, 0.125, 0.003, 1, 0.5, 0.8333, 614, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "PLOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PLOT = opt.plot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L43_C4", "label": "yaml_fname =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "vector": [14, 1, 0.1311, 0.003, 1, 0.5, 1.0, 590, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/friis_plot_datacap.yaml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "label": "if", "type": "if", "loc": [49, 55], "level": 0, "parent": null, "vector": [4, 0, 0.1585, 0.0213, 0, 0.66, 0.4167, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not yaml_fname:\n print('YAML file required!')\n exit()\nelse:\n f = open( yaml_fname )\n yaml_config = yaml.load( f )\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L50_C4", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "vector": [8, 1, 0.1524, 0.003, 1, 0.01, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('YAML file required!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L51_C4", "label": "exit()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "vector": [8, 1, 0.1555, 0.003, 1, 0.01, 0.25, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L53_C4", "label": "f = open()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "vector": [14, 1, 0.1616, 0.003, 1, 0.01, 0.5, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L54_C4", "label": "yaml_config = load()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "vector": [14, 1, 0.1646, 0.003, 1, 0.01, 0.75, 248, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "yaml_config", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " yaml_config = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L55_C4", "label": "close()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "vector": [8, 1, 0.1677, 0.003, 1, 0.01, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "label": "add_files", "type": "function", "loc": [62, 74], "level": 0, "parent": null, "vector": [2, 0, 0.2073, 0.0396, 0, 0.66, 0.4444, 46, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "add_files", "arg_names": ["d", "arg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def add_files( d, arg ):\n fname, fcount = arg\n print('Loading (%d of %d): %s' % (fcount, len(fnames), fname))\n f = open( fname, 'r' )\n d_new = pkl.load( f )\n f.close()\n\n for k in d_new.keys():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L63_C4", "label": "fname, fcount =", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "vector": [14, 1, 0.1921, 0.003, 1, 0.44, 0.0, 111, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname, fcount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname, fcount = arg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L64_C4", "label": "print()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "vector": [8, 1, 0.1951, 0.003, 1, 0.44, 0.1667, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading (%d of %d): %s' % (fcount, len(fnames), fname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L65_C4", "label": "f = open()", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "vector": [14, 1, 0.1982, 0.003, 1, 0.44, 0.3333, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L66_C4", "label": "d_new = load()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "vector": [14, 1, 0.2012, 0.003, 1, 0.44, 0.5, 388, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "d_new", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " d_new = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L67_C4", "label": "close()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "vector": [8, 1, 0.2043, 0.003, 1, 0.44, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:For_L69_C4", "label": "for k", "type": "for", "loc": [69, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "vector": [6, 1, 0.2149, 0.0122, 1, 0.44, 0.8333, 954, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in d_new.keys():\n if not d.has_key( k ):\n d[k] = []\n d[k] += d_new[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L70_C8", "label": "if", "type": "if", "loc": [70, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:For_L69_C4", "vector": [4, 2, 0.2149, 0.0061, 2, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not d.has_key( k ):\n d[k] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L71_C12", "label": "assign", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L70_C8", "vector": [14, 3, 0.2165, 0.003, 3, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[k] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L74_C4", "label": "return", "type": "return", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "vector": [13, 1, 0.2256, 0.003, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "label": "friis_pwr_tag", "type": "function", "loc": [78, 93], "level": 0, "parent": null, "vector": [2, 0, 0.2607, 0.0488, 0, 0.66, 0.4722, 124, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "friis_pwr_tag", "arg_names": ["reading"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def friis_pwr_tag( reading ):\n # Model estimate of P^inc_tag.\n # r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading\n d_rdr = reading[0]\n d_tag = reading[1]\n read = reading[2]\n d_rot = reading[3]\n ps = reading[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L81_C4", "label": "d_rdr =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [14, 1, 0.247, 0.003, 1, 0.13, 0.0, 836, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rdr = reading[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L82_C4", "label": "d_tag =", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [14, 1, 0.25, 0.003, 1, 0.13, 0.125, 632, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_tag = reading[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L83_C4", "label": "read =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [14, 1, 0.253, 0.003, 1, 0.13, 0.25, 453, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " read = reading[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L84_C4", "label": "d_rot =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [14, 1, 0.2561, 0.003, 1, 0.13, 0.375, 134, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rot = reading[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L85_C4", "label": "ps =", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [14, 1, 0.2591, 0.003, 1, 0.13, 0.5, 232, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps = reading[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L87_C4", "label": "r_rdr, theta_rdr, phi_rdr =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [14, 1, 0.2652, 0.003, 1, 0.13, 0.625, 349, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r_rdr, theta_rdr, phi_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r_rdr, theta_rdr, phi_rdr = d_rdr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L88_C4", "label": "r_tag, theta_tag, phi_tag =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [14, 1, 0.2683, 0.003, 1, 0.13, 0.75, 314, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r_tag, theta_tag, phi_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r_tag, theta_tag, phi_tag = d_tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L90_C4", "label": "watts = pwr_inc_tag()", "type": "assigned_variable", "loc": [90, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [14, 1, 0.2774, 0.0091, 1, 0.13, 0.875, 63, 3, 7, 0, 0, 455, 10, 1], "semantic": {"name": "watts", "arg_names": [], "import_names": [], "rhs_call_name": "pwr_inc_tag", "annotation": ""}, "snippet": " watts = friis.pwr_inc_tag( r_rdr,\n friis.patch.G, theta_rdr, phi_rdr,\n friis.dipole.G, theta_tag, phi_tag )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "vector": [13, 1, 0.2835, 0.003, 1, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return friis.WattsToDBm( watts )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "label": "friis_pwr_rdr", "type": "function", "loc": [95, 110], "level": 0, "parent": null, "vector": [2, 0, 0.3125, 0.0488, 0, 0.66, 0.5, 615, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "friis_pwr_rdr", "arg_names": ["reading"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def friis_pwr_rdr( reading ):\n # Model estimate of P^inc_rdr.\n # r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading\n d_rdr = reading[0]\n d_tag = reading[1]\n read = reading[2]\n d_rot = reading[3]\n ps = reading[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L98_C4", "label": "d_rdr =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [14, 1, 0.2988, 0.003, 1, 0.88, 0.0, 836, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rdr = reading[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L99_C4", "label": "d_tag =", "type": "assigned_variable", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [14, 1, 0.3018, 0.003, 1, 0.88, 0.125, 632, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_tag = reading[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L100_C4", "label": "read =", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [14, 1, 0.3049, 0.003, 1, 0.88, 0.25, 453, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " read = reading[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L101_C4", "label": "d_rot =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [14, 1, 0.3079, 0.003, 1, 0.88, 0.375, 134, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rot = reading[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L102_C4", "label": "ps =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [14, 1, 0.311, 0.003, 1, 0.88, 0.5, 232, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps = reading[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L104_C4", "label": "r_rdr, theta_rdr, phi_rdr =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [14, 1, 0.3171, 0.003, 1, 0.88, 0.625, 349, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r_rdr, theta_rdr, phi_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r_rdr, theta_rdr, phi_rdr = d_rdr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L105_C4", "label": "r_tag, theta_tag, phi_tag =", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [14, 1, 0.3201, 0.003, 1, 0.88, 0.75, 314, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r_tag, theta_tag, phi_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r_tag, theta_tag, phi_tag = d_tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L107_C4", "label": "watts = pwr_inc_rdr()", "type": "assigned_variable", "loc": [107, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [14, 1, 0.3293, 0.0091, 1, 0.88, 0.875, 63, 3, 7, 0, 0, 503, 10, 1], "semantic": {"name": "watts", "arg_names": [], "import_names": [], "rhs_call_name": "pwr_inc_rdr", "annotation": ""}, "snippet": " watts = friis.pwr_inc_rdr( r_rdr,\n friis.patch.G, theta_rdr, phi_rdr,\n friis.dipole.G, theta_tag, phi_tag )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L110_C4", "label": "return", "type": "return", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "vector": [13, 1, 0.3354, 0.003, 1, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return friis.WattsToDBm( watts )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L114_C0", "label": "fnames = reduce()", "type": "assigned_variable", "loc": [114, 114], "level": 0, "parent": null, "vector": [14, 0, 0.3476, 0.003, 0, 0.66, 0.5278, 641, 3, 3, 0, 0, 622, 10, 2], "semantic": {"name": "fnames", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": "fnames = reduce( lambda x,y: x+y, [ glob.glob(i) for i in yaml_config['glob_files'] ], [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "label": "if", "type": "if", "loc": [117, 158], "level": 0, "parent": null, "vector": [4, 0, 0.4192, 0.128, 0, 0.66, 0.5556, 0, 0, 0, 0, 0, 0, 0, 29], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if len(glob.glob(yaml_config['use_combined'])) > 0:\n print('Loading pickle: %s' % (yaml_config['use_combined']))\n f = open( yaml_config['use_combined'], 'r' )\n data = pkl.load( f )\n f.close()\n print('Done.')\nelse:\n f = open( yaml_config['use_combined'], 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L118_C4", "label": "print()", "type": "expression", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.3598, 0.003, 1, 0.53, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading pickle: %s' % (yaml_config['use_combined']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L119_C4", "label": "f = open()", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.3628, 0.003, 1, 0.53, 0.05, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_config['use_combined'], 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L120_C4", "label": "data = load()", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.3659, 0.003, 1, 0.53, 0.1, 929, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " data = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L121_C4", "label": "close()", "type": "expression", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.3689, 0.003, 1, 0.53, 0.15, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L122_C4", "label": "print()", "type": "expression", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.372, 0.003, 1, 0.53, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L124_C4", "label": "f = open()", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.378, 0.003, 1, 0.53, 0.25, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_config['use_combined'], 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L125_C4", "label": "d = reduce()", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.3811, 0.003, 1, 0.53, 0.3, 355, 3, 3, 0, 0, 622, 10, 4], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " d = reduce( add_files, zip(fnames,range(len(fnames))), {} )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L130_C4", "label": "all_reads = reduce()", "type": "assigned_variable", "loc": [130, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.3994, 0.0091, 1, 0.53, 0.35, 222, 3, 3, 0, 0, 622, 10, 2], "semantic": {"name": "all_reads", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " all_reads = reduce( lambda x,y: x+y,\n [ d[k] for k in yaml_config['filters']['tags'] if d.has_key(k) ],\n [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L134_C4", "label": "print()", "type": "expression", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.4085, 0.003, 1, 0.53, 0.4, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('*** File \\'%s\\' had a total of %d reads ***' % ( yaml_fname, len( all_reads )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L143_C4", "label": "ant_dict = fromkeys()", "type": "assigned_variable", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.436, 0.003, 1, 0.53, 0.45, 851, 3, 1, 0, 0, 631, 10, 1], "semantic": {"name": "ant_dict", "arg_names": [], "import_names": [], "rhs_call_name": "fromkeys", "annotation": ""}, "snippet": " ant_dict = dict.fromkeys( yaml_config['filters']['antennas'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L144_C4", "label": "filt_reads =", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.439, 0.003, 1, 0.53, 0.5, 172, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filt_reads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filt_reads = [ r for r in all_reads if ant_dict.has_key( r[2][1] ) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L146_C4", "label": "reads =", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.4451, 0.003, 1, 0.53, 0.55, 705, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "reads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " reads = filt_reads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L148_C4", "label": "p_inc_tag = array()", "type": "assigned_variable", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.4512, 0.003, 1, 0.53, 0.6, 383, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "p_inc_tag", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " p_inc_tag = np.array([ friis_pwr_tag( r ) for r in reads ]) # in dBm!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L149_C4", "label": "p_inc_rdr = array()", "type": "assigned_variable", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.4543, 0.003, 1, 0.53, 0.65, 679, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "p_inc_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " p_inc_rdr = np.array([ friis_pwr_rdr( r ) for r in reads ]) # in dBm!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L150_C4", "label": "rssi = array()", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.4573, 0.003, 1, 0.53, 0.7, 906, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " rssi = np.array([ r[2][0] for r in reads ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L151_C4", "label": "data = row_stack()", "type": "assigned_variable", "loc": [151, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [14, 1, 0.4634, 0.0091, 1, 0.53, 0.75, 929, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": " data = np.row_stack([ p_inc_tag,\n p_inc_rdr,\n rssi ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L154_C4", "label": "print()", "type": "expression", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.4695, 0.003, 1, 0.53, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Dumping data into combined pickle file: %s ' % (yaml_config['use_combined']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L155_C4", "label": "dump()", "type": "expression", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.4726, 0.003, 1, 0.53, 0.85, 952, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pkl.dump( data, f, -1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L156_C4", "label": "close()", "type": "expression", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.4756, 0.003, 1, 0.53, 0.9, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L157_C4", "label": "print()", "type": "expression", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.4787, 0.003, 1, 0.53, 0.95, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done. Re-run.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L158_C4", "label": "exit()", "type": "expression", "loc": [158, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "vector": [8, 1, 0.4817, 0.003, 1, 0.53, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L160_C0", "label": "p_inc_tag =", "type": "assigned_variable", "loc": [160, 160], "level": 0, "parent": null, "vector": [14, 0, 0.4878, 0.003, 0, 0.66, 0.5833, 383, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p_inc_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "p_inc_tag = data[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L161_C0", "label": "p_inc_rdr =", "type": "assigned_variable", "loc": [161, 161], "level": 0, "parent": null, "vector": [14, 0, 0.4909, 0.003, 0, 0.66, 0.6111, 679, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p_inc_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "p_inc_rdr = data[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L162_C0", "label": "rssi =", "type": "assigned_variable", "loc": [162, 162], "level": 0, "parent": null, "vector": [14, 0, 0.4939, 0.003, 0, 0.66, 0.6389, 906, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "rssi = data[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L164_C0", "label": "pos_mask =", "type": "assigned_variable", "loc": [164, 164], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.003, 0, 0.66, 0.6667, 804, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos_mask", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pos_mask = rssi != -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L165_C0", "label": "neg_mask =", "type": "assigned_variable", "loc": [165, 165], "level": 0, "parent": null, "vector": [14, 0, 0.503, 0.003, 0, 0.66, 0.6944, 608, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "neg_mask", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "neg_mask = rssi == -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L167_C0", "label": "if", "type": "if", "loc": [167, 169], "level": 0, "parent": null, "vector": [4, 0, 0.5122, 0.0091, 0, 0.66, 0.7222, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if len(pos_mask) == 0:\n print('### File \\'%s\\' had no positive reads -- exiting ###' % ( yaml_fname ))\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L168_C4", "label": "print()", "type": "expression", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L167_C0", "vector": [8, 1, 0.5122, 0.003, 1, 0.97, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('### File \\'%s\\' had no positive reads -- exiting ###' % ( yaml_fname ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L169_C4", "label": "exit()", "type": "expression", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L167_C0", "vector": [8, 1, 0.5152, 0.003, 1, 0.97, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L170_C0", "label": "if", "type": "if", "loc": [170, 172], "level": 0, "parent": null, "vector": [4, 0, 0.5213, 0.0091, 0, 0.66, 0.75, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if len(neg_mask) == 0:\n print('### File \\'%s\\' had no positive reads -- exiting ###' % ( yaml_fname ))\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L171_C4", "label": "print()", "type": "expression", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L170_C0", "vector": [8, 1, 0.5213, 0.003, 1, 0.1, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('### File \\'%s\\' had no positive reads -- exiting ###' % ( yaml_fname ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L172_C4", "label": "exit()", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L170_C0", "vector": [8, 1, 0.5244, 0.003, 1, 0.1, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "label": "plot_pincrdr", "type": "function", "loc": [175, 225], "level": 0, "parent": null, "vector": [2, 0, 0.6098, 0.1555, 0, 0.66, 0.7778, 13, 0, 1, 1, 0, 0, 0, 19], "semantic": {"name": "plot_pincrdr", "arg_names": ["f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_pincrdr( f = None ):\n if not f:\n f = pl.figure( figsize=(10,6) )\n \n pl.axes([0.1,0.1,0.65,0.8])\n pl.plot( p_inc_rdr[pos_mask], rssi[pos_mask], 'bx', alpha = 0.5 )\n pl.xlabel( '$P^{inc}_{rdr}$ (dBm)')\n pl.ylabel( 'RSSI')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L176_C4", "label": "if", "type": "if", "loc": [176, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [4, 1, 0.5381, 0.0061, 1, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not f:\n f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L177_C8", "label": "f = figure()", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L176_C4", "vector": [14, 2, 0.5396, 0.003, 2, 0.12, 0.0, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L179_C4", "label": "axes()", "type": "expression", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [8, 1, 0.5457, 0.003, 1, 0.61, 0.0833, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": " pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L180_C4", "label": "plot()", "type": "expression", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [8, 1, 0.5488, 0.003, 1, 0.61, 0.1667, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot( p_inc_rdr[pos_mask], rssi[pos_mask], 'bx', alpha = 0.5 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L181_C4", "label": "xlabel()", "type": "expression", "loc": [181, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [8, 1, 0.5518, 0.003, 1, 0.61, 0.25, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": " pl.xlabel( '$P^{inc}_{rdr}$ (dBm)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L182_C4", "label": "ylabel()", "type": "expression", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [8, 1, 0.5549, 0.003, 1, 0.61, 0.3333, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": " pl.ylabel( 'RSSI')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L183_C4", "label": "title()", "type": "expression", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [8, 1, 0.5579, 0.003, 1, 0.61, 0.4167, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " pl.title( 'Measured RSSI vs Predicted Power at Reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L185_C4", "label": "xval =", "type": "assigned_variable", "loc": [185, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [14, 1, 0.564, 0.003, 1, 0.61, 0.5, 607, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "xval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xval = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L186_C4", "label": "yval =", "type": "assigned_variable", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [14, 1, 0.5671, 0.003, 1, 0.61, 0.5833, 758, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "yval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yval = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "label": "if", "type": "if", "loc": [187, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [4, 1, 0.5991, 0.061, 1, 0.61, 0.6667, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if yaml_config.has_key( 'rdr_calcfriis' ):\n # Old way: take max Pincrdr\n # ind = p_inc_rdr >= np.max( p_inc_rdr ) - yaml_config['rdr_calcfriis']['within_max']\n\n # New way: take region we know to be linear in Friis. Note, this also elimates negative reads!\n ind = np.all( np.row_stack([\n rssi >= yaml_config['rdr_calcfriis']['rssi_min'],\n rssi <= yaml_config['rdr_calcfriis']['rssi_max'] ]), axis = 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L192_C8", "label": "ind = all()", "type": "assigned_variable", "loc": [192, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "vector": [14, 2, 0.5884, 0.0091, 2, 0.68, 0.0, 680, 3, 2, 0, 0, 895, 10, 2], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " ind = np.all( np.row_stack([\n rssi >= yaml_config['rdr_calcfriis']['rssi_min'],\n rssi <= yaml_config['rdr_calcfriis']['rssi_max'] ]), axis = 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L196_C8", "label": "xval = mean()", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "vector": [14, 2, 0.5976, 0.003, 2, 0.68, 0.3333, 607, 3, 1, 0, 0, 856, 10, 1], "semantic": {"name": "xval", "arg_names": [], "import_names": [], "rhs_call_name": "mean", "annotation": ""}, "snippet": " xval = np.mean( p_inc_rdr[ ind ] ) # Friis line runs throught this point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L197_C8", "label": "yval = mean()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "vector": [14, 2, 0.6006, 0.003, 2, 0.68, 0.6667, 758, 3, 1, 0, 0, 856, 10, 1], "semantic": {"name": "yval", "arg_names": [], "import_names": [], "rhs_call_name": "mean", "annotation": ""}, "snippet": " yval = np.mean( rssi[ ind ] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L206_C8", "label": "print()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "vector": [8, 2, 0.628, 0.003, 2, 0.68, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Calculated Friis Line:\\n\\txval: %3.2f\\n\\tyval: %3.2f' % (xval,yval))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L208_C4", "label": "if", "type": "if", "loc": [208, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [4, 1, 0.6372, 0.0091, 1, 0.61, 0.75, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if yaml_config.has_key( 'rdr_drawfriis' ):\n xval = yaml_config[ 'rdr_drawfriis' ][ 'xval' ]\n yval = yaml_config[ 'rdr_drawfriis' ][ 'yval' ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L209_C8", "label": "xval =", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L208_C4", "vector": [14, 2, 0.6372, 0.003, 2, 0.82, 0.0, 607, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xval = yaml_config[ 'rdr_drawfriis' ][ 'xval' ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L210_C8", "label": "yval =", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L208_C4", "vector": [14, 2, 0.6402, 0.003, 2, 0.82, 1.0, 758, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "yval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yval = yaml_config[ 'rdr_drawfriis' ][ 'yval' ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "label": "if", "type": "if", "loc": [212, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [4, 1, 0.6601, 0.0305, 1, 0.61, 0.8333, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if xval and yval:\n pl.hold( True )\n\n # Slope of line (from Matt's measurements) should be 0.75\n xs = np.linspace( yaml_config['rdr_axis'][0], yaml_config['rdr_axis'][1], 100 )\n ys = 0.75 * ( xs - xval ) + yval # pt-slope form\n pl.plot( xs, ys, 'g-', linewidth = 2.0 )\n pl.legend(['Positive Reads','Friis Model Fit'], loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L213_C8", "label": "hold()", "type": "expression", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "vector": [8, 2, 0.6494, 0.003, 2, 0.53, 0.0, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": " pl.hold( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L216_C8", "label": "xs = linspace()", "type": "assigned_variable", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "vector": [14, 2, 0.6585, 0.003, 2, 0.53, 0.2, 928, 3, 3, 0, 0, 119, 10, 1], "semantic": {"name": "xs", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": " xs = np.linspace( yaml_config['rdr_axis'][0], yaml_config['rdr_axis'][1], 100 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L217_C8", "label": "ys =", "type": "assigned_variable", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "vector": [14, 2, 0.6616, 0.003, 2, 0.53, 0.4, 578, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ys = 0.75 * ( xs - xval ) + yval # pt-slope form"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L218_C8", "label": "plot()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "vector": [8, 2, 0.6646, 0.003, 2, 0.53, 0.6, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot( xs, ys, 'g-', linewidth = 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L219_C8", "label": "legend()", "type": "expression", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "vector": [8, 2, 0.6677, 0.003, 2, 0.53, 0.8, 880, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pl.legend(['Positive Reads','Friis Model Fit'], loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L221_C8", "label": "legend()", "type": "expression", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "vector": [8, 2, 0.6738, 0.003, 2, 0.53, 1.0, 880, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pl.legend(['Positive Reads'], loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L224_C4", "label": "axis()", "type": "expression", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [8, 1, 0.6829, 0.003, 1, 0.61, 0.9167, 860, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axis", "arg_names": [], "import_names": [], "rhs_call_name": "axis", "annotation": ""}, "snippet": " pl.axis( yaml_config['rdr_axis'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L225_C4", "label": "return", "type": "return", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "vector": [13, 1, 0.686, 0.003, 1, 0.61, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L227_C0", "label": "plot_pincrdr()", "type": "expression", "loc": [227, 227], "level": 0, "parent": null, "vector": [8, 0, 0.6921, 0.003, 0, 0.66, 0.8056, 13, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "plot_pincrdr", "arg_names": [], "import_names": [], "rhs_call_name": "plot_pincrdr", "annotation": ""}, "snippet": "plot_pincrdr()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L228_C0", "label": "savefig()", "type": "expression", "loc": [228, 228], "level": 0, "parent": null, "vector": [8, 0, 0.6951, 0.003, 0, 0.66, 0.8333, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_pincrdr.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "label": "plot_pincrdr_probs", "type": "function", "loc": [232, 266], "level": 0, "parent": null, "vector": [2, 0, 0.7591, 0.1067, 0, 0.66, 0.8611, 878, 0, 1, 1, 0, 0, 0, 19], "semantic": {"name": "plot_pincrdr_probs", "arg_names": ["f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_pincrdr_probs( f = None ):\n hist, bins = np.histogram( p_inc_rdr,\n bins = yaml_config['rdr_histbins']['bins'],\n range = (yaml_config['rdr_histbins']['min'],\n yaml_config['rdr_histbins']['max']) )\n bin_width = bins[1] - bins[0]\n # Find out which bin each read belongs to.\n # Sanity check: print [ sum( bins_ind == i ) for i in xrange(len(hist)) ] => equals hist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L233_C4", "label": "hist, bins = histogram()", "type": "assigned_variable", "loc": [233, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [14, 1, 0.7149, 0.0122, 1, 0.72, 0.0, 932, 3, 3, 0, 0, 428, 10, 1], "semantic": {"name": "hist, bins", "arg_names": [], "import_names": [], "rhs_call_name": "histogram", "annotation": ""}, "snippet": " hist, bins = np.histogram( p_inc_rdr,\n bins = yaml_config['rdr_histbins']['bins'],\n range = (yaml_config['rdr_histbins']['min'],\n yaml_config['rdr_histbins']['max']) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L237_C4", "label": "bin_width =", "type": "assigned_variable", "loc": [237, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [14, 1, 0.7226, 0.003, 1, 0.72, 0.0714, 331, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bin_width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bin_width = bins[1] - bins[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L240_C4", "label": "bins_ind =", "type": "assigned_variable", "loc": [240, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [14, 1, 0.7317, 0.003, 1, 0.72, 0.1429, 421, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bins_ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bins_ind = np.sum( p_inc_rdr[:,np.newaxis] > bins[:-1], axis = 1 ) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L241_C4", "label": "prob_read =", "type": "assigned_variable", "loc": [241, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [14, 1, 0.7378, 0.0091, 1, 0.72, 0.2143, 326, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "prob_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prob_read = [ sum(rssi[bins_ind == i] != -1)*1.0 / hist[i] # positive reads / total reads for bin i\n for i in xrange(len(hist)) # same as len(bins)-1\n if hist[i] != 0 ] # only where we have data! (also prevents div by 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L245_C4", "label": "if", "type": "if", "loc": [245, 246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [4, 1, 0.7485, 0.0061, 1, 0.72, 0.2857, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not f:\n f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L246_C8", "label": "f = figure()", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L245_C4", "vector": [14, 2, 0.75, 0.003, 2, 0.11, 0.0, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L247_C4", "label": "axes()", "type": "expression", "loc": [247, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [8, 1, 0.753, 0.003, 1, 0.72, 0.3571, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": " pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L248_C4", "label": "pos_bars = bar()", "type": "assigned_variable", "loc": [248, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [14, 1, 0.7622, 0.0152, 1, 0.72, 0.4286, 636, 3, 5, 0, 0, 300, 10, 3], "semantic": {"name": "pos_bars", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": " pos_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!\n prob_read, # This is only defined for ones that have data!\n width = bin_width,\n color = 'b',\n alpha = 0.7 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L253_C4", "label": "hold()", "type": "expression", "loc": [253, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [8, 1, 0.7713, 0.003, 1, 0.72, 0.5, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": " pl.hold( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L254_C4", "label": "neg_bars = bar()", "type": "assigned_variable", "loc": [254, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [14, 1, 0.782, 0.0183, 1, 0.72, 0.5714, 183, 3, 6, 0, 0, 300, 10, 3], "semantic": {"name": "neg_bars", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": " neg_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!\n [ 1.0 - p for p in prob_read ], # This is only defined for ones that have data!\n width = bin_width,\n bottom = prob_read,\n color = 'r',\n alpha = 0.7 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L260_C4", "label": "axis()", "type": "expression", "loc": [260, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [8, 1, 0.7927, 0.003, 1, 0.72, 0.6429, 860, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axis", "arg_names": [], "import_names": [], "rhs_call_name": "axis", "annotation": ""}, "snippet": " pl.axis([ yaml_config['rdr_axis'][0], yaml_config['rdr_axis'][1], 0.0, 1.0 ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L261_C4", "label": "xlabel()", "type": "expression", "loc": [261, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [8, 1, 0.7957, 0.003, 1, 0.72, 0.7143, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": " pl.xlabel( '$P^{inc}_{rdr}$ (dBm)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L262_C4", "label": "ylabel()", "type": "expression", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [8, 1, 0.7988, 0.003, 1, 0.72, 0.7857, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": " pl.ylabel( 'Probability of Tag Read / No-Read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L263_C4", "label": "title()", "type": "expression", "loc": [263, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [8, 1, 0.8018, 0.003, 1, 0.72, 0.8571, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " pl.title( 'Probability of Tag Read / No-Read vs Predicted Power at Reader ' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L264_C4", "label": "legend()", "type": "expression", "loc": [264, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [8, 1, 0.8049, 0.003, 1, 0.72, 0.9286, 880, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pl.legend((pos_bars[0], neg_bars[0]), ('P( read )', 'P( no read )'), loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L266_C4", "label": "return", "type": "return", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "vector": [13, 1, 0.811, 0.003, 1, 0.72, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L268_C0", "label": "plot_pincrdr_probs()", "type": "expression", "loc": [268, 268], "level": 0, "parent": null, "vector": [8, 0, 0.8171, 0.003, 0, 0.66, 0.8889, 878, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "plot_pincrdr_probs", "arg_names": [], "import_names": [], "rhs_call_name": "plot_pincrdr_probs", "annotation": ""}, "snippet": "plot_pincrdr_probs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L269_C0", "label": "savefig()", "type": "expression", "loc": [269, 269], "level": 0, "parent": null, "vector": [8, 0, 0.8201, 0.003, 0, 0.66, 0.9167, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig( yaml_config['outimage'] + '_pincrdr_probs.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "label": "plot_pinctag_probs", "type": "function", "loc": [275, 319], "level": 0, "parent": null, "vector": [2, 0, 0.9055, 0.1372, 0, 0.66, 0.9444, 993, 0, 1, 0, 0, 0, 0, 29], "semantic": {"name": "plot_pinctag_probs", "arg_names": ["f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_pinctag_probs( f = None ):\n pl.figure( figsize=(10,6) )\n pl.axes([0.1,0.1,0.65,0.8])\n pl.plot( p_inc_tag[pos_mask], rssi[pos_mask], 'bx', alpha = 0.5 )\n pl.xlabel( '$P^{inc}_{tag}$ (dBm)')\n pl.ylabel( 'RSSI')\n pl.title( 'Measured RSSI vs Predicted Power at Tag' )\n pl.legend(['Positive Reads'], loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L276_C4", "label": "figure()", "type": "expression", "loc": [276, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8415, 0.003, 1, 0.61, 0.0, 789, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "figure", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L277_C4", "label": "axes()", "type": "expression", "loc": [277, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8445, 0.003, 1, 0.61, 0.0435, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": " pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L278_C4", "label": "plot()", "type": "expression", "loc": [278, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8476, 0.003, 1, 0.61, 0.087, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot( p_inc_tag[pos_mask], rssi[pos_mask], 'bx', alpha = 0.5 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L279_C4", "label": "xlabel()", "type": "expression", "loc": [279, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8506, 0.003, 1, 0.61, 0.1304, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": " pl.xlabel( '$P^{inc}_{tag}$ (dBm)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L280_C4", "label": "ylabel()", "type": "expression", "loc": [280, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8537, 0.003, 1, 0.61, 0.1739, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": " pl.ylabel( 'RSSI')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L281_C4", "label": "title()", "type": "expression", "loc": [281, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8567, 0.003, 1, 0.61, 0.2174, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " pl.title( 'Measured RSSI vs Predicted Power at Tag' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L282_C4", "label": "legend()", "type": "expression", "loc": [282, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8598, 0.003, 1, 0.61, 0.2609, 880, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pl.legend(['Positive Reads'], loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L283_C4", "label": "axis()", "type": "expression", "loc": [283, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8628, 0.003, 1, 0.61, 0.3043, 860, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axis", "arg_names": [], "import_names": [], "rhs_call_name": "axis", "annotation": ""}, "snippet": " pl.axis( yaml_config['tag_axis'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L284_C4", "label": "savefig()", "type": "expression", "loc": [284, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.8659, 0.003, 1, 0.61, 0.3478, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " pl.savefig( yaml_config['outimage'] + '_pinctag.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L286_C4", "label": "hist, bins = histogram()", "type": "assigned_variable", "loc": [286, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [14, 1, 0.8765, 0.0122, 1, 0.61, 0.3913, 932, 3, 3, 0, 0, 428, 10, 1], "semantic": {"name": "hist, bins", "arg_names": [], "import_names": [], "rhs_call_name": "histogram", "annotation": ""}, "snippet": " hist, bins = np.histogram( p_inc_tag,\n bins = yaml_config['tag_histbins']['bins'],\n range = (yaml_config['tag_histbins']['min'],\n yaml_config['tag_histbins']['max']) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L290_C4", "label": "bin_width =", "type": "assigned_variable", "loc": [290, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [14, 1, 0.8841, 0.003, 1, 0.61, 0.4348, 331, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bin_width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bin_width = bins[1] - bins[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L293_C4", "label": "bins_ind =", "type": "assigned_variable", "loc": [293, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [14, 1, 0.8933, 0.003, 1, 0.61, 0.4783, 421, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bins_ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bins_ind = np.sum( p_inc_tag[:,np.newaxis] > bins[:-1], axis = 1 ) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L294_C4", "label": "prob_read =", "type": "assigned_variable", "loc": [294, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [14, 1, 0.8994, 0.0091, 1, 0.61, 0.5217, 326, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "prob_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prob_read = [ sum(rssi[bins_ind == i] != -1)*1.0 / hist[i] # positive reads / total reads for bin i\n for i in xrange(len(hist)) # same as len(bins)-1\n if hist[i] != 0 ] # only where we have data! (also prevents div by 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L298_C4", "label": "if", "type": "if", "loc": [298, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [4, 1, 0.9101, 0.0061, 1, 0.61, 0.5652, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not f:\n f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L299_C8", "label": "f = figure()", "type": "assigned_variable", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L298_C4", "vector": [14, 2, 0.9116, 0.003, 2, 0.58, 0.0, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " f = pl.figure( figsize=(10,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L300_C4", "label": "axes()", "type": "expression", "loc": [300, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.9146, 0.003, 1, 0.61, 0.6087, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": " pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L301_C4", "label": "pos_bars = bar()", "type": "assigned_variable", "loc": [301, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [14, 1, 0.9238, 0.0152, 1, 0.61, 0.6522, 636, 3, 5, 0, 0, 300, 10, 3], "semantic": {"name": "pos_bars", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": " pos_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!\n prob_read, # This is only defined for ones that have data!\n width = bin_width,\n color = 'b',\n alpha = 0.7 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L306_C4", "label": "hold()", "type": "expression", "loc": [306, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.9329, 0.003, 1, 0.61, 0.6957, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": " pl.hold( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L307_C4", "label": "neg_bars = bar()", "type": "assigned_variable", "loc": [307, 312], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [14, 1, 0.9436, 0.0183, 1, 0.61, 0.7391, 183, 3, 6, 0, 0, 300, 10, 3], "semantic": {"name": "neg_bars", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": " neg_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!\n [ 1.0 - p for p in prob_read ], # This is only defined for ones that have data!\n width = bin_width,\n bottom = prob_read,\n color = 'r',\n alpha = 0.7)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L313_C4", "label": "axis()", "type": "expression", "loc": [313, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.9543, 0.003, 1, 0.61, 0.7826, 860, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axis", "arg_names": [], "import_names": [], "rhs_call_name": "axis", "annotation": ""}, "snippet": " pl.axis([ yaml_config['tag_axis'][0], yaml_config['tag_axis'][1], 0.0, 1.0 ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L314_C4", "label": "xlabel()", "type": "expression", "loc": [314, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.9573, 0.003, 1, 0.61, 0.8261, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": " pl.xlabel( '$P^{inc}_{tag}$ (dBm)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L315_C4", "label": "ylabel()", "type": "expression", "loc": [315, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.9604, 0.003, 1, 0.61, 0.8696, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": " pl.ylabel( 'Probability of Tag Read / No-Read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L316_C4", "label": "title()", "type": "expression", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.9634, 0.003, 1, 0.61, 0.913, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " pl.title( 'Probability of Tag Read / No-Read vs Predicted Power at Tag' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L317_C4", "label": "legend()", "type": "expression", "loc": [317, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.9665, 0.003, 1, 0.61, 0.9565, 880, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pl.legend((pos_bars[0], neg_bars[0]), ('P( read )', 'P( no read )'), loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L319_C4", "label": "savefig()", "type": "expression", "loc": [319, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "vector": [8, 1, 0.9726, 0.003, 1, 0.61, 1.0, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " pl.savefig( yaml_config['outimage'] + '_pinctag_probs.png' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L322_C0", "label": "plot_pinctag_probs()", "type": "expression", "loc": [322, 322], "level": 0, "parent": null, "vector": [8, 0, 0.9817, 0.003, 0, 0.66, 0.9722, 993, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "plot_pinctag_probs", "arg_names": [], "import_names": [], "rhs_call_name": "plot_pinctag_probs", "annotation": ""}, "snippet": "plot_pinctag_probs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L327_C0", "label": "if", "type": "if", "loc": [327, 328], "level": 0, "parent": null, "vector": [4, 0, 0.9985, 0.0061, 0, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if PLOT:\n pl.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L328_C4", "label": "show()", "type": "expression", "loc": [328, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L327_C0", "vector": [8, 1, 1.0, 0.003, 1, 0.72, 0.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " pl.show()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:For_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:For_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Return_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L293_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Assign_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99410:If_L327_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99410:Expr_L328_C4"}] |
#!/usr/bin/python
import roslib
roslib.load_manifest( 'tf' )
roslib.load_manifest( 'hrl_lib' )
import rospy
import tf
from hrl_lib.cmd_process import CmdProcess
from threading import Thread
import time
def bagplay( fname ):
# to use:
# bp = bagplay( my_file_name )
# bp.run() # starts the execution
# while not bp.is_finished():
# rospy.sleep( 0.5 )
# bp.kill() # not necessary
cmd = 'rosbag play --clock ' + fname + ' -r 2.0 -q'
rospy.logout( 'Launching bag file: %s' % fname )
return CmdProcess( cmd.split() )
def sim_safe_sleep( dur, real_time_sleep = 0.05 ):
t0 = rospy.Time.now().to_sec()
ct = rospy.Time.now().to_sec()
while True:
if ct - t0 >= dur:
break
time.sleep( real_time_sleep )
nt = rospy.Time.now().to_sec()
if nt == ct: # rostime will stop when bag not playing -- exit immediately.
break
ct = nt
return
class TFthread( Thread ):
# Takes in a (PoseStamped-like) dictionary and publishes a new transform from frame_id -> frame_name
# For example: (YAML syntax)
# child_frame: '/datacap'
# parent_frame: '/map'
# x_pos: 6.480
# y_pos: 2.865
# z_pos: 1.291
# x_orient: 0.0
# y_orient: 0.0
# z_orient: 0.0
# w_orient: 1.0
def __init__( self, d ):
self.d = d
Thread.__init__( self )
# cf = self.d[ 'child_frame' ]
# rospy.init_node( 'tf_thread_' + cf.strip('/') )
self.bc = tf.TransformBroadcaster()
self.should_run = True
self.start()
def run( self ):
rospy.logout( 'TFthread: Starting %s ' % self.d[ 'child_frame' ] )
while self.should_run and not rospy.is_shutdown():
self.bc.sendTransform( ( self.d[ 'x_pos' ],
self.d[ 'y_pos' ],
self.d[ 'z_pos' ] ),
( self.d[ 'x_orient' ],
self.d[ 'y_orient' ],
self.d[ 'z_orient' ],
self.d[ 'w_orient' ] ),
rospy.Time.now(),
self.d[ 'child_frame' ],
self.d[ 'parent_frame' ] )
try:
sim_safe_sleep( 0.10 ) # 10 Hz
except:
pass # ROS exception (eg. Ctrl-C).
rospy.logout( 'TFthread: Stopping %s ' % self.d[ 'child_frame' ] )
def stop( self ):
# Kill off the poller thread.
self.should_run = False
self.join(5)
if (self.isAlive()):
raise RuntimeError('TFthread: Unable to stop thread %s ' % self.d[ 'child_frame' ] )
| ajibawa-2023/Python-Code-Large/train/row_99411 | 40 | 93 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0108, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.043, 0.0108, 0, 0.66, 0.1, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'tf' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0538, 0.0108, 0, 0.66, 0.2, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'hrl_lib' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Import_L6_C0", "label": "rospy import rospy", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0108, 0, 0.66, 0.3, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Import_L8_C0", "label": "tf import tf", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.086, 0.0108, 0, 0.66, 0.4, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:ImportFrom_L9_C0", "label": "from hrl_lib.cmd_process import CmdProcess", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0968, 0.0108, 0, 0.66, 0.5, 659, 0, 1, 0, 0, 659, 0, 0], "semantic": {"name": "hrl_lib.cmd_process", "arg_names": [], "import_names": ["CmdProcess"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_lib.cmd_process import CmdProcess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:ImportFrom_L11_C0", "label": "from threading import Thread", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1183, 0.0108, 0, 0.66, 0.6, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Import_L12_C0", "label": "time import time", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.129, 0.0108, 0, 0.66, 0.7, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L15_C0", "label": "bagplay", "type": "function", "loc": [15, 24], "level": 0, "parent": null, "vector": [2, 0, 0.2097, 0.1075, 0, 0.66, 0.8, 603, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "bagplay", "arg_names": ["fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bagplay( fname ):\n # to use:\n # bp = bagplay( my_file_name )\n # bp.run() # starts the execution\n # while not bp.is_finished():\n # rospy.sleep( 0.5 )\n # bp.kill() # not necessary\n cmd = 'rosbag play --clock ' + fname + ' -r 2.0 -q'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L22_C4", "label": "cmd =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L15_C0", "vector": [14, 1, 0.2366, 0.0108, 1, 0.39, 0.0, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = 'rosbag play --clock ' + fname + ' -r 2.0 -q'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L23_C4", "label": "logout()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L15_C0", "vector": [8, 1, 0.2473, 0.0108, 1, 0.39, 0.5, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Launching bag file: %s' % fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Return_L24_C4", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L15_C0", "vector": [13, 1, 0.2581, 0.0108, 1, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return CmdProcess( cmd.split() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "label": "sim_safe_sleep", "type": "function", "loc": [27, 41], "level": 0, "parent": null, "vector": [2, 0, 0.3656, 0.1613, 0, 0.66, 0.9, 35, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "sim_safe_sleep", "arg_names": ["dur", "real_time_sleep"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sim_safe_sleep( dur, real_time_sleep = 0.05 ):\n t0 = rospy.Time.now().to_sec()\n ct = rospy.Time.now().to_sec()\n while True:\n if ct - t0 >= dur:\n break\n\n time.sleep( real_time_sleep )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L28_C4", "label": "t0 = to_sec()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "vector": [14, 1, 0.3011, 0.0108, 1, 0.39, 0.0, 573, 3, 0, 0, 0, 750, 10, 2], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " t0 = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L29_C4", "label": "ct = to_sec()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "vector": [14, 1, 0.3118, 0.0108, 1, 0.39, 0.3333, 147, 3, 0, 0, 0, 750, 10, 2], "semantic": {"name": "ct", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " ct = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "label": "while", "type": "while", "loc": [30, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "vector": [5, 1, 0.3763, 0.1183, 1, 0.39, 0.6667, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if ct - t0 >= dur:\n break\n\n time.sleep( real_time_sleep )\n nt = rospy.Time.now().to_sec()\n\n if nt == ct: # rostime will stop when bag not playing -- exit immediately."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:If_L31_C8", "label": "if", "type": "if", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "vector": [4, 2, 0.3387, 0.0215, 2, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ct - t0 >= dur:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L34_C8", "label": "sleep()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "vector": [8, 2, 0.3656, 0.0108, 2, 0.33, 0.25, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( real_time_sleep )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L35_C8", "label": "nt = to_sec()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "vector": [14, 2, 0.3763, 0.0108, 2, 0.33, 0.5, 96, 3, 0, 0, 0, 750, 10, 2], "semantic": {"name": "nt", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " nt = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:If_L37_C8", "label": "if", "type": "if", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "vector": [4, 2, 0.4032, 0.0215, 2, 0.33, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nt == ct: # rostime will stop when bag not playing -- exit immediately.\n break "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L40_C8", "label": "ct =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "vector": [14, 2, 0.4301, 0.0108, 2, 0.33, 1.0, 147, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ct = nt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Return_L41_C4", "label": "return", "type": "return", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "vector": [13, 1, 0.4409, 0.0108, 1, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:ClassDef_L43_C0", "label": "TFthread", "type": "class", "loc": [43, 93], "level": 0, "parent": null, "vector": [3, 0, 0.7312, 0.5484, 0, 0.66, 1.0, 93, 0, 3, 0, 0, 134, 0, 12], "semantic": {"name": "TFthread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TFthread( Thread ):\n # Takes in a (PoseStamped-like) dictionary and publishes a new transform from frame_id -> frame_name\n # For example: (YAML syntax)\n # child_frame: '/datacap'\n # parent_frame: '/map'\n # x_pos: 6.480\n # y_pos: 2.865\n # z_pos: 1.291"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "label": "__init__", "type": "function", "loc": [56, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:ClassDef_L43_C0", "vector": [2, 1, 0.6559, 0.1183, 1, 0.11, 0.0, 555, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, d ):\n self.d = d\n Thread.__init__( self )\n \n # cf = self.d[ 'child_frame' ]\n # rospy.init_node( 'tf_thread_' + cf.strip('/') )\n\n self.bc = tf.TransformBroadcaster()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L57_C8", "label": "self.d =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "vector": [14, 2, 0.6129, 0.0108, 2, 0.99, 0.0, 745, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.d = d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L58_C8", "label": "__init__()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "vector": [8, 2, 0.6237, 0.0108, 2, 0.99, 0.25, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Thread.__init__( self )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L63_C8", "label": "self.bc = TransformBroadcaster()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "vector": [14, 2, 0.6774, 0.0108, 2, 0.99, 0.5, 0, 3, 0, 0, 0, 986, 10, 1], "semantic": {"name": "self.bc", "arg_names": [], "import_names": [], "rhs_call_name": "TransformBroadcaster", "annotation": ""}, "snippet": " self.bc = tf.TransformBroadcaster()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L65_C8", "label": "self.should_run =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "vector": [14, 2, 0.6989, 0.0108, 2, 0.99, 0.75, 736, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_run", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_run = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L66_C8", "label": "start()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "vector": [8, 2, 0.7097, 0.0108, 2, 0.99, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L68_C4", "label": "run", "type": "function", "loc": [68, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:ClassDef_L43_C0", "vector": [2, 1, 0.828, 0.2043, 1, 0.11, 0.5, 679, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run( self ):\n rospy.logout( 'TFthread: Starting %s ' % self.d[ 'child_frame' ] )\n while self.should_run and not rospy.is_shutdown():\n self.bc.sendTransform( ( self.d[ 'x_pos' ],\n self.d[ 'y_pos' ],\n self.d[ 'z_pos' ] ),\n ( self.d[ 'x_orient' ],\n self.d[ 'y_orient' ],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L69_C8", "label": "logout()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L68_C4", "vector": [8, 2, 0.7419, 0.0108, 2, 0.08, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'TFthread: Starting %s ' % self.d[ 'child_frame' ] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L70_C8", "label": "while", "type": "while", "loc": [70, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L68_C4", "vector": [5, 2, 0.8333, 0.172, 2, 0.08, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.should_run and not rospy.is_shutdown():\n self.bc.sendTransform( ( self.d[ 'x_pos' ],\n self.d[ 'y_pos' ],\n self.d[ 'z_pos' ] ),\n ( self.d[ 'x_orient' ],\n self.d[ 'y_orient' ],\n self.d[ 'z_orient' ],\n self.d[ 'w_orient' ] ),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L71_C12", "label": "sendTransform()", "type": "expression", "loc": [71, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L70_C8", "vector": [8, 3, 0.8118, 0.1075, 3, 0.44, 0.0, 373, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "sendTransform", "arg_names": [], "import_names": [], "rhs_call_name": "sendTransform", "annotation": ""}, "snippet": " self.bc.sendTransform( ( self.d[ 'x_pos' ],\n self.d[ 'y_pos' ],\n self.d[ 'z_pos' ] ),\n ( self.d[ 'x_orient' ],\n self.d[ 'y_orient' ],\n self.d[ 'z_orient' ],\n self.d[ 'w_orient' ] ),\n rospy.Time.now(),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Try_L82_C12", "label": "try", "type": "try", "loc": [82, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L70_C8", "vector": [7, 3, 0.8978, 0.043, 3, 0.44, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sim_safe_sleep( 0.10 ) # 10 Hz\n except:\n pass # ROS exception (eg. Ctrl-C)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L83_C16", "label": "sim_safe_sleep()", "type": "expression", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:Try_L82_C12", "vector": [8, 4, 0.8925, 0.0108, 4, 0.21, 0.0, 35, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sim_safe_sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sim_safe_sleep", "annotation": ""}, "snippet": " sim_safe_sleep( 0.10 ) # 10 Hz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L86_C8", "label": "logout()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L68_C4", "vector": [8, 2, 0.9247, 0.0108, 2, 0.08, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'TFthread: Stopping %s ' % self.d[ 'child_frame' ] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L88_C4", "label": "stop", "type": "function", "loc": [88, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:ClassDef_L43_C0", "vector": [2, 1, 0.9731, 0.0645, 1, 0.11, 1.0, 343, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop( self ):\n # Kill off the poller thread.\n self.should_run = False\n self.join(5)\n if (self.isAlive()):\n raise RuntimeError('TFthread: Unable to stop thread %s ' % self.d[ 'child_frame' ] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L90_C8", "label": "self.should_run =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L88_C4", "vector": [14, 2, 0.9677, 0.0108, 2, 0.34, 0.0, 736, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_run", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_run = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L91_C8", "label": "join()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L88_C4", "vector": [8, 2, 0.9785, 0.0108, 2, 0.34, 0.5, 933, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " self.join(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99411:If_L92_C8", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L88_C4", "vector": [4, 2, 0.9946, 0.0215, 2, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.isAlive()):\n raise RuntimeError('TFthread: Unable to stop thread %s ' % self.d[ 'child_frame' ] )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Return_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:If_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Return_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:While_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Try_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:Try_L82_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99411:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99411:If_L92_C8"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('geometry_msgs')
roslib.load_manifest('move_base_msgs')
roslib.load_manifest('tf')
roslib.load_manifest('sound_play')
roslib.load_manifest('hrl_lib')
import rospy
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
import tf
import tf.transformations as tft
from geometry_msgs.msg import PoseStamped, Quaternion
from sound_play.msg import SoundRequest
from rfid_datacapture.srv import BagCapture
from sound_play.msg import SoundRequest
from hrl_lib.cmd_process import CmdProcess
import yaml
import numpy as np, math
import os
import time
class BagCap():
def __init__( self, topic_name = 'capture' ):
self._srv = rospy.Service( 'bag_cap/'+topic_name, BagCapture, self.process_srv )
def process_srv( self, req ):
cmd = 'rosbag record -O %s ' % req.dest
cmd += req.topics
if req.topics != '':
self.bag_cap = CmdProcess( cmd.split() )
self.bag_cap.run()
else:
self.bag_cap.kill()
return True
class YAMLproc(smach.State):
def __init__(self, fname):
smach.State.__init__(self,
outcomes=['succeeded', 'aborted'],
output_keys = ['next_move_pose','bagfile_name',
'bagfile_topics','tagid'])
self.fname = fname
self.d = None
def execute(self, userdata):
if not self.d:
f = open( self.fname, 'r' )
self.d = yaml.load( f )
self.size = len( self.d['servo_cap']['captures'] )
self.ind = 0
f.close()
if self.ind < self.size:
rospy.logout( 'YamlProc: issuing %d of %d' % (self.ind+1, self.size))
ps = PoseStamped()
ps.header.frame_id = '/map'
ps.header.stamp = rospy.Time(0)
ps.pose.position.x = self.d['servo_cap']['captures'][ self.ind ][0]
ps.pose.position.y = self.d['servo_cap']['captures'][ self.ind ][1]
ang = self.d['servo_cap']['captures'][ self.ind ][2]
q = Quaternion( *tft.quaternion_from_euler( 0.0, 0.0, math.radians( ang )))
ps.pose.orientation = q
self.ind += 1
userdata.next_move_pose = ps
userdata.tagid = self.d['servo_cap']['tagid']
userdata.bagfile_name = self.d['servo_cap']['bagfile_path'] + str(int(rospy.Time.now().to_sec()))
userdata.bagfile_topics = self.d['servo_cap']['bagfile_topics']
return 'succeeded'
else:
return 'aborted' # done!
class YAMLprocPoses(smach.State):
def __init__(self, fname):
smach.State.__init__(self,
outcomes=['succeeded', 'aborted'],
output_keys = ['next_move_pose'])
self.fname = fname
self.d = None
def execute(self, userdata):
if not self.d:
f = open( self.fname, 'r' )
self.d = yaml.load( f )
self.size = len( self.d['rad_cap']['captures'] )
self.ind = 0
f.close()
self.t0 = rospy.Time.now().to_sec()
if self.ind < self.size:
rospy.logout( 'YamlProcPoses: issuing %d of %d' % (self.ind+1, self.size))
rospy.logout( 'YamlProcPoses: Time to capture %2.2f' % ( rospy.Time.now().to_sec() - self.t0 ))
self.t0 = rospy.Time.now().to_sec()
ps = PoseStamped()
ps.header.frame_id = '/map'
ps.header.stamp = rospy.Time(0)
ps.pose.position.x = self.d['rad_cap']['captures'][ self.ind ][0]
ps.pose.position.y = self.d['rad_cap']['captures'][ self.ind ][1]
ang = self.d['rad_cap']['captures'][ self.ind ][2]
q = Quaternion( *tft.quaternion_from_euler( 0.0, 0.0, math.radians( ang )))
ps.pose.orientation = q
self.ind += 1
userdata.next_move_pose = ps
return 'succeeded'
else:
return 'aborted' # done!
class YAMLprocMultitag(smach.State):
def __init__(self, fname):
smach.State.__init__(self,
outcomes=['succeeded', 'aborted'],
output_keys = ['bagfile_name',
'bagfile_topics',
'tagid',
'panrate',
'tilt_left',
'tilt_right',
'tilt_rate',
'tilt_block'])
self.fname = fname
self.d = None
def execute(self, userdata):
if not self.d:
f = open( self.fname, 'r' )
self.d = yaml.load( f )
self.tagids = self.d['rad_cap']['tagids'].keys()
self.keys_list = list( self.tagids )
f.close()
self.tilt_angs = []
if not self.keys_list and not self.tilt_angs: # Done! reset.
self.keys_list = list( self.tagids )
return 'aborted'
if not self.tilt_angs: # get next tagid
self.tid = self.keys_list.pop()
self.tilt_angs = list( self.d['rad_cap']['tagids'][self.tid]['tilts'] )
rospy.logout( 'setting tid: %s' % self.tid )
print 'Tilt angs: ', self.tilt_angs
ta = self.tilt_angs.pop()[0]
rospy.logout( 'Using tilt angle: %2.2f' % ta )
userdata.tilt_left = -1.0 * ta
userdata.tilt_right = ta
userdata.tilt_rate = 0.4
userdata.tilt_block = 1
tad = math.degrees( ta )
rospy.logout( 'YamlProcMultitag: issuing %d of %d for tag \'%s\'' %
(len(self.tagids) - len(self.keys_list), len(self.tagids), self.tid))
userdata.tagid = self.tid
tmp = self.tid
path = self.d['rad_cap']['bagfile_path']
tsec = str(int(rospy.Time.now().to_sec()))
tads = str(int( tad ))
userdata.bagfile_name = path + tsec + '_' + tads + '_' + tmp.replace(' ', '' )
userdata.bagfile_topics = self.d['rad_cap']['bagfile_topics']
userdata.panrate = 30.0
return 'succeeded'
class ManualSkip(smach.State):
def __init__(self):
smach.State.__init__(self,outcomes=['succeeded', 'aborted'])
self.init = None
def execute(self, userdata):
if not self.init:
self.init = True
self.pub = rospy.Publisher( 'robotsound', SoundRequest )
rospy.sleep( 1.0 )
self.pub.publish( SoundRequest( -3, 1, 'MANUAL or SKIP' ))
ui = ''
while not (ui == '0' or ui == '1'):
print '\'0\' to Position Manually (position robot first)'
print '\'1\' to skip this position'
ui = raw_input()
if ui == '0':
return 'succeeded' # Robot manually positioned
else:
return 'aborted' # Forget this position
class MoveNotify(smach.State):
def __init__(self):
smach.State.__init__(self,outcomes=['succeeded', 'aborted'])
self.init = None
def execute(self, userdata):
if not self.init:
self.init = True
self.pub = rospy.Publisher( 'robotsound', SoundRequest )
rospy.sleep( 1.0 )
self.pub.publish( SoundRequest( -3, 1, 'Ready to Move' ))
ui = ''
while not (ui == '0' or ui == '1'):
print '\'0\' or \'1\' when Ready.'
ui = raw_input()
return 'succeeded'
if __name__ == '__main__':
rospy.init_node( 'bag_capture_services' )
bc = BagCap()
rospy.spin()
# rosservice call /bag_cap/capture '/tf' 'out'
# rosservice call /bag_cap/capture '' ''
| ajibawa-2023/Python-Code-Large/train/row_99412 | 163 | 230 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0087, 0.0043, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.013, 0.0043, 0, 0.66, 0.0357, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0174, 0.0043, 0, 0.66, 0.0714, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('geometry_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0217, 0.0043, 0, 0.66, 0.1071, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('move_base_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0261, 0.0043, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0304, 0.0043, 0, 0.66, 0.1786, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('sound_play')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0348, 0.0043, 0, 0.66, 0.2143, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L9_C0", "label": "rospy import rospy", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0391, 0.0043, 0, 0.66, 0.25, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L11_C0", "label": "smach import smach", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0478, 0.0043, 0, 0.66, 0.2857, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ImportFrom_L12_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0522, 0.0043, 0, 0.66, 0.3214, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L13_C0", "label": "actionlib import actionlib", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0565, 0.0043, 0, 0.66, 0.3571, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L14_C0", "label": "tf import tf", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0609, 0.0043, 0, 0.66, 0.3929, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L15_C0", "label": "tf.transformations import tft", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0652, 0.0043, 0, 0.66, 0.4286, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tft"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tft"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ImportFrom_L17_C0", "label": "from geometry_msgs.msg import PoseStamped, Quaternion", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0739, 0.0043, 0, 0.66, 0.4643, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped", "Quaternion"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped, Quaternion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ImportFrom_L18_C0", "label": "from sound_play.msg import SoundRequest", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0783, 0.0043, 0, 0.66, 0.5, 251, 0, 1, 0, 0, 251, 0, 0], "semantic": {"name": "sound_play.msg", "arg_names": [], "import_names": ["SoundRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sound_play.msg import SoundRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ImportFrom_L19_C0", "label": "from rfid_datacapture.srv import BagCapture", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0826, 0.0043, 0, 0.66, 0.5357, 252, 0, 1, 0, 0, 252, 0, 0], "semantic": {"name": "rfid_datacapture.srv", "arg_names": [], "import_names": ["BagCapture"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_datacapture.srv import BagCapture"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ImportFrom_L20_C0", "label": "from sound_play.msg import SoundRequest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0043, 0, 0.66, 0.5714, 251, 0, 1, 0, 0, 251, 0, 0], "semantic": {"name": "sound_play.msg", "arg_names": [], "import_names": ["SoundRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sound_play.msg import SoundRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ImportFrom_L22_C0", "label": "from hrl_lib.cmd_process import CmdProcess", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0957, 0.0043, 0, 0.66, 0.6071, 659, 0, 1, 0, 0, 659, 0, 0], "semantic": {"name": "hrl_lib.cmd_process", "arg_names": [], "import_names": ["CmdProcess"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_lib.cmd_process import CmdProcess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L24_C0", "label": "yaml import yaml", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1043, 0.0043, 0, 0.66, 0.6429, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L25_C0", "label": "numpy import np, math", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1087, 0.0043, 0, 0.66, 0.6786, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L26_C0", "label": "os import os", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.113, 0.0043, 0, 0.66, 0.7143, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Import_L27_C0", "label": "time import time", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1174, 0.0043, 0, 0.66, 0.75, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L29_C0", "label": "BagCap", "type": "class", "loc": [29, 41], "level": 0, "parent": null, "vector": [3, 0, 0.1522, 0.0565, 0, 0.66, 0.7857, 295, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "BagCap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BagCap():\n def __init__( self, topic_name = 'capture' ):\n self._srv = rospy.Service( 'bag_cap/'+topic_name, BagCapture, self.process_srv )\n\n def process_srv( self, req ):\n cmd = 'rosbag record -O %s ' % req.dest\n cmd += req.topics\n if req.topics != '':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L30_C4", "label": "__init__", "type": "function", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L29_C0", "vector": [2, 1, 0.1326, 0.0087, 1, 0.66, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "topic_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, topic_name = 'capture' ):\n self._srv = rospy.Service( 'bag_cap/'+topic_name, BagCapture, self.process_srv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L31_C8", "label": "self._srv = Service()", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L30_C4", "vector": [14, 2, 0.1348, 0.0043, 2, 0.92, 0.0, 225, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._srv", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._srv = rospy.Service( 'bag_cap/'+topic_name, BagCapture, self.process_srv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L33_C4", "label": "process_srv", "type": "function", "loc": [33, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L29_C0", "vector": [2, 1, 0.1609, 0.0391, 1, 0.66, 1.0, 570, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "process_srv", "arg_names": ["self", "req"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_srv( self, req ):\n cmd = 'rosbag record -O %s ' % req.dest\n cmd += req.topics\n if req.topics != '':\n self.bag_cap = CmdProcess( cmd.split() )\n self.bag_cap.run()\n else:\n self.bag_cap.kill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L34_C8", "label": "cmd =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L33_C4", "vector": [14, 2, 0.1478, 0.0043, 2, 0.08, 0.0, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = 'rosbag record -O %s ' % req.dest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L36_C8", "label": "if", "type": "if", "loc": [36, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L33_C4", "vector": [4, 2, 0.1652, 0.0217, 2, 0.08, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if req.topics != '':\n self.bag_cap = CmdProcess( cmd.split() )\n self.bag_cap.run()\n else:\n self.bag_cap.kill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L37_C12", "label": "self.bag_cap = CmdProcess()", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L36_C8", "vector": [14, 3, 0.1609, 0.0043, 3, 0.67, 0.0, 563, 3, 1, 0, 0, 248, 10, 2], "semantic": {"name": "self.bag_cap", "arg_names": [], "import_names": [], "rhs_call_name": "CmdProcess", "annotation": ""}, "snippet": " self.bag_cap = CmdProcess( cmd.split() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L38_C12", "label": "run()", "type": "expression", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L36_C8", "vector": [8, 3, 0.1652, 0.0043, 3, 0.67, 0.5, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " self.bag_cap.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L40_C12", "label": "kill()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L36_C8", "vector": [8, 3, 0.1739, 0.0043, 3, 0.67, 1.0, 173, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "kill", "arg_names": [], "import_names": [], "rhs_call_name": "kill", "annotation": ""}, "snippet": " self.bag_cap.kill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L33_C4", "vector": [13, 2, 0.1783, 0.0043, 2, 0.08, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L44_C0", "label": "YAMLproc", "type": "class", "loc": [44, 81], "level": 0, "parent": null, "vector": [3, 0, 0.2717, 0.1652, 0, 0.66, 0.8214, 218, 0, 2, 0, 0, 892, 0, 15], "semantic": {"name": "YAMLproc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class YAMLproc(smach.State):\n def __init__(self, fname):\n smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['next_move_pose','bagfile_name',\n 'bagfile_topics','tagid'])\n self.fname = fname\n self.d = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L45_C4", "label": "__init__", "type": "function", "loc": [45, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L44_C0", "vector": [2, 1, 0.2087, 0.0304, 1, 0.34, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, fname):\n smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['next_move_pose','bagfile_name',\n 'bagfile_topics','tagid'])\n self.fname = fname\n self.d = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L46_C8", "label": "__init__()", "type": "expression", "loc": [46, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L45_C4", "vector": [8, 2, 0.2065, 0.0174, 2, 0.65, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['next_move_pose','bagfile_name',\n 'bagfile_topics','tagid'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L50_C8", "label": "self.fname =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L45_C4", "vector": [14, 2, 0.2174, 0.0043, 2, 0.65, 0.5, 935, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.fname = fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L51_C8", "label": "self.d =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L45_C4", "vector": [14, 2, 0.2217, 0.0043, 2, 0.65, 1.0, 745, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.d = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L53_C4", "label": "execute", "type": "function", "loc": [53, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L44_C0", "vector": [2, 1, 0.2913, 0.1261, 1, 0.34, 1.0, 569, 0, 2, 1, 0, 0, 0, 14], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n if not self.d:\n f = open( self.fname, 'r' )\n self.d = yaml.load( f )\n self.size = len( self.d['servo_cap']['captures'] ) \n self.ind = 0\n f.close()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "label": "if", "type": "if", "loc": [54, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L53_C4", "vector": [4, 2, 0.2457, 0.0261, 2, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.d:\n f = open( self.fname, 'r' )\n self.d = yaml.load( f )\n self.size = len( self.d['servo_cap']['captures'] ) \n self.ind = 0\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L55_C12", "label": "f = open()", "type": "assigned_variable", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "vector": [14, 3, 0.2391, 0.0043, 3, 0.59, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( self.fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L56_C12", "label": "self.d = load()", "type": "assigned_variable", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "vector": [14, 3, 0.2435, 0.0043, 3, 0.59, 0.25, 745, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "self.d", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " self.d = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L57_C12", "label": "self.size = len()", "type": "assigned_variable", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "vector": [14, 3, 0.2478, 0.0043, 3, 0.59, 0.5, 183, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.size", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.size = len( self.d['servo_cap']['captures'] ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L58_C12", "label": "self.ind =", "type": "assigned_variable", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "vector": [14, 3, 0.2522, 0.0043, 3, 0.59, 0.75, 616, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ind = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L59_C12", "label": "close()", "type": "expression", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "vector": [8, 3, 0.2565, 0.0043, 3, 0.59, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "label": "if", "type": "if", "loc": [61, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L53_C4", "vector": [4, 2, 0.3087, 0.0913, 2, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ind < self.size:\n rospy.logout( 'YamlProc: issuing %d of %d' % (self.ind+1, self.size))\n ps = PoseStamped()\n ps.header.frame_id = '/map'\n ps.header.stamp = rospy.Time(0)\n\n ps.pose.position.x = self.d['servo_cap']['captures'][ self.ind ][0]\n ps.pose.position.y = self.d['servo_cap']['captures'][ self.ind ][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L62_C12", "label": "logout()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [8, 3, 0.2696, 0.0043, 3, 0.52, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'YamlProc: issuing %d of %d' % (self.ind+1, self.size))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L63_C12", "label": "ps = PoseStamped()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.2739, 0.0043, 3, 0.52, 0.0714, 232, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " ps = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L64_C12", "label": "ps.header.frame_id =", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.2783, 0.0043, 3, 0.52, 0.1429, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ps.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.header.frame_id = '/map'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L65_C12", "label": "ps.header.stamp = Time()", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.2826, 0.0043, 3, 0.52, 0.2143, 161, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "ps.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " ps.header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L67_C12", "label": "ps.pose.position.x =", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.2913, 0.0043, 3, 0.52, 0.2857, 782, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps.pose.position.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.pose.position.x = self.d['servo_cap']['captures'][ self.ind ][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L68_C12", "label": "ps.pose.position.y =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.2957, 0.0043, 3, 0.52, 0.3571, 661, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps.pose.position.y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.pose.position.y = self.d['servo_cap']['captures'][ self.ind ][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L69_C12", "label": "ang =", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.3, 0.0043, 3, 0.52, 0.4286, 762, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ang = self.d['servo_cap']['captures'][ self.ind ][2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L70_C12", "label": "q = Quaternion()", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.3043, 0.0043, 3, 0.52, 0.5, 516, 3, 1, 0, 0, 747, 10, 3], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "Quaternion", "annotation": ""}, "snippet": " q = Quaternion( *tft.quaternion_from_euler( 0.0, 0.0, math.radians( ang )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L71_C12", "label": "ps.pose.orientation =", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.3087, 0.0043, 3, 0.52, 0.5714, 670, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps.pose.orientation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.pose.orientation = q"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L75_C12", "label": "userdata.next_move_pose =", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.3261, 0.0043, 3, 0.52, 0.6429, 680, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.next_move_pose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.next_move_pose = ps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L76_C12", "label": "userdata.tagid =", "type": "assigned_variable", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.3304, 0.0043, 3, 0.52, 0.7143, 515, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.tagid = self.d['servo_cap']['tagid']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L77_C12", "label": "userdata.bagfile_name =", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.3348, 0.0043, 3, 0.52, 0.7857, 592, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "userdata.bagfile_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.bagfile_name = self.d['servo_cap']['bagfile_path'] + str(int(rospy.Time.now().to_sec()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L78_C12", "label": "userdata.bagfile_topics =", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [14, 3, 0.3391, 0.0043, 3, 0.52, 0.8571, 96, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.bagfile_topics", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.bagfile_topics = self.d['servo_cap']['bagfile_topics']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L79_C12", "label": "return", "type": "return", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [13, 3, 0.3435, 0.0043, 3, 0.52, 0.9286, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L81_C12", "label": "return", "type": "return", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "vector": [13, 3, 0.3522, 0.0043, 3, 0.52, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'aborted' # done!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L84_C0", "label": "YAMLprocPoses", "type": "class", "loc": [84, 120], "level": 0, "parent": null, "vector": [3, 0, 0.4435, 0.1609, 0, 0.66, 0.8571, 555, 0, 2, 0, 0, 892, 0, 18], "semantic": {"name": "YAMLprocPoses", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class YAMLprocPoses(smach.State):\n def __init__(self, fname):\n smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['next_move_pose'])\n self.fname = fname\n self.d = None\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L85_C4", "label": "__init__", "type": "function", "loc": [85, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L84_C0", "vector": [2, 1, 0.3804, 0.0261, 1, 0.15, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, fname):\n smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['next_move_pose'])\n self.fname = fname\n self.d = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L86_C8", "label": "__init__()", "type": "expression", "loc": [86, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L85_C4", "vector": [8, 2, 0.3783, 0.013, 2, 0.13, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['next_move_pose'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L89_C8", "label": "self.fname =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L85_C4", "vector": [14, 2, 0.387, 0.0043, 2, 0.13, 0.5, 935, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.fname = fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L90_C8", "label": "self.d =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L85_C4", "vector": [14, 2, 0.3913, 0.0043, 2, 0.13, 1.0, 745, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.d = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L92_C4", "label": "execute", "type": "function", "loc": [92, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L84_C0", "vector": [2, 1, 0.4609, 0.1261, 1, 0.15, 1.0, 569, 0, 2, 1, 0, 0, 0, 17], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n if not self.d:\n f = open( self.fname, 'r' )\n self.d = yaml.load( f )\n self.size = len( self.d['rad_cap']['captures'] ) \n self.ind = 0\n f.close()\n self.t0 = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "label": "if", "type": "if", "loc": [93, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L92_C4", "vector": [4, 2, 0.4174, 0.0304, 2, 0.83, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.d:\n f = open( self.fname, 'r' )\n self.d = yaml.load( f )\n self.size = len( self.d['rad_cap']['captures'] ) \n self.ind = 0\n f.close()\n self.t0 = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L94_C12", "label": "f = open()", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "vector": [14, 3, 0.4087, 0.0043, 3, 0.71, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( self.fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L95_C12", "label": "self.d = load()", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "vector": [14, 3, 0.413, 0.0043, 3, 0.71, 0.2, 745, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "self.d", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " self.d = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L96_C12", "label": "self.size = len()", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "vector": [14, 3, 0.4174, 0.0043, 3, 0.71, 0.4, 183, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.size", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.size = len( self.d['rad_cap']['captures'] ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L97_C12", "label": "self.ind =", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "vector": [14, 3, 0.4217, 0.0043, 3, 0.71, 0.6, 616, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ind = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L98_C12", "label": "close()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "vector": [8, 3, 0.4261, 0.0043, 3, 0.71, 0.8, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L99_C12", "label": "self.t0 = to_sec()", "type": "assigned_variable", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "vector": [14, 3, 0.4304, 0.0043, 3, 0.71, 1.0, 533, 3, 0, 0, 0, 750, 10, 2], "semantic": {"name": "self.t0", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " self.t0 = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "label": "if", "type": "if", "loc": [101, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L92_C4", "vector": [4, 2, 0.4804, 0.087, 2, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ind < self.size:\n rospy.logout( 'YamlProcPoses: issuing %d of %d' % (self.ind+1, self.size))\n rospy.logout( 'YamlProcPoses: Time to capture %2.2f' % ( rospy.Time.now().to_sec() - self.t0 ))\n self.t0 = rospy.Time.now().to_sec()\n ps = PoseStamped()\n ps.header.frame_id = '/map'\n ps.header.stamp = rospy.Time(0)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L102_C12", "label": "logout()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [8, 3, 0.4435, 0.0043, 3, 0.41, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'YamlProcPoses: issuing %d of %d' % (self.ind+1, self.size))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L103_C12", "label": "logout()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [8, 3, 0.4478, 0.0043, 3, 0.41, 0.0769, 525, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'YamlProcPoses: Time to capture %2.2f' % ( rospy.Time.now().to_sec() - self.t0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L104_C12", "label": "self.t0 = to_sec()", "type": "assigned_variable", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.4522, 0.0043, 3, 0.41, 0.1538, 533, 3, 0, 0, 0, 750, 10, 2], "semantic": {"name": "self.t0", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " self.t0 = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L105_C12", "label": "ps = PoseStamped()", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.4565, 0.0043, 3, 0.41, 0.2308, 232, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " ps = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L106_C12", "label": "ps.header.frame_id =", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.4609, 0.0043, 3, 0.41, 0.3077, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ps.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.header.frame_id = '/map'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L107_C12", "label": "ps.header.stamp = Time()", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.4652, 0.0043, 3, 0.41, 0.3846, 161, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "ps.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " ps.header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L109_C12", "label": "ps.pose.position.x =", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.4739, 0.0043, 3, 0.41, 0.4615, 782, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps.pose.position.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.pose.position.x = self.d['rad_cap']['captures'][ self.ind ][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L110_C12", "label": "ps.pose.position.y =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.4783, 0.0043, 3, 0.41, 0.5385, 661, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps.pose.position.y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.pose.position.y = self.d['rad_cap']['captures'][ self.ind ][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L111_C12", "label": "ang =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.4826, 0.0043, 3, 0.41, 0.6154, 762, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ang = self.d['rad_cap']['captures'][ self.ind ][2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L112_C12", "label": "q = Quaternion()", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.487, 0.0043, 3, 0.41, 0.6923, 516, 3, 1, 0, 0, 747, 10, 3], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "Quaternion", "annotation": ""}, "snippet": " q = Quaternion( *tft.quaternion_from_euler( 0.0, 0.0, math.radians( ang )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L113_C12", "label": "ps.pose.orientation =", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.4913, 0.0043, 3, 0.41, 0.7692, 670, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps.pose.orientation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.pose.orientation = q"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L117_C12", "label": "userdata.next_move_pose =", "type": "assigned_variable", "loc": [117, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [14, 3, 0.5087, 0.0043, 3, 0.41, 0.8462, 680, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.next_move_pose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.next_move_pose = ps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L118_C12", "label": "return", "type": "return", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [13, 3, 0.513, 0.0043, 3, 0.41, 0.9231, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L120_C12", "label": "return", "type": "return", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "vector": [13, 3, 0.5217, 0.0043, 3, 0.41, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'aborted' # done!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L122_C0", "label": "YAMLprocMultitag", "type": "class", "loc": [122, 176], "level": 0, "parent": null, "vector": [3, 0, 0.6478, 0.2391, 0, 0.66, 0.8929, 937, 0, 2, 0, 0, 892, 0, 25], "semantic": {"name": "YAMLprocMultitag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class YAMLprocMultitag(smach.State):\n def __init__(self, fname):\n smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['bagfile_name',\n 'bagfile_topics',\n 'tagid',\n 'panrate',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L123_C4", "label": "__init__", "type": "function", "loc": [123, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L122_C0", "vector": [2, 1, 0.5609, 0.0565, 1, 0.2, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, fname):\n smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['bagfile_name',\n 'bagfile_topics',\n 'tagid',\n 'panrate',\n 'tilt_left',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L124_C8", "label": "__init__()", "type": "expression", "loc": [124, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L123_C4", "vector": [8, 2, 0.5587, 0.0435, 2, 0.6, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self,\n outcomes=['succeeded', 'aborted'],\n output_keys = ['bagfile_name',\n 'bagfile_topics',\n 'tagid',\n 'panrate',\n 'tilt_left',\n 'tilt_right',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L134_C8", "label": "self.fname =", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L123_C4", "vector": [14, 2, 0.5826, 0.0043, 2, 0.6, 0.5, 935, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.fname = fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L135_C8", "label": "self.d =", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L123_C4", "vector": [14, 2, 0.587, 0.0043, 2, 0.6, 1.0, 745, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.d = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "label": "execute", "type": "function", "loc": [137, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L122_C0", "vector": [2, 1, 0.6804, 0.1739, 1, 0.2, 1.0, 569, 0, 2, 1, 0, 0, 0, 24], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n if not self.d:\n f = open( self.fname, 'r' )\n self.d = yaml.load( f )\n self.tagids = self.d['rad_cap']['tagids'].keys()\n self.keys_list = list( self.tagids )\n f.close()\n self.tilt_angs = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "label": "if", "type": "if", "loc": [138, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [4, 2, 0.613, 0.0304, 2, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.d:\n f = open( self.fname, 'r' )\n self.d = yaml.load( f )\n self.tagids = self.d['rad_cap']['tagids'].keys()\n self.keys_list = list( self.tagids )\n f.close()\n self.tilt_angs = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L139_C12", "label": "f = open()", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "vector": [14, 3, 0.6043, 0.0043, 3, 0.18, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( self.fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L140_C12", "label": "self.d = load()", "type": "assigned_variable", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "vector": [14, 3, 0.6087, 0.0043, 3, 0.18, 0.2, 745, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "self.d", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " self.d = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L141_C12", "label": "self.tagids = keys()", "type": "assigned_variable", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "vector": [14, 3, 0.613, 0.0043, 3, 0.18, 0.4, 888, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "self.tagids", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " self.tagids = self.d['rad_cap']['tagids'].keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L142_C12", "label": "self.keys_list = list()", "type": "assigned_variable", "loc": [142, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "vector": [14, 3, 0.6174, 0.0043, 3, 0.18, 0.6, 156, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "self.keys_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " self.keys_list = list( self.tagids )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L143_C12", "label": "close()", "type": "expression", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "vector": [8, 3, 0.6217, 0.0043, 3, 0.18, 0.8, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L144_C12", "label": "self.tilt_angs =", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "vector": [14, 3, 0.6261, 0.0043, 3, 0.18, 1.0, 368, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.tilt_angs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tilt_angs = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L146_C8", "label": "if", "type": "if", "loc": [146, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [4, 2, 0.6391, 0.013, 2, 0.36, 0.0526, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.keys_list and not self.tilt_angs: # Done! reset.\n self.keys_list = list( self.tagids )\n return 'aborted'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L147_C12", "label": "self.keys_list = list()", "type": "assigned_variable", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L146_C8", "vector": [14, 3, 0.6391, 0.0043, 3, 0.7, 0.0, 156, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "self.keys_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " self.keys_list = list( self.tagids )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L148_C12", "label": "return", "type": "return", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L146_C8", "vector": [13, 3, 0.6435, 0.0043, 3, 0.7, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'aborted'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "label": "if", "type": "if", "loc": [150, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [4, 2, 0.6609, 0.0217, 2, 0.36, 0.1053, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.tilt_angs: # get next tagid\n self.tid = self.keys_list.pop()\n self.tilt_angs = list( self.d['rad_cap']['tagids'][self.tid]['tilts'] )\n rospy.logout( 'setting tid: %s' % self.tid )\n print('Tilt angs: ', self.tilt_angs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L151_C12", "label": "self.tid = pop()", "type": "assigned_variable", "loc": [151, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "vector": [14, 3, 0.6565, 0.0043, 3, 0.11, 0.0, 310, 3, 0, 0, 0, 969, 10, 1], "semantic": {"name": "self.tid", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.tid = self.keys_list.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L152_C12", "label": "self.tilt_angs = list()", "type": "assigned_variable", "loc": [152, 152], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "vector": [14, 3, 0.6609, 0.0043, 3, 0.11, 0.3333, 368, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "self.tilt_angs", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " self.tilt_angs = list( self.d['rad_cap']['tagids'][self.tid]['tilts'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L153_C12", "label": "logout()", "type": "expression", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "vector": [8, 3, 0.6652, 0.0043, 3, 0.11, 0.6667, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'setting tid: %s' % self.tid )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L154_C12", "label": "print()", "type": "expression", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "vector": [8, 3, 0.6696, 0.0043, 3, 0.11, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Tilt angs: ', self.tilt_angs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L156_C8", "label": "ta =", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.6783, 0.0043, 2, 0.36, 0.1579, 280, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ta = self.tilt_angs.pop()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L157_C8", "label": "logout()", "type": "expression", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [8, 2, 0.6826, 0.0043, 2, 0.36, 0.2105, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Using tilt angle: %2.2f' % ta )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L158_C8", "label": "userdata.tilt_left =", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.687, 0.0043, 2, 0.36, 0.2632, 193, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.tilt_left", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.tilt_left = -1.0 * ta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L159_C8", "label": "userdata.tilt_right =", "type": "assigned_variable", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.6913, 0.0043, 2, 0.36, 0.3158, 128, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.tilt_right", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.tilt_right = ta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L160_C8", "label": "userdata.tilt_rate =", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.6957, 0.0043, 2, 0.36, 0.3684, 611, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "userdata.tilt_rate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.tilt_rate = 0.4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L161_C8", "label": "userdata.tilt_block =", "type": "assigned_variable", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7, 0.0043, 2, 0.36, 0.4211, 886, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "userdata.tilt_block", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.tilt_block = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L162_C8", "label": "tad = degrees()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7043, 0.0043, 2, 0.36, 0.4737, 964, 3, 1, 0, 0, 633, 10, 1], "semantic": {"name": "tad", "arg_names": [], "import_names": [], "rhs_call_name": "degrees", "annotation": ""}, "snippet": " tad = math.degrees( ta )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L164_C8", "label": "logout()", "type": "expression", "loc": [164, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [8, 2, 0.7152, 0.0087, 2, 0.36, 0.5263, 525, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'YamlProcMultitag: issuing %d of %d for tag \\'%s\\'' %\n (len(self.tagids) - len(self.keys_list), len(self.tagids), self.tid))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L167_C8", "label": "userdata.tagid =", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7261, 0.0043, 2, 0.36, 0.5789, 515, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.tagid = self.tid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L169_C8", "label": "tmp =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7348, 0.0043, 2, 0.36, 0.6316, 517, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmp = self.tid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L170_C8", "label": "path =", "type": "assigned_variable", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7391, 0.0043, 2, 0.36, 0.6842, 358, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = self.d['rad_cap']['bagfile_path']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L171_C8", "label": "tsec = str()", "type": "assigned_variable", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7435, 0.0043, 2, 0.36, 0.7368, 440, 3, 1, 0, 0, 52, 10, 4], "semantic": {"name": "tsec", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " tsec = str(int(rospy.Time.now().to_sec()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L172_C8", "label": "tads = str()", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7478, 0.0043, 2, 0.36, 0.7895, 379, 3, 1, 0, 0, 52, 10, 2], "semantic": {"name": "tads", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " tads = str(int( tad ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L173_C8", "label": "userdata.bagfile_name =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7522, 0.0043, 2, 0.36, 0.8421, 592, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "userdata.bagfile_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.bagfile_name = path + tsec + '_' + tads + '_' + tmp.replace(' ', '' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L174_C8", "label": "userdata.bagfile_topics =", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7565, 0.0043, 2, 0.36, 0.8947, 96, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.bagfile_topics", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.bagfile_topics = self.d['rad_cap']['bagfile_topics']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L175_C8", "label": "userdata.panrate =", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [14, 2, 0.7609, 0.0043, 2, 0.36, 0.9474, 297, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "userdata.panrate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.panrate = 30.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L176_C8", "label": "return", "type": "return", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "vector": [13, 2, 0.7652, 0.0043, 2, 0.36, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L179_C0", "label": "ManualSkip", "type": "class", "loc": [179, 199], "level": 0, "parent": null, "vector": [3, 0, 0.8217, 0.0913, 0, 0.66, 0.9286, 583, 0, 2, 0, 0, 892, 0, 8], "semantic": {"name": "ManualSkip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ManualSkip(smach.State):\n def __init__(self):\n smach.State.__init__(self,outcomes=['succeeded', 'aborted'])\n self.init = None\n\n def execute(self, userdata):\n if not self.init:\n self.init = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L180_C4", "label": "__init__", "type": "function", "loc": [180, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L179_C0", "vector": [2, 1, 0.787, 0.013, 1, 0.64, 0.0, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n smach.State.__init__(self,outcomes=['succeeded', 'aborted'])\n self.init = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L181_C8", "label": "__init__()", "type": "expression", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L180_C4", "vector": [8, 2, 0.787, 0.0043, 2, 0.24, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self,outcomes=['succeeded', 'aborted'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L182_C8", "label": "self.init =", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L180_C4", "vector": [14, 2, 0.7913, 0.0043, 2, 0.24, 1.0, 656, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "label": "execute", "type": "function", "loc": [184, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L179_C0", "vector": [2, 1, 0.8326, 0.0696, 1, 0.64, 1.0, 569, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n if not self.init:\n self.init = True\n self.pub = rospy.Publisher( 'robotsound', SoundRequest )\n rospy.sleep( 1.0 )\n\n self.pub.publish( SoundRequest( -3, 1, 'MANUAL or SKIP' ))\n ui = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L185_C8", "label": "if", "type": "if", "loc": [185, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "vector": [4, 2, 0.8109, 0.0174, 2, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.init:\n self.init = True\n self.pub = rospy.Publisher( 'robotsound', SoundRequest )\n rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L186_C12", "label": "self.init =", "type": "assigned_variable", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L185_C8", "vector": [14, 3, 0.8087, 0.0043, 3, 0.33, 0.0, 656, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L187_C12", "label": "self.pub = Publisher()", "type": "assigned_variable", "loc": [187, 187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L185_C8", "vector": [14, 3, 0.813, 0.0043, 3, 0.33, 0.5, 86, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.pub", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.pub = rospy.Publisher( 'robotsound', SoundRequest )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L188_C12", "label": "sleep()", "type": "expression", "loc": [188, 188], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L185_C8", "vector": [8, 3, 0.8174, 0.0043, 3, 0.33, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L190_C8", "label": "publish()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "vector": [8, 2, 0.8261, 0.0043, 2, 0.45, 0.25, 102, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub.publish( SoundRequest( -3, 1, 'MANUAL or SKIP' ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L191_C8", "label": "ui =", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "vector": [14, 2, 0.8304, 0.0043, 2, 0.45, 0.5, 303, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ui", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ui = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L192_C8", "label": "while", "type": "while", "loc": [192, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "vector": [5, 2, 0.8413, 0.0174, 2, 0.45, 0.75, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not (ui == '0' or ui == '1'):\n print('\\'0\\' to Position Manually (position robot first)')\n print('\\'1\\' to skip this position')\n ui = raw_input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L193_C12", "label": "print()", "type": "expression", "loc": [193, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L192_C8", "vector": [8, 3, 0.8391, 0.0043, 3, 0.73, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\'0\\' to Position Manually (position robot first)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L194_C12", "label": "print()", "type": "expression", "loc": [194, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L192_C8", "vector": [8, 3, 0.8435, 0.0043, 3, 0.73, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\'1\\' to skip this position')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L195_C12", "label": "ui = raw_input()", "type": "assigned_variable", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L192_C8", "vector": [14, 3, 0.8478, 0.0043, 3, 0.73, 1.0, 303, 3, 0, 0, 0, 821, 10, 1], "semantic": {"name": "ui", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " ui = raw_input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L196_C8", "label": "if", "type": "if", "loc": [196, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "vector": [4, 2, 0.8587, 0.0174, 2, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ui == '0':\n return 'succeeded' # Robot manually positioned\n else:\n return 'aborted' # Forget this position"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L197_C12", "label": "return", "type": "return", "loc": [197, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L196_C8", "vector": [13, 3, 0.8565, 0.0043, 3, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded' # Robot manually positioned"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L199_C12", "label": "return", "type": "return", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L196_C8", "vector": [13, 3, 0.8652, 0.0043, 3, 0.15, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'aborted' # Forget this position"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L201_C0", "label": "MoveNotify", "type": "class", "loc": [201, 218], "level": 0, "parent": null, "vector": [3, 0, 0.9109, 0.0783, 0, 0.66, 0.9643, 322, 0, 2, 0, 0, 892, 0, 7], "semantic": {"name": "MoveNotify", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MoveNotify(smach.State):\n def __init__(self):\n smach.State.__init__(self,outcomes=['succeeded', 'aborted'])\n self.init = None\n\n def execute(self, userdata):\n if not self.init:\n self.init = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L202_C4", "label": "__init__", "type": "function", "loc": [202, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L201_C0", "vector": [2, 1, 0.8826, 0.013, 1, 0.74, 0.0, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n smach.State.__init__(self,outcomes=['succeeded', 'aborted'])\n self.init = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L203_C8", "label": "__init__()", "type": "expression", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L202_C4", "vector": [8, 2, 0.8826, 0.0043, 2, 0.14, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self,outcomes=['succeeded', 'aborted'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L204_C8", "label": "self.init =", "type": "assigned_variable", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L202_C4", "vector": [14, 2, 0.887, 0.0043, 2, 0.14, 1.0, 656, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "label": "execute", "type": "function", "loc": [206, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L201_C0", "vector": [2, 1, 0.9217, 0.0565, 1, 0.74, 1.0, 569, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n if not self.init:\n self.init = True\n self.pub = rospy.Publisher( 'robotsound', SoundRequest )\n rospy.sleep( 1.0 )\n\n self.pub.publish( SoundRequest( -3, 1, 'Ready to Move' ))\n ui = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L207_C8", "label": "if", "type": "if", "loc": [207, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "vector": [4, 2, 0.9065, 0.0174, 2, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.init:\n self.init = True\n self.pub = rospy.Publisher( 'robotsound', SoundRequest )\n rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L208_C12", "label": "self.init =", "type": "assigned_variable", "loc": [208, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L207_C8", "vector": [14, 3, 0.9043, 0.0043, 3, 0.59, 0.0, 656, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L209_C12", "label": "self.pub = Publisher()", "type": "assigned_variable", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L207_C8", "vector": [14, 3, 0.9087, 0.0043, 3, 0.59, 0.5, 86, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.pub", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.pub = rospy.Publisher( 'robotsound', SoundRequest )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L210_C12", "label": "sleep()", "type": "expression", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L207_C8", "vector": [8, 3, 0.913, 0.0043, 3, 0.59, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L212_C8", "label": "publish()", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "vector": [8, 2, 0.9217, 0.0043, 2, 0.86, 0.25, 102, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub.publish( SoundRequest( -3, 1, 'Ready to Move' ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L213_C8", "label": "ui =", "type": "assigned_variable", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "vector": [14, 2, 0.9261, 0.0043, 2, 0.86, 0.5, 303, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ui", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ui = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L214_C8", "label": "while", "type": "while", "loc": [214, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "vector": [5, 2, 0.9348, 0.013, 2, 0.86, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not (ui == '0' or ui == '1'):\n print('\\'0\\' or \\'1\\' when Ready.')\n ui = raw_input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L215_C12", "label": "print()", "type": "expression", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L214_C8", "vector": [8, 3, 0.9348, 0.0043, 3, 0.82, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\'0\\' or \\'1\\' when Ready.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L216_C12", "label": "ui = raw_input()", "type": "assigned_variable", "loc": [216, 216], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L214_C8", "vector": [14, 3, 0.9391, 0.0043, 3, 0.82, 1.0, 303, 3, 0, 0, 0, 821, 10, 1], "semantic": {"name": "ui", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " ui = raw_input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L218_C8", "label": "return", "type": "return", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "vector": [13, 2, 0.9478, 0.0043, 2, 0.86, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L222_C0", "label": "if", "type": "if", "loc": [222, 226], "level": 0, "parent": null, "vector": [4, 0, 0.9739, 0.0217, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n rospy.init_node( 'bag_capture_services' )\n \n bc = BagCap()\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L223_C4", "label": "init_node()", "type": "expression", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L222_C0", "vector": [8, 1, 0.9696, 0.0043, 1, 0.38, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'bag_capture_services' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L225_C4", "label": "bc = BagCap()", "type": "assigned_variable", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L222_C0", "vector": [14, 1, 0.9783, 0.0043, 1, 0.38, 0.5, 844, 3, 0, 0, 0, 295, 10, 1], "semantic": {"name": "bc", "arg_names": [], "import_names": [], "rhs_call_name": "BagCap", "annotation": ""}, "snippet": " bc = BagCap()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L226_C4", "label": "spin()", "type": "expression", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L222_C0", "vector": [8, 1, 0.9826, 0.0043, 1, 0.38, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L122_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L122_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L188_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L193_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L194_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:ClassDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L208_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L214_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:While_L214_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L216_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Return_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99412:If_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99412:Expr_L226_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('tf')
roslib.load_manifest('rfid_pf')
import rospy
import rfid_datacapture.math_util as mu
import sm_aware_home_explore as ahe
import glob
import yaml
import tf
import tf.transformations as tft
import json
import numpy as np, math
import cPickle as pkl
import template
import rfid_pf.pf_stats as pfs
res = []
def process_trialobj( trial_num, obj_num, servo_yn ):
obj_name = ahe.tdb[ obj_num ][0]
tname = obj_name.replace( ' ', '' )
loc = (trial_num + obj_num) % 9
loc_name = ahe.pts[loc][0]
loc_pos = np.array(ahe.pts[loc][1]) # Tag ground-truth location
print 'Trial %d with Object %d (%s) at Position %d (%s)' % (trial_num, obj_num, obj_name, loc, loc_name)
fname = 'search_aware_home/woot_150_'+str(trial_num)+'_reads.pkl'
f = open( fname, 'r' )
summary_search = pkl.load( f )
f.close()
pos_readings_search = sum([ True for p in summary_search if p.read.rssi != -1 and p.read.tagID == obj_name ])
tot_readings_search = len( summary_search )
search_positions_fname = 'search_aware_home/woot_150_' + str(trial_num) + '_tag_' + tname + '.yaml'
servo_positions_fname = 'search_aware_home/woot_150_' + str(trial_num) + '_tag_' + tname + '_end.txt'
servo_fname = 'search_aware_home/woot_150_' + str(trial_num) + '_tag_' + tname + '_servo.pkl'
if pos_readings_search == 0:
print '\t No results for this instance.'
res = { 'loc': loc,
'obj_num': obj_num,
'trial_num': trial_num,
'pos_readings': pos_readings_search,
'tot_readings':tot_readings_search,
'best_pos': '--',
'orient_est': '--',
'dxy': '--',
'dtheta': '--',
'servo_yn': servo_yn,
'other': { 'w_mass': 0.0, # specific to pf
'orient_fit': 0.0 }}
return False, res, None
# All fnames should be defined if we got here!
f = open( search_positions_fname )
y = yaml.load( f )
f.close()
# "Best" Location determined by search
efq = tft.euler_from_quaternion
search_theta = efq( [ y['pose']['orientation']['x'],
y['pose']['orientation']['y'],
y['pose']['orientation']['z'],
y['pose']['orientation']['w'] ])[-1]
search_pos = np.array([ y['pose']['position']['x'],
y['pose']['position']['y'],
y['pose']['position']['z'] ])
search_true_theta = np.arctan2( loc_pos[1] - search_pos[1], # y / x
loc_pos[0] - search_pos[0] )
search_theta_diff = mu.standard_rad( search_theta - search_true_theta )
# search_pos_diff = np.linalg.norm( search_pos - loc_pos )
search_pos_diff = np.linalg.norm( search_pos[0:2] - loc_pos[0:2] )
# Should we return the search only results?
if not servo_yn:
res = { 'loc': loc,
'obj_num': obj_num,
'trial_num': trial_num,
'pos_readings': pos_readings_search,
'tot_readings':tot_readings_search,
'best_pos': search_pos,
'orient_est': search_theta,
'dxy': search_pos_diff,
'dtheta': search_theta_diff,
'servo_yn': servo_yn }
return True, res, None
# Else... compute the SEARCH PLUS SERVO results
# update the stats for pos reads
f = open( servo_fname, 'r' )
summary_servo = pkl.load( f )
f.close()
pos_readings_servo = sum([ True for p in summary_servo if p.read.rssi != -1 and p.read.tagID == obj_name ])
tot_readings_servo = len( summary_servo )
# Location after Servoing
f = open( servo_positions_fname )
r = f.readlines()
f.close()
# ['At time 1313069718.853\n',
# '- Translation: [2.811, 1.711, 0.051]\n',
# '- Rotation: in Quaternion [0.003, 0.001, -0.114, 0.993]\n',
# ' in RPY [0.005, 0.003, -0.229]\n',
# 'At time 1313069719.853\n',
# '- Translation: [2.811, 1.711, 0.051]\n',
# '- Rotation: in Quaternion [0.003, 0.001, -0.114, 0.993]\n',
# ' in RPY [0.005, 0.002, -0.229]\n']
rpy = r[-1].find('RPY')+3
servo_theta = json.loads( r[-1][rpy:] )[-1]
tion = r[-3].find('tion:')+5
servo_pos = np.array(json.loads( r[-3][tion:] ))
servo_true_theta = np.arctan2( loc_pos[1] - servo_pos[1], # y / x
loc_pos[0] - servo_pos[0] )
servo_theta_diff = mu.standard_rad( servo_theta - servo_true_theta )
# servo_pos_diff = np.linalg.norm( servo_pos - loc_pos )
servo_pos_diff = np.linalg.norm( servo_pos[0:2] - loc_pos[0:2] )
# print '\t Post-Servo Stats:'
# print '\t\t Tag-Robot distance err (m): %2.3f' % (servo_pos_diff)
# print '\t\t Tag-Robot orient err (deg): %2.3f' % (math.degrees(servo_theta_diff))
# print '\t\t Debug Stats', math.degrees(servo_theta), math.degrees(servo_true_theta), servo_pos, loc_pos
res = { 'loc': loc,
'obj_num': obj_num,
'trial_num': trial_num,
'pos_readings': pos_readings_search + pos_readings_servo,
'tot_readings':tot_readings_search + tot_readings_servo,
'best_pos': servo_pos,
'orient_est': servo_theta,
'dxy': servo_pos_diff,
'dtheta': servo_theta_diff,
'servo_yn': servo_yn }
return True, res, None
return
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--trial', action='store', type='int', dest='trial',
help='trial number (0-8)')
p.add_option('--obj', action='store', type='int', dest='obj',
help='object number (0-8)')
p.add_option('--servo', action='store_true', dest='servo',
help='Use combined search and servo?', default = False)
opt, args = p.parse_args()
obj_num = opt.obj
trial_num = opt.trial
servo_yn = opt.servo
rospy.init_node( 'goober' )
if trial_num < 9:
print 'Publishing.'
was_reads, res, p_set = process_trialobj( trial_num, obj_num, servo_yn )
print 'RESULTS'
pfs.pprint( res )
f = open( 'Obj%d_Trial%d_Servo%d_rel_results.pkl' % (obj_num, trial_num, int( servo_yn )), 'w')
pkl.dump( res, f )
f.close()
else:
# for i in range( 0, 1 ): # trial
# for j in range( 4, 5 ): # obj
for i in range( 0, 9 ): # trial
for j in range( 0, 9 ): # obj
for s in [False, True]: # servo_yn
was_reads, res, p_set = process_trialobj( trial_num = i, obj_num = j, servo_yn = s )
print 'RESULTS'
pfs.pprint( res )
f = open( 'Obj%d_Trial%d_Servo%d_rel_results.pkl' % ( j, i, int( s )), 'w')
pkl.dump( res, f )
f.close()
| ajibawa-2023/Python-Code-Large/train/row_99413 | 100 | 209 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0096, 0.0048, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0144, 0.0048, 0, 0.66, 0.0435, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0191, 0.0048, 0, 0.66, 0.087, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0239, 0.0048, 0, 0.66, 0.1304, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0287, 0.0048, 0, 0.66, 0.1739, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0335, 0.0048, 0, 0.66, 0.2174, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0383, 0.0048, 0, 0.66, 0.2609, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0431, 0.0048, 0, 0.66, 0.3043, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0478, 0.0048, 0, 0.66, 0.3478, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_pf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L11_C0", "label": "rospy import rospy", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0048, 0, 0.66, 0.3913, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L13_C0", "label": "rfid_datacapture.math_util import mu", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0622, 0.0048, 0, 0.66, 0.4348, 974, 0, 1, 0, 0, 974, 0, 0], "semantic": {"name": "rfid_datacapture.math_util", "arg_names": [], "import_names": ["mu"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_datacapture.math_util as mu"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L14_C0", "label": "sm_aware_home_explore import ahe", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.067, 0.0048, 0, 0.66, 0.4783, 54, 0, 1, 0, 0, 54, 0, 0], "semantic": {"name": "sm_aware_home_explore", "arg_names": [], "import_names": ["ahe"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sm_aware_home_explore as ahe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L15_C0", "label": "glob import glob", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0718, 0.0048, 0, 0.66, 0.5217, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L16_C0", "label": "yaml import yaml", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0766, 0.0048, 0, 0.66, 0.5652, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L17_C0", "label": "tf import tf", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0813, 0.0048, 0, 0.66, 0.6087, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L18_C0", "label": "tf.transformations import tft", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0861, 0.0048, 0, 0.66, 0.6522, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tft"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tft"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L19_C0", "label": "json import json", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0048, 0, 0.66, 0.6957, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L20_C0", "label": "numpy import np, math", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0957, 0.0048, 0, 0.66, 0.7391, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L21_C0", "label": "cPickle import pkl", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1005, 0.0048, 0, 0.66, 0.7826, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L22_C0", "label": "template import template", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0048, 0, 0.66, 0.8261, 549, 0, 1, 0, 0, 549, 0, 0], "semantic": {"name": "template", "arg_names": [], "import_names": ["template"], "rhs_call_name": "", "annotation": ""}, "snippet": "import template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L23_C0", "label": "rfid_pf.pf_stats import pfs", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.11, 0.0048, 0, 0.66, 0.8696, 420, 0, 1, 0, 0, 420, 0, 0], "semantic": {"name": "rfid_pf.pf_stats", "arg_names": [], "import_names": ["pfs"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_pf.pf_stats as pfs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L25_C0", "label": "res =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.1196, 0.0048, 0, 0.66, 0.913, 413, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "res = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "label": "process_trialobj", "type": "function", "loc": [27, 157], "level": 0, "parent": null, "vector": [2, 0, 0.4402, 0.6268, 0, 0.66, 0.9565, 41, 0, 3, 1, 0, 0, 0, 37], "semantic": {"name": "process_trialobj", "arg_names": ["trial_num", "obj_num", "servo_yn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_trialobj( trial_num, obj_num, servo_yn ):\n obj_name = ahe.tdb[ obj_num ][0]\n tname = obj_name.replace( ' ', '' )\n\n loc = (trial_num + obj_num) % 9\n loc_name = ahe.pts[loc][0]\n loc_pos = np.array(ahe.pts[loc][1]) # Tag ground-truth location\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L28_C4", "label": "obj_name =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.134, 0.0048, 1, 0.38, 0.0, 412, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_name = ahe.tdb[ obj_num ][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L29_C4", "label": "tname = replace()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.1388, 0.0048, 1, 0.38, 0.0233, 985, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "tname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tname = obj_name.replace( ' ', '' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L31_C4", "label": "loc =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.1483, 0.0048, 1, 0.38, 0.0465, 822, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc = (trial_num + obj_num) % 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L32_C4", "label": "loc_name =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.1531, 0.0048, 1, 0.38, 0.0698, 380, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "loc_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc_name = ahe.pts[loc][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L33_C4", "label": "loc_pos = array()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.1579, 0.0048, 1, 0.38, 0.093, 668, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "loc_pos", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " loc_pos = np.array(ahe.pts[loc][1]) # Tag ground-truth location"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L35_C4", "label": "print()", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [8, 1, 0.1675, 0.0048, 1, 0.38, 0.1163, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Trial %d with Object %d (%s) at Position %d (%s)' % (trial_num, obj_num, obj_name, loc, loc_name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L37_C4", "label": "fname =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.177, 0.0048, 1, 0.38, 0.1395, 190, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = 'search_aware_home/woot_150_'+str(trial_num)+'_reads.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L38_C4", "label": "f = open()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.1818, 0.0048, 1, 0.38, 0.1628, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L39_C4", "label": "summary_search = load()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.1866, 0.0048, 1, 0.38, 0.186, 232, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "summary_search", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " summary_search = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L40_C4", "label": "close()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [8, 1, 0.1914, 0.0048, 1, 0.38, 0.2093, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L42_C4", "label": "pos_readings_search = sum()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.201, 0.0048, 1, 0.38, 0.2326, 568, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "pos_readings_search", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " pos_readings_search = sum([ True for p in summary_search if p.read.rssi != -1 and p.read.tagID == obj_name ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L43_C4", "label": "tot_readings_search = len()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.2057, 0.0048, 1, 0.38, 0.2558, 153, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "tot_readings_search", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " tot_readings_search = len( summary_search )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L45_C4", "label": "search_positions_fname =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.2153, 0.0048, 1, 0.38, 0.2791, 43, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "search_positions_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search_positions_fname = 'search_aware_home/woot_150_' + str(trial_num) + '_tag_' + tname + '.yaml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L46_C4", "label": "servo_positions_fname =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.2201, 0.0048, 1, 0.38, 0.3023, 746, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "servo_positions_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_positions_fname = 'search_aware_home/woot_150_' + str(trial_num) + '_tag_' + tname + '_end.txt'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L47_C4", "label": "servo_fname =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.2249, 0.0048, 1, 0.38, 0.3256, 192, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "servo_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_fname = 'search_aware_home/woot_150_' + str(trial_num) + '_tag_' + tname + '_servo.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L50_C4", "label": "if", "type": "if", "loc": [50, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [4, 1, 0.2751, 0.0766, 1, 0.38, 0.3488, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pos_readings_search == 0:\n print('\\t No results for this instance.')\n\n res = { 'loc': loc,\n 'obj_num': obj_num,\n 'trial_num': trial_num,\n 'pos_readings': pos_readings_search,\n 'tot_readings':tot_readings_search,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L51_C8", "label": "print()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L50_C4", "vector": [8, 2, 0.244, 0.0048, 2, 0.81, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\t No results for this instance.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L53_C8", "label": "res =", "type": "assigned_variable", "loc": [53, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L50_C4", "vector": [14, 2, 0.2799, 0.0574, 2, 0.81, 0.5, 413, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = { 'loc': loc,\n 'obj_num': obj_num,\n 'trial_num': trial_num,\n 'pos_readings': pos_readings_search,\n 'tot_readings':tot_readings_search,\n 'best_pos': '--',\n 'orient_est': '--',\n 'dxy': '--',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Return_L65_C8", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L50_C4", "vector": [13, 2, 0.311, 0.0048, 2, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, res, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L69_C4", "label": "f = open()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.3301, 0.0048, 1, 0.38, 0.3721, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( search_positions_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L70_C4", "label": "y = load()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.3349, 0.0048, 1, 0.38, 0.3953, 304, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " y = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L71_C4", "label": "close()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [8, 1, 0.3397, 0.0048, 1, 0.38, 0.4186, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L74_C4", "label": "efq =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.3541, 0.0048, 1, 0.38, 0.4419, 607, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "efq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " efq = tft.euler_from_quaternion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L75_C4", "label": "search_theta =", "type": "assigned_variable", "loc": [75, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.366, 0.0191, 1, 0.38, 0.4651, 86, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "search_theta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search_theta = efq( [ y['pose']['orientation']['x'],\n y['pose']['orientation']['y'],\n y['pose']['orientation']['z'],\n y['pose']['orientation']['w'] ])[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L80_C4", "label": "search_pos = array()", "type": "assigned_variable", "loc": [80, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.3876, 0.0144, 1, 0.38, 0.4884, 556, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "search_pos", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " search_pos = np.array([ y['pose']['position']['x'],\n y['pose']['position']['y'],\n y['pose']['position']['z'] ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L84_C4", "label": "search_true_theta = arctan2()", "type": "assigned_variable", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.4043, 0.0096, 1, 0.38, 0.5116, 900, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "search_true_theta", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " search_true_theta = np.arctan2( loc_pos[1] - search_pos[1], # y / x\n loc_pos[0] - search_pos[0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L86_C4", "label": "search_theta_diff = standard_rad()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.4115, 0.0048, 1, 0.38, 0.5349, 310, 3, 1, 0, 0, 54, 10, 1], "semantic": {"name": "search_theta_diff", "arg_names": [], "import_names": [], "rhs_call_name": "standard_rad", "annotation": ""}, "snippet": " search_theta_diff = mu.standard_rad( search_theta - search_true_theta )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L88_C4", "label": "search_pos_diff = norm()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.4211, 0.0048, 1, 0.38, 0.5581, 54, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "search_pos_diff", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " search_pos_diff = np.linalg.norm( search_pos[0:2] - loc_pos[0:2] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L91_C4", "label": "if", "type": "if", "loc": [91, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [4, 1, 0.4617, 0.0574, 1, 0.38, 0.5814, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not servo_yn:\n res = { 'loc': loc,\n 'obj_num': obj_num,\n 'trial_num': trial_num,\n 'pos_readings': pos_readings_search,\n 'tot_readings':tot_readings_search,\n 'best_pos': search_pos,\n 'orient_est': search_theta,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L92_C8", "label": "res =", "type": "assigned_variable", "loc": [92, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L91_C4", "vector": [14, 2, 0.4617, 0.0478, 2, 0.35, 0.0, 413, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = { 'loc': loc,\n 'obj_num': obj_num,\n 'trial_num': trial_num,\n 'pos_readings': pos_readings_search,\n 'tot_readings':tot_readings_search,\n 'best_pos': search_pos,\n 'orient_est': search_theta,\n 'dxy': search_pos_diff,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Return_L102_C8", "label": "return", "type": "return", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L91_C4", "vector": [13, 2, 0.488, 0.0048, 2, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, res, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L107_C4", "label": "f = open()", "type": "assigned_variable", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.512, 0.0048, 1, 0.38, 0.6047, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( servo_fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L108_C4", "label": "summary_servo = load()", "type": "assigned_variable", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.5167, 0.0048, 1, 0.38, 0.6279, 764, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "summary_servo", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " summary_servo = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L109_C4", "label": "close()", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [8, 1, 0.5215, 0.0048, 1, 0.38, 0.6512, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L111_C4", "label": "pos_readings_servo = sum()", "type": "assigned_variable", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.5311, 0.0048, 1, 0.38, 0.6744, 629, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "pos_readings_servo", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " pos_readings_servo = sum([ True for p in summary_servo if p.read.rssi != -1 and p.read.tagID == obj_name ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L112_C4", "label": "tot_readings_servo = len()", "type": "assigned_variable", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.5359, 0.0048, 1, 0.38, 0.6977, 79, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "tot_readings_servo", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " tot_readings_servo = len( summary_servo )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L115_C4", "label": "f = open()", "type": "assigned_variable", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.5502, 0.0048, 1, 0.38, 0.7209, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( servo_positions_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L116_C4", "label": "r = readlines()", "type": "assigned_variable", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.555, 0.0048, 1, 0.38, 0.7442, 436, 3, 0, 0, 0, 841, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "readlines", "annotation": ""}, "snippet": " r = f.readlines()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L117_C4", "label": "close()", "type": "expression", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [8, 1, 0.5598, 0.0048, 1, 0.38, 0.7674, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L127_C4", "label": "rpy =", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.6077, 0.0048, 1, 0.38, 0.7907, 855, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "rpy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rpy = r[-1].find('RPY')+3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L128_C4", "label": "servo_theta =", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.6124, 0.0048, 1, 0.38, 0.814, 879, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "servo_theta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_theta = json.loads( r[-1][rpy:] )[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L130_C4", "label": "tion =", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.622, 0.0048, 1, 0.38, 0.8372, 508, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tion = r[-3].find('tion:')+5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L131_C4", "label": "servo_pos = array()", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.6268, 0.0048, 1, 0.38, 0.8605, 859, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "servo_pos", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " servo_pos = np.array(json.loads( r[-3][tion:] ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L133_C4", "label": "servo_true_theta = arctan2()", "type": "assigned_variable", "loc": [133, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.6388, 0.0096, 1, 0.38, 0.8837, 587, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "servo_true_theta", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " servo_true_theta = np.arctan2( loc_pos[1] - servo_pos[1], # y / x\n loc_pos[0] - servo_pos[0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L135_C4", "label": "servo_theta_diff = standard_rad()", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.6459, 0.0048, 1, 0.38, 0.907, 6, 3, 1, 0, 0, 54, 10, 1], "semantic": {"name": "servo_theta_diff", "arg_names": [], "import_names": [], "rhs_call_name": "standard_rad", "annotation": ""}, "snippet": " servo_theta_diff = mu.standard_rad( servo_theta - servo_true_theta )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L137_C4", "label": "servo_pos_diff = norm()", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.6555, 0.0048, 1, 0.38, 0.9302, 575, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "servo_pos_diff", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " servo_pos_diff = np.linalg.norm( servo_pos[0:2] - loc_pos[0:2] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L144_C4", "label": "res =", "type": "assigned_variable", "loc": [144, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [14, 1, 0.7105, 0.0478, 1, 0.38, 0.9535, 413, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = { 'loc': loc,\n 'obj_num': obj_num,\n 'trial_num': trial_num,\n 'pos_readings': pos_readings_search + pos_readings_servo,\n 'tot_readings':tot_readings_search + tot_readings_servo,\n 'best_pos': servo_pos,\n 'orient_est': servo_theta,\n 'dxy': servo_pos_diff,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Return_L155_C4", "label": "return", "type": "return", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [13, 1, 0.7416, 0.0048, 1, 0.38, 0.9767, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, res, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Return_L157_C4", "label": "return", "type": "return", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "vector": [13, 1, 0.7512, 0.0048, 1, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "label": "if", "type": "if", "loc": [164, 208], "level": 0, "parent": null, "vector": [4, 0, 0.89, 0.2153, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 23], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n\n import optparse\n p = optparse.OptionParser()\n p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')\n p.add_option('--obj', action='store', type='int', dest='obj',\n help='object number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L166_C4", "label": "optparse import optparse", "type": "import", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [1, 1, 0.7943, 0.0048, 1, 0.39, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L167_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [14, 1, 0.799, 0.0048, 1, 0.39, 0.1, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L168_C4", "label": "add_option()", "type": "expression", "loc": [168, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [8, 1, 0.8062, 0.0096, 1, 0.39, 0.2, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L170_C4", "label": "add_option()", "type": "expression", "loc": [170, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [8, 1, 0.8158, 0.0096, 1, 0.39, 0.3, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--obj', action='store', type='int', dest='obj',\n help='object number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L172_C4", "label": "add_option()", "type": "expression", "loc": [172, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [8, 1, 0.8254, 0.0096, 1, 0.39, 0.4, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--servo', action='store_true', dest='servo',\n help='Use combined search and servo?', default = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L174_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [14, 1, 0.8325, 0.0048, 1, 0.39, 0.5, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L176_C4", "label": "obj_num =", "type": "assigned_variable", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [14, 1, 0.8421, 0.0048, 1, 0.39, 0.6, 584, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj_num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_num = opt.obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L177_C4", "label": "trial_num =", "type": "assigned_variable", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [14, 1, 0.8469, 0.0048, 1, 0.39, 0.7, 298, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "trial_num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " trial_num = opt.trial"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L178_C4", "label": "servo_yn =", "type": "assigned_variable", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [14, 1, 0.8517, 0.0048, 1, 0.39, 0.8, 267, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "servo_yn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_yn = opt.servo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L180_C4", "label": "init_node()", "type": "expression", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [8, 1, 0.8612, 0.0048, 1, 0.39, 0.9, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'goober' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "label": "if", "type": "if", "loc": [183, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "vector": [4, 1, 0.9354, 0.1244, 1, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if trial_num < 9:\n print('Publishing.')\n was_reads, res, p_set = process_trialobj( trial_num, obj_num, servo_yn )\n\n print('RESULTS')\n pfs.pprint( res )\n\n f = open( 'Obj%d_Trial%d_Servo%d_rel_results.pkl' % (obj_num, trial_num, int( servo_yn )), 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L184_C8", "label": "print()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "vector": [8, 2, 0.8804, 0.0048, 2, 0.35, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Publishing.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L185_C8", "label": "was_reads, res, p_set = process_trialobj()", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "vector": [14, 2, 0.8852, 0.0048, 2, 0.35, 0.1429, 888, 3, 3, 0, 0, 41, 10, 1], "semantic": {"name": "was_reads, res, p_set", "arg_names": [], "import_names": [], "rhs_call_name": "process_trialobj", "annotation": ""}, "snippet": " was_reads, res, p_set = process_trialobj( trial_num, obj_num, servo_yn )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L187_C8", "label": "print()", "type": "expression", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "vector": [8, 2, 0.8947, 0.0048, 2, 0.35, 0.2857, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('RESULTS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L188_C8", "label": "pprint()", "type": "expression", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "vector": [8, 2, 0.8995, 0.0048, 2, 0.35, 0.4286, 276, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pprint", "arg_names": [], "import_names": [], "rhs_call_name": "pprint", "annotation": ""}, "snippet": " pfs.pprint( res )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L190_C8", "label": "f = open()", "type": "assigned_variable", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "vector": [14, 2, 0.9091, 0.0048, 2, 0.35, 0.5714, 899, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( 'Obj%d_Trial%d_Servo%d_rel_results.pkl' % (obj_num, trial_num, int( servo_yn )), 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L191_C8", "label": "dump()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "vector": [8, 2, 0.9139, 0.0048, 2, 0.35, 0.7143, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pkl.dump( res, f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L192_C8", "label": "close()", "type": "expression", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "vector": [8, 2, 0.9187, 0.0048, 2, 0.35, 0.8571, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L197_C8", "label": "for i", "type": "for", "loc": [197, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "vector": [6, 2, 0.9689, 0.0574, 2, 0.35, 1.0, 826, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range( 0, 9 ): # trial\n for j in range( 0, 9 ): # obj\n for s in [False, True]: # servo_yn\n\n was_reads, res, p_set = process_trialobj( trial_num = i, obj_num = j, servo_yn = s )\n\n print('RESULTS')\n pfs.pprint( res )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L198_C12", "label": "for j", "type": "for", "loc": [198, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L197_C8", "vector": [6, 3, 0.9713, 0.0526, 3, 0.46, 0.0, 100, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range( 0, 9 ): # obj\n for s in [False, True]: # servo_yn\n\n was_reads, res, p_set = process_trialobj( trial_num = i, obj_num = j, servo_yn = s )\n\n print('RESULTS')\n pfs.pprint( res )\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "label": "for s", "type": "for", "loc": [199, 208], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L198_C12", "vector": [6, 4, 0.9737, 0.0478, 4, 0.3, 0.0, 553, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in [False, True]: # servo_yn\n\n was_reads, res, p_set = process_trialobj( trial_num = i, obj_num = j, servo_yn = s )\n\n print('RESULTS')\n pfs.pprint( res )\n\n f = open( 'Obj%d_Trial%d_Servo%d_rel_results.pkl' % ( j, i, int( s )), 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L201_C20", "label": "was_reads, res, p_set = process_trialobj()", "type": "assigned_variable", "loc": [201, 201], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "vector": [14, 5, 0.9617, 0.0048, 5, 0.06, 0.0, 888, 3, 3, 0, 0, 41, 10, 1], "semantic": {"name": "was_reads, res, p_set", "arg_names": [], "import_names": [], "rhs_call_name": "process_trialobj", "annotation": ""}, "snippet": " was_reads, res, p_set = process_trialobj( trial_num = i, obj_num = j, servo_yn = s )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L203_C20", "label": "print()", "type": "expression", "loc": [203, 203], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "vector": [8, 5, 0.9713, 0.0048, 5, 0.06, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('RESULTS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L204_C20", "label": "pprint()", "type": "expression", "loc": [204, 204], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "vector": [8, 5, 0.9761, 0.0048, 5, 0.06, 0.4, 276, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pprint", "arg_names": [], "import_names": [], "rhs_call_name": "pprint", "annotation": ""}, "snippet": " pfs.pprint( res )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L206_C20", "label": "f = open()", "type": "assigned_variable", "loc": [206, 206], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "vector": [14, 5, 0.9856, 0.0048, 5, 0.06, 0.6, 899, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( 'Obj%d_Trial%d_Servo%d_rel_results.pkl' % ( j, i, int( s )), 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L207_C20", "label": "dump()", "type": "expression", "loc": [207, 207], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "vector": [8, 5, 0.9904, 0.0048, 5, 0.06, 0.8, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pkl.dump( res, f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L208_C20", "label": "close()", "type": "expression", "loc": [208, 208], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "vector": [8, 5, 0.9952, 0.0048, 5, 0.06, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Return_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Return_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Return_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Return_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Import_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:If_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L197_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L198_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L198_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L201_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L203_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L204_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Assign_L206_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L207_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99413:For_L199_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99413:Expr_L208_C20"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
import rospy
import smach
import actionlib
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
from rfid_demos import sm_rfid_explore
from rfid_behaviors import recorder
from hrl_lib import util
from rfid_datacapture.srv import BagCapture, BagCaptureRequest
class DummyClass():
def __init__(self, tagid):
self.tagid = tagid
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--fname', action='store', type='string', dest='fname',
help='File name. Should be without extension. [eg. \'trial\']', default='')
p.add_option('--radius', action='store', type='float', dest='radius',
help='Exploration radius in meters.', default=4.0)
opt, args = p.parse_args()
if opt.fname == '':
print 'Fname required'
exit()
fname_base = '/u/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/search_aware_home/'
fname = fname_base + opt.fname
sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],
input_keys = [ 'bagfile_name',
'bagfile_topics',
'tagid',
'explore_radius' ])
with sm:
smach.StateMachine.add(
'START_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request_slots = ['topics','dest'] ),
remapping = {'topics':'bagfile_topics',
'dest':'bagfile_name'},
transitions = {'succeeded':'SEARCH'})
sm_search = sm_rfid_explore.sm_search()
smach.StateMachine.add(
'SEARCH',
sm_search,
transitions = {'succeeded':'STOP_BAG_CAPTURE'},
remapping = {'tagid':'tagid',
'explore_radius':'explore_radius'})
smach.StateMachine.add(
'STOP_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request = BagCaptureRequest('','') ),
transitions = {'succeeded':'succeeded'})
rospy.init_node('smach_datacap_rfid_explore')
rec = recorder.Recorder( serv_name = 'temp_recorder', node_name = 'temp_recorder_py' )
rec.process_service( None ) # start recording
sm.userdata.tagid = ''
sm.userdata.explore_radius = opt.radius
sm.userdata.bagfile_name = fname
sm.userdata.bagfile_topics = '/tf /visarr /rfid/ears_reader /rfid/ears_reader_arr /map /robot_pose_ekf/odom_combined'
outcome = sm.execute()
rec.process_service( None ) # stop recording
print 'Saving recorder pickle data.'
util.save_pickle( rec.recorder_data, fname + '_reads.pkl' )
print 'Saving best read locations.'
tagids = ['OrangeMedBot','TravisTVremo','RedBottle ',
'OnMetalKeys ','WhiteMedsBot','BlueMedsBox ',
'TeddyBearToy','CordlessPhon','BlueHairBrus']
for t in tagids:
print '\tTagid: \'%s\'' % t,
tname = t.replace( ' ', '' )
try:
pos = rec.bestvantage( DummyClass( t ))
pos.header.stamp = rospy.Time(0)
dat = pos.__str__() + '\n'
f = open( fname + '_tag_' + tname + '.yaml', 'w' )
f.write( dat )
f.close()
print ' Done.'
except:
print ' NO READS. Done.'
pass
| ajibawa-2023/Python-Code-Large/train/row_99414 | 59 | 114 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0088, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0263, 0.0088, 0, 0.66, 0.0625, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0351, 0.0088, 0, 0.66, 0.125, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0439, 0.0088, 0, 0.66, 0.1875, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0526, 0.0088, 0, 0.66, 0.25, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0614, 0.0088, 0, 0.66, 0.3125, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0702, 0.0088, 0, 0.66, 0.375, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Import_L9_C0", "label": "rospy import rospy", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0789, 0.0088, 0, 0.66, 0.4375, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Import_L11_C0", "label": "smach import smach", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0965, 0.0088, 0, 0.66, 0.5, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Import_L12_C0", "label": "actionlib import actionlib", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0088, 0, 0.66, 0.5625, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:ImportFrom_L14_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1228, 0.0088, 0, 0.66, 0.625, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:ImportFrom_L15_C0", "label": "from rfid_demos import sm_rfid_explore", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1316, 0.0088, 0, 0.66, 0.6875, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "rfid_demos", "arg_names": [], "import_names": ["sm_rfid_explore"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_demos import sm_rfid_explore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:ImportFrom_L16_C0", "label": "from rfid_behaviors import recorder", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1404, 0.0088, 0, 0.66, 0.75, 746, 0, 1, 0, 0, 746, 0, 0], "semantic": {"name": "rfid_behaviors", "arg_names": [], "import_names": ["recorder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors import recorder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:ImportFrom_L17_C0", "label": "from hrl_lib import util", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1491, 0.0088, 0, 0.66, 0.8125, 649, 0, 1, 0, 0, 649, 0, 0], "semantic": {"name": "hrl_lib", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_lib import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:ImportFrom_L18_C0", "label": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0088, 0, 0.66, 0.875, 252, 0, 2, 0, 0, 252, 0, 0], "semantic": {"name": "rfid_datacapture.srv", "arg_names": [], "import_names": ["BagCapture", "BagCaptureRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:ClassDef_L20_C0", "label": "DummyClass", "type": "class", "loc": [20, 22], "level": 0, "parent": null, "vector": [3, 0, 0.1842, 0.0263, 0, 0.66, 0.9375, 9, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "DummyClass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DummyClass():\n def __init__(self, tagid):\n self.tagid = tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:FunctionDef_L21_C4", "label": "__init__", "type": "function", "loc": [21, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:ClassDef_L20_C0", "vector": [2, 1, 0.1886, 0.0175, 1, 0.53, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "tagid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, tagid):\n self.tagid = tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L22_C8", "label": "self.tagid =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:FunctionDef_L21_C4", "vector": [14, 2, 0.193, 0.0088, 2, 0.84, 0.0, 251, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tagid = tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "label": "if", "type": "if", "loc": [24, 113], "level": 0, "parent": null, "vector": [4, 0, 0.6009, 0.7895, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 33], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--fname', action='store', type='string', dest='fname',\n help='File name. Should be without extension. [eg. \\'trial\\']', default='')\n p.add_option('--radius', action='store', type='float', dest='radius',\n help='Exploration radius in meters.', default=4.0)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Import_L25_C4", "label": "optparse import optparse", "type": "import", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [1, 1, 0.2193, 0.0088, 1, 0.95, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L26_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.2281, 0.0088, 1, 0.95, 0.0455, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L27_C4", "label": "add_option()", "type": "expression", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.2412, 0.0175, 1, 0.95, 0.0909, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--fname', action='store', type='string', dest='fname',\n help='File name. Should be without extension. [eg. \\'trial\\']', default='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L29_C4", "label": "add_option()", "type": "expression", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.2588, 0.0175, 1, 0.95, 0.1364, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--radius', action='store', type='float', dest='radius',\n help='Exploration radius in meters.', default=4.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L32_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.2807, 0.0088, 1, 0.95, 0.1818, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L34_C4", "label": "if", "type": "if", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [4, 1, 0.307, 0.0263, 1, 0.95, 0.2273, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.fname == '':\n print('Fname required')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L35_C8", "label": "print()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L34_C4", "vector": [8, 2, 0.307, 0.0088, 2, 0.19, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Fname required')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L36_C8", "label": "exit()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L34_C4", "vector": [8, 2, 0.3158, 0.0088, 2, 0.19, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L37_C4", "label": "fname_base =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.3246, 0.0088, 1, 0.95, 0.2727, 962, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fname_base", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname_base = '/u/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/search_aware_home/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L38_C4", "label": "fname =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.3333, 0.0088, 1, 0.95, 0.3182, 190, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = fname_base + opt.fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L42_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [42, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.386, 0.0439, 1, 0.95, 0.3636, 21, 3, 2, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],\n input_keys = [ 'bagfile_name',\n 'bagfile_topics',\n 'tagid',\n 'explore_radius' ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L48_C8", "label": "add()", "type": "expression", "loc": [48, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.4518, 0.0702, 1, 0.95, 0.0, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'START_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request_slots = ['topics','dest'] ),\n remapping = {'topics':'bagfile_topics',\n 'dest':'bagfile_name'},\n transitions = {'succeeded':'SEARCH'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L57_C8", "label": "sm_search = sm_search()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.5, 0.0088, 1, 0.95, 0.3333, 542, 3, 0, 0, 0, 542, 10, 1], "semantic": {"name": "sm_search", "arg_names": [], "import_names": [], "rhs_call_name": "sm_search", "annotation": ""}, "snippet": " sm_search = sm_rfid_explore.sm_search()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L59_C8", "label": "add()", "type": "expression", "loc": [59, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.5395, 0.0526, 1, 0.95, 0.6667, 241, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'SEARCH',\n sm_search,\n transitions = {'succeeded':'STOP_BAG_CAPTURE'},\n remapping = {'tagid':'tagid',\n 'explore_radius':'explore_radius'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L66_C8", "label": "add()", "type": "expression", "loc": [66, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.6009, 0.0526, 1, 0.95, 1.0, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'STOP_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request = BagCaptureRequest('','') ),\n transitions = {'succeeded':'succeeded'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L75_C4", "label": "init_node()", "type": "expression", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.6579, 0.0088, 1, 0.95, 0.4091, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('smach_datacap_rfid_explore')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L77_C4", "label": "rec = Recorder()", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.6754, 0.0088, 1, 0.95, 0.4545, 100, 3, 2, 0, 0, 495, 10, 1], "semantic": {"name": "rec", "arg_names": [], "import_names": [], "rhs_call_name": "Recorder", "annotation": ""}, "snippet": " rec = recorder.Recorder( serv_name = 'temp_recorder', node_name = 'temp_recorder_py' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L78_C4", "label": "process_service()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.6842, 0.0088, 1, 0.95, 0.5, 430, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_service", "arg_names": [], "import_names": [], "rhs_call_name": "process_service", "annotation": ""}, "snippet": " rec.process_service( None ) # start recording"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L81_C4", "label": "sm.userdata.tagid =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.7105, 0.0088, 1, 0.95, 0.5455, 452, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sm.userdata.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.tagid = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L82_C4", "label": "sm.userdata.explore_radius =", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.7193, 0.0088, 1, 0.95, 0.5909, 383, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sm.userdata.explore_radius", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.explore_radius = opt.radius"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L83_C4", "label": "sm.userdata.bagfile_name =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.7281, 0.0088, 1, 0.95, 0.6364, 565, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sm.userdata.bagfile_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.bagfile_name = fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L84_C4", "label": "sm.userdata.bagfile_topics =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.7368, 0.0088, 1, 0.95, 0.6818, 446, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sm.userdata.bagfile_topics", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.bagfile_topics = '/tf /visarr /rfid/ears_reader /rfid/ears_reader_arr /map /robot_pose_ekf/odom_combined'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L86_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.7544, 0.0088, 1, 0.95, 0.7273, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L88_C4", "label": "process_service()", "type": "expression", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.7719, 0.0088, 1, 0.95, 0.7727, 430, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_service", "arg_names": [], "import_names": [], "rhs_call_name": "process_service", "annotation": ""}, "snippet": " rec.process_service( None ) # stop recording"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.7895, 0.0088, 1, 0.95, 0.8182, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Saving recorder pickle data.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L91_C4", "label": "save_pickle()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.7982, 0.0088, 1, 0.95, 0.8636, 390, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save_pickle", "arg_names": [], "import_names": [], "rhs_call_name": "save_pickle", "annotation": ""}, "snippet": " util.save_pickle( rec.recorder_data, fname + '_reads.pkl' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L93_C4", "label": "print()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [8, 1, 0.8158, 0.0088, 1, 0.95, 0.9091, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Saving best read locations.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L94_C4", "label": "tagids =", "type": "assigned_variable", "loc": [94, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [14, 1, 0.8333, 0.0263, 1, 0.95, 0.9545, 635, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "tagids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tagids = ['OrangeMedBot','TravisTVremo','RedBottle ',\n 'OnMetalKeys ','WhiteMedsBot','BlueMedsBox ',\n 'TeddyBearToy','CordlessPhon','BlueHairBrus']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:For_L98_C4", "label": "for t", "type": "for", "loc": [98, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "vector": [6, 1, 0.9254, 0.1404, 1, 0.95, 1.0, 15, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in tagids:\n print('\\tTagid: \\'%s\\'' % t,)\n tname = t.replace( ' ', '' )\n\n try:\n pos = rec.bestvantage( DummyClass( t ))\n pos.header.stamp = rospy.Time(0)\n dat = pos.__str__() + '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L99_C8", "label": "print()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:For_L98_C4", "vector": [8, 2, 0.8684, 0.0088, 2, 0.76, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tTagid: \\'%s\\'' % t,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L100_C8", "label": "tname = replace()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:For_L98_C4", "vector": [14, 2, 0.8772, 0.0088, 2, 0.76, 0.5, 985, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "tname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tname = t.replace( ' ', '' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "label": "try", "type": "try", "loc": [102, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:For_L98_C4", "vector": [7, 2, 0.943, 0.1053, 2, 0.76, 1.0, 0, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n pos = rec.bestvantage( DummyClass( t ))\n pos.header.stamp = rospy.Time(0)\n dat = pos.__str__() + '\\n'\n\n f = open( fname + '_tag_' + tname + '.yaml', 'w' )\n f.write( dat )\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L103_C12", "label": "pos = bestvantage()", "type": "assigned_variable", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "vector": [14, 3, 0.9035, 0.0088, 3, 0.52, 0.0, 627, 3, 1, 0, 0, 412, 10, 2], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "bestvantage", "annotation": ""}, "snippet": " pos = rec.bestvantage( DummyClass( t ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L104_C12", "label": "pos.header.stamp = Time()", "type": "assigned_variable", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "vector": [14, 3, 0.9123, 0.0088, 3, 0.52, 0.1667, 876, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "pos.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " pos.header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L105_C12", "label": "dat =", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "vector": [14, 3, 0.9211, 0.0088, 3, 0.52, 0.3333, 934, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dat = pos.__str__() + '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L107_C12", "label": "f = open()", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "vector": [14, 3, 0.9386, 0.0088, 3, 0.52, 0.5, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname + '_tag_' + tname + '.yaml', 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L108_C12", "label": "write()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "vector": [8, 3, 0.9474, 0.0088, 3, 0.52, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write( dat )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L109_C12", "label": "close()", "type": "expression", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "vector": [8, 3, 0.9561, 0.0088, 3, 0.52, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L110_C12", "label": "print()", "type": "expression", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "vector": [8, 3, 0.9649, 0.0088, 3, 0.52, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' Done.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L112_C12", "label": "print()", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "vector": [8, 3, 0.9825, 0.0088, 3, 0.52, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' NO READS. Done.')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99414:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Import_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:For_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:For_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:For_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:For_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99414:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99414:Expr_L112_C12"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('tf')
roslib.load_manifest('sensor_msgs')
roslib.load_manifest('visualization_msgs')
import rospy
import cPickle as pkl
import hrl_lib.rutils as ru
import hrl_lib.viz as viz
import sensor_msgs.msg as sm
import numpy as np, math
import sm_aware_home_explore as ahe
import visualization_msgs.msg as vm
import glob
import json
import yaml
import time
import os
def publish_readings( trial, obj, pub_time = 30e3, screen_cap = False ):
loc = ( trial + obj ) % 9
fname = 'search_aware_home/woot_150_'+str(trial)+'_reads.pkl'
f = open( fname, 'r' )
r = pkl.load(f)
f.close()
rospy.init_node( 'starter_woot' )
vsm = viz.single_marker
# RFID readings
pos = [ vsm( np.matrix([ p.ps_ant_map.pose.position.x,
p.ps_ant_map.pose.position.y,
p.ps_ant_map.pose.position.z ]).T,
np.matrix([ p.ps_ant_map.pose.orientation.x,
p.ps_ant_map.pose.orientation.y,
p.ps_ant_map.pose.orientation.z,
p.ps_ant_map.pose.orientation.w ]).T,
'arrow', '/map',
color = [1.0, 0.0, 0.0, 0.8], # rgba,
duration = 10.0,
m_id = i )
for i,p in enumerate( r )
if p.read.rssi != -1 and p.read.tagID == ahe.tdb[obj][0] ]
neg = [ vsm( np.matrix([ p.ps_ant_map.pose.position.x,
p.ps_ant_map.pose.position.y,
p.ps_ant_map.pose.position.z ]).T,
np.matrix([ p.ps_ant_map.pose.orientation.x,
p.ps_ant_map.pose.orientation.y,
p.ps_ant_map.pose.orientation.z,
p.ps_ant_map.pose.orientation.w ]).T,
'arrow', '/map',
color = [0.2, 0.2, 0.2, 0.2], # rgba
duration = 10.0,
m_id = i + len(r) )
for i,p in enumerate( r )
if p.read.tagID != ahe.tdb[obj] ] # for no-read or other tag reads
print 'Pos: ', len(pos), '\nNeg: ', len(neg)
# Robot Trajectory
tm = [ vsm( np.matrix([ ahe.pts[loc][1][0],
ahe.pts[loc][1][1],
ahe.pts[loc][1][2] ]).T,
np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),
'sphere', '/map',
color = [0.0, 1.0, 0.0, 1.0], # rgba
duration = 10.0,
m_id = 2*len(r) + 1 )]
xyz = np.array([ [p.ps_base_map.pose.position.x,
p.ps_base_map.pose.position.y,
p.ps_base_map.pose.position.z ] for p in r ]).T
pts = ru.np_to_pointcloud( xyz, '/map' )
pub_pts = rospy.Publisher( '/robot_traj', sm.PointCloud )
pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )
# Search and Servo Positions
obj_name = ahe.tdb[obj][0] # tagID
tname = obj_name.replace( ' ', '' )
# "Best" Location determined by search
search_fname = 'search_aware_home/woot_150_' + str(trial) + '_tag_' + tname + '.yaml'
try:
f = open( search_fname )
except:
return
y = yaml.load( f )
f.close()
search = [ vsm( np.matrix([ y['pose']['position']['x'],
y['pose']['position']['y'],
y['pose']['position']['z'] ]).T,
np.matrix([ y['pose']['orientation']['x'],
y['pose']['orientation']['y'],
y['pose']['orientation']['z'],
y['pose']['orientation']['w'] ]).T,
'arrow', '/map',
scale = [0.5, 1.0, 1.0],
color = [255./255, 123./255, 1./255, 1.0], # rgba
duration = 10.0,
m_id = 2 * len(r) + 2 )]
# Location after Servoing
servo_fname = 'search_aware_home/woot_150_' + str(trial) + '_tag_' + tname + '_end.txt'
try:
f = open( servo_fname )
except:
return
y = f.readlines()
f.close()
# ['At time 1313069718.853\n',
# '- Translation: [2.811, 1.711, 0.051]\n',
# '- Rotation: in Quaternion [0.003, 0.001, -0.114, 0.993]\n',
# ' in RPY [0.005, 0.003, -0.229]\n',
# 'At time 1313069719.853\n',
# '- Translation: [2.811, 1.711, 0.051]\n',
# '- Rotation: in Quaternion [0.003, 0.001, -0.114, 0.993]\n',
# ' in RPY [0.005, 0.002, -0.229]\n']
quat = y[-2].find('Quaternion')+10
quat_list = json.loads( y[-2][quat:] )
sloc = y[-3].find('tion:')+5
sloc_list = json.loads( y[-3][sloc:] )
servo = [ vsm( np.matrix([ sloc_list ]).T,
np.matrix([ quat_list ]).T,
'arrow', '/map',
scale = [0.5, 1.0, 1.0],
color = [0./255, 205./255, 255./255, 1.0], # rgba
duration = 10.0,
m_id = 2 * len(r) + 3 )]
marks = neg + pos + tm + search + servo
t0 = time.time()
while time.time() - t0 < pub_time and not rospy.is_shutdown():
pts.header.stamp = rospy.Time.now()
pub_pts.publish( pts )
[ pub_mark.publish( x ) for x in marks ]
rospy.sleep( 1.0 )
if screen_cap:
os.system( 'scrot -d 2 -u Obj%d_Trial%d.png' % ( obj, trial ))
print 'Closing down... letting markers expire'
rospy.sleep( 15 )
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
# p.add_option('--fname', action='store', type='string', dest='fname',
# help='File name. Should be woot_150_x_reads.pkl', default='')
p.add_option('--trial', action='store', type='int', dest='trial',
help='trial number (0-8)')
p.add_option('--obj', action='store', type='int', dest='obj',
help='object number (0-8)')
# p.add_option('--loc', action='store', type='int', dest='loc',
# help='location number (0-8)')
opt, args = p.parse_args()
if opt.trial < 9:
publish_readings( opt.trial, opt.obj )
else:
print 'Click on RVIZ!'
time.sleep( 3 )
#for trial in xrange(9):
for trial in [1]:
#for obj in xrange(9):
for obj in [6]:
print 'Change screen to RVIZ. Starting %d, %d' % (trial, obj)
publish_readings( trial, obj, 15, screen_cap = True )
| ajibawa-2023/Python-Code-Large/train/row_99415 | 84 | 202 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0099, 0.005, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0149, 0.005, 0, 0.66, 0.0417, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0198, 0.005, 0, 0.66, 0.0833, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0248, 0.005, 0, 0.66, 0.125, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0297, 0.005, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0347, 0.005, 0, 0.66, 0.2083, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0396, 0.005, 0, 0.66, 0.25, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0446, 0.005, 0, 0.66, 0.2917, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0495, 0.005, 0, 0.66, 0.3333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('sensor_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L11_C0", "label": "load_manifest()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0545, 0.005, 0, 0.66, 0.375, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('visualization_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L12_C0", "label": "rospy import rospy", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0594, 0.005, 0, 0.66, 0.4167, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L14_C0", "label": "cPickle import pkl", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0693, 0.005, 0, 0.66, 0.4583, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L15_C0", "label": "hrl_lib.rutils import ru", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0743, 0.005, 0, 0.66, 0.5, 847, 0, 1, 0, 0, 847, 0, 0], "semantic": {"name": "hrl_lib.rutils", "arg_names": [], "import_names": ["ru"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.rutils as ru"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L16_C0", "label": "hrl_lib.viz import viz", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0792, 0.005, 0, 0.66, 0.5417, 48, 0, 1, 0, 0, 48, 0, 0], "semantic": {"name": "hrl_lib.viz", "arg_names": [], "import_names": ["viz"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.viz as viz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L17_C0", "label": "sensor_msgs.msg import sm", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0842, 0.005, 0, 0.66, 0.5833, 531, 0, 1, 0, 0, 531, 0, 0], "semantic": {"name": "sensor_msgs.msg", "arg_names": [], "import_names": ["sm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sensor_msgs.msg as sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L18_C0", "label": "numpy import np, math", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0891, 0.005, 0, 0.66, 0.625, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L19_C0", "label": "sm_aware_home_explore import ahe", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0941, 0.005, 0, 0.66, 0.6667, 54, 0, 1, 0, 0, 54, 0, 0], "semantic": {"name": "sm_aware_home_explore", "arg_names": [], "import_names": ["ahe"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sm_aware_home_explore as ahe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L20_C0", "label": "visualization_msgs.msg import vm", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.099, 0.005, 0, 0.66, 0.7083, 124, 0, 1, 0, 0, 124, 0, 0], "semantic": {"name": "visualization_msgs.msg", "arg_names": [], "import_names": ["vm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import visualization_msgs.msg as vm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L21_C0", "label": "glob import glob", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.104, 0.005, 0, 0.66, 0.75, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L22_C0", "label": "json import json", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1089, 0.005, 0, 0.66, 0.7917, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L23_C0", "label": "yaml import yaml", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1139, 0.005, 0, 0.66, 0.8333, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L24_C0", "label": "time import time", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1188, 0.005, 0, 0.66, 0.875, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L25_C0", "label": "os import os", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1238, 0.005, 0, 0.66, 0.9167, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "label": "publish_readings", "type": "function", "loc": [28, 172], "level": 0, "parent": null, "vector": [2, 0, 0.495, 0.7178, 0, 0.66, 0.9583, 150, 0, 4, 0, 0, 0, 0, 56], "semantic": {"name": "publish_readings", "arg_names": ["trial", "obj", "pub_time", "screen_cap"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def publish_readings( trial, obj, pub_time = 30e3, screen_cap = False ):\n loc = ( trial + obj ) % 9\n\n fname = 'search_aware_home/woot_150_'+str(trial)+'_reads.pkl'\n \n f = open( fname, 'r' )\n r = pkl.load(f)\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L29_C4", "label": "loc =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.1436, 0.005, 1, 0.43, 0.0, 822, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc = ( trial + obj ) % 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L31_C4", "label": "fname =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.1535, 0.005, 1, 0.43, 0.0278, 190, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = 'search_aware_home/woot_150_'+str(trial)+'_reads.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L33_C4", "label": "f = open()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.1634, 0.005, 1, 0.43, 0.0556, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L34_C4", "label": "r = load()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.1683, 0.005, 1, 0.43, 0.0833, 436, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " r = pkl.load(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L35_C4", "label": "close()", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [8, 1, 0.1733, 0.005, 1, 0.43, 0.1111, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L37_C4", "label": "init_node()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [8, 1, 0.1832, 0.005, 1, 0.43, 0.1389, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'starter_woot' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L39_C4", "label": "vsm =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.1931, 0.005, 1, 0.43, 0.1667, 910, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vsm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vsm = viz.single_marker"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L43_C4", "label": "pos =", "type": "assigned_variable", "loc": [43, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.2426, 0.0644, 1, 0.43, 0.1944, 627, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = [ vsm( np.matrix([ p.ps_ant_map.pose.position.x,\n p.ps_ant_map.pose.position.y,\n p.ps_ant_map.pose.position.z ]).T,\n np.matrix([ p.ps_ant_map.pose.orientation.x,\n p.ps_ant_map.pose.orientation.y,\n p.ps_ant_map.pose.orientation.z,\n p.ps_ant_map.pose.orientation.w ]).T,\n 'arrow', '/map',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L57_C4", "label": "neg =", "type": "assigned_variable", "loc": [57, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.3119, 0.0644, 1, 0.43, 0.2222, 801, 5, 0, 0, 0, 0, 0, 5], "semantic": {"name": "neg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " neg = [ vsm( np.matrix([ p.ps_ant_map.pose.position.x,\n p.ps_ant_map.pose.position.y,\n p.ps_ant_map.pose.position.z ]).T,\n np.matrix([ p.ps_ant_map.pose.orientation.x,\n p.ps_ant_map.pose.orientation.y,\n p.ps_ant_map.pose.orientation.z,\n p.ps_ant_map.pose.orientation.w ]).T,\n 'arrow', '/map',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L71_C4", "label": "print()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [8, 1, 0.3515, 0.005, 1, 0.43, 0.25, 535, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Pos: ', len(pos), '\\nNeg: ', len(neg))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L75_C4", "label": "tm =", "type": "assigned_variable", "loc": [75, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.3886, 0.0396, 1, 0.43, 0.2778, 404, 0, 0, 0, 0, 0, 5, 4], "semantic": {"name": "tm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tm = [ vsm( np.matrix([ ahe.pts[loc][1][0],\n ahe.pts[loc][1][1],\n ahe.pts[loc][1][2] ]).T,\n np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),\n 'sphere', '/map',\n color = [0.0, 1.0, 0.0, 1.0], # rgba\n duration = 10.0,\n m_id = 2*len(r) + 1 )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L84_C4", "label": "xyz =", "type": "assigned_variable", "loc": [84, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.4208, 0.0149, 1, 0.43, 0.3056, 164, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xyz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xyz = np.array([ [p.ps_base_map.pose.position.x,\n p.ps_base_map.pose.position.y,\n p.ps_base_map.pose.position.z ] for p in r ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L87_C4", "label": "pts = np_to_pointcloud()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.4307, 0.005, 1, 0.43, 0.3333, 195, 3, 2, 0, 0, 712, 10, 1], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "np_to_pointcloud", "annotation": ""}, "snippet": " pts = ru.np_to_pointcloud( xyz, '/map' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L89_C4", "label": "pub_pts = Publisher()", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.4406, 0.005, 1, 0.43, 0.3611, 427, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub_pts", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " pub_pts = rospy.Publisher( '/robot_traj', sm.PointCloud )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L90_C4", "label": "pub_mark = Publisher()", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.4455, 0.005, 1, 0.43, 0.3889, 577, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub_mark", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L95_C4", "label": "obj_name =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.4703, 0.005, 1, 0.43, 0.4167, 412, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_name = ahe.tdb[obj][0] # tagID"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L96_C4", "label": "tname = replace()", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.4752, 0.005, 1, 0.43, 0.4444, 985, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "tname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tname = obj_name.replace( ' ', '' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L100_C4", "label": "search_fname =", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.495, 0.005, 1, 0.43, 0.4722, 19, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "search_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search_fname = 'search_aware_home/woot_150_' + str(trial) + '_tag_' + tname + '.yaml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L101_C4", "label": "try", "type": "try", "loc": [101, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [7, 1, 0.5074, 0.0198, 1, 0.43, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n f = open( search_fname )\n except:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L102_C8", "label": "f = open()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L101_C4", "vector": [14, 2, 0.505, 0.005, 2, 0.28, 0.0, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( search_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Return_L104_C8", "label": "return", "type": "return", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L101_C4", "vector": [13, 2, 0.5149, 0.005, 2, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L106_C4", "label": "y = load()", "type": "assigned_variable", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.5248, 0.005, 1, 0.43, 0.5278, 304, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " y = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L107_C4", "label": "close()", "type": "expression", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [8, 1, 0.5297, 0.005, 1, 0.43, 0.5556, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L109_C4", "label": "search =", "type": "assigned_variable", "loc": [109, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.5668, 0.0594, 1, 0.43, 0.5833, 163, 0, 0, 0, 0, 0, 5, 4], "semantic": {"name": "search", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search = [ vsm( np.matrix([ y['pose']['position']['x'],\n y['pose']['position']['y'],\n y['pose']['position']['z'] ]).T,\n np.matrix([ y['pose']['orientation']['x'],\n y['pose']['orientation']['y'],\n y['pose']['orientation']['z'],\n y['pose']['orientation']['w'] ]).T,\n 'arrow', '/map',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L124_C4", "label": "servo_fname =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.6139, 0.005, 1, 0.43, 0.6111, 192, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "servo_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_fname = 'search_aware_home/woot_150_' + str(trial) + '_tag_' + tname + '_end.txt'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L126_C4", "label": "try", "type": "try", "loc": [126, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [7, 1, 0.6312, 0.0198, 1, 0.43, 0.6389, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n f = open( servo_fname )\n except:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L127_C8", "label": "f = open()", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L126_C4", "vector": [14, 2, 0.6287, 0.005, 2, 0.9, 0.0, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( servo_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Return_L129_C8", "label": "return", "type": "return", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L126_C4", "vector": [13, 2, 0.6386, 0.005, 2, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L130_C4", "label": "y = readlines()", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.6436, 0.005, 1, 0.43, 0.6667, 304, 3, 0, 0, 0, 841, 10, 1], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "readlines", "annotation": ""}, "snippet": " y = f.readlines()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L131_C4", "label": "close()", "type": "expression", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [8, 1, 0.6485, 0.005, 1, 0.43, 0.6944, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L141_C4", "label": "quat =", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.698, 0.005, 1, 0.43, 0.7222, 367, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "quat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " quat = y[-2].find('Quaternion')+10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L142_C4", "label": "quat_list = loads()", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.703, 0.005, 1, 0.43, 0.75, 508, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "quat_list", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " quat_list = json.loads( y[-2][quat:] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L144_C4", "label": "sloc =", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.7129, 0.005, 1, 0.43, 0.7778, 988, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sloc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sloc = y[-3].find('tion:')+5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L145_C4", "label": "sloc_list = loads()", "type": "assigned_variable", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.7178, 0.005, 1, 0.43, 0.8056, 696, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "sloc_list", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " sloc_list = json.loads( y[-3][sloc:] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L148_C4", "label": "servo =", "type": "assigned_variable", "loc": [148, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.7475, 0.0347, 1, 0.43, 0.8333, 604, 0, 0, 0, 0, 0, 5, 4], "semantic": {"name": "servo", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo = [ vsm( np.matrix([ sloc_list ]).T,\n np.matrix([ quat_list ]).T,\n 'arrow', '/map',\n scale = [0.5, 1.0, 1.0],\n color = [0./255, 205./255, 255./255, 1.0], # rgba\n duration = 10.0,\n m_id = 2 * len(r) + 3 )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L157_C4", "label": "marks =", "type": "assigned_variable", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.7772, 0.005, 1, 0.43, 0.8611, 22, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "marks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " marks = neg + pos + tm + search + servo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L159_C4", "label": "t0 = time()", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [14, 1, 0.7871, 0.005, 1, 0.43, 0.8889, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "label": "while", "type": "while", "loc": [160, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [5, 1, 0.8045, 0.0297, 1, 0.43, 0.9167, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while time.time() - t0 < pub_time and not rospy.is_shutdown():\n pts.header.stamp = rospy.Time.now()\n pub_pts.publish( pts )\n \n [ pub_mark.publish( x ) for x in marks ]\n rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L161_C8", "label": "pts.header.stamp = now()", "type": "assigned_variable", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "vector": [14, 2, 0.797, 0.005, 2, 0.72, 0.0, 489, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "pts.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " pts.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L162_C8", "label": "publish()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "vector": [8, 2, 0.802, 0.005, 2, 0.72, 0.3333, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " pub_pts.publish( pts )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L164_C8", "label": "expression", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "vector": [8, 2, 0.8119, 0.005, 2, 0.72, 0.6667, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [ pub_mark.publish( x ) for x in marks ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L165_C8", "label": "sleep()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "vector": [8, 2, 0.8168, 0.005, 2, 0.72, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L167_C4", "label": "if", "type": "if", "loc": [167, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [4, 1, 0.8292, 0.0099, 1, 0.43, 0.9444, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if screen_cap:\n os.system( 'scrot -d 2 -u Obj%d_Trial%d.png' % ( obj, trial ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L168_C8", "label": "system()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L167_C4", "vector": [8, 2, 0.8317, 0.005, 2, 0.59, 0.0, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system( 'scrot -d 2 -u Obj%d_Trial%d.png' % ( obj, trial ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L171_C4", "label": "print()", "type": "expression", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [8, 1, 0.8465, 0.005, 1, 0.43, 0.9722, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Closing down... letting markers expire')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L172_C4", "label": "sleep()", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "vector": [8, 1, 0.8515, 0.005, 1, 0.43, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 15 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "label": "if", "type": "if", "loc": [176, 200], "level": 0, "parent": null, "vector": [4, 0, 0.9307, 0.1238, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n # p.add_option('--fname', action='store', type='string', dest='fname',\n # help='File name. Should be woot_150_x_reads.pkl', default='')\n p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')\n p.add_option('--obj', action='store', type='int', dest='obj',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L177_C4", "label": "optparse import optparse", "type": "import", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "vector": [1, 1, 0.8762, 0.005, 1, 0.58, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L178_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "vector": [14, 1, 0.8812, 0.005, 1, 0.58, 0.2, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L181_C4", "label": "add_option()", "type": "expression", "loc": [181, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "vector": [8, 1, 0.8985, 0.0099, 1, 0.58, 0.4, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L183_C4", "label": "add_option()", "type": "expression", "loc": [183, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "vector": [8, 1, 0.9084, 0.0099, 1, 0.58, 0.6, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--obj', action='store', type='int', dest='obj',\n help='object number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L188_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [188, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "vector": [14, 1, 0.9307, 0.005, 1, 0.58, 0.8, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "label": "if", "type": "if", "loc": [190, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "vector": [4, 1, 0.9653, 0.0545, 1, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.trial < 9:\n publish_readings( opt.trial, opt.obj )\n else:\n print('Click on RVIZ!')\n time.sleep( 3 )\n #for trial in xrange(9):\n for trial in [1]:\n #for obj in xrange(9):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L191_C8", "label": "publish_readings()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "vector": [8, 2, 0.9455, 0.005, 2, 0.79, 0.0, 150, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "publish_readings", "arg_names": [], "import_names": [], "rhs_call_name": "publish_readings", "annotation": ""}, "snippet": " publish_readings( opt.trial, opt.obj )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L193_C8", "label": "print()", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "vector": [8, 2, 0.9554, 0.005, 2, 0.79, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Click on RVIZ!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L194_C8", "label": "sleep()", "type": "expression", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "vector": [8, 2, 0.9604, 0.005, 2, 0.79, 0.6667, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L196_C8", "label": "for trial", "type": "for", "loc": [196, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "vector": [6, 2, 0.9802, 0.0248, 2, 0.79, 1.0, 437, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "trial", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for trial in [1]:\n #for obj in xrange(9):\n for obj in [6]:\n print('Change screen to RVIZ. Starting %d, %d' % (trial, obj))\n publish_readings( trial, obj, 15, screen_cap = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L198_C12", "label": "for obj", "type": "for", "loc": [198, 200], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L196_C8", "vector": [6, 3, 0.9851, 0.0149, 3, 0.97, 0.0, 505, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in [6]:\n print('Change screen to RVIZ. Starting %d, %d' % (trial, obj))\n publish_readings( trial, obj, 15, screen_cap = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L199_C16", "label": "print()", "type": "expression", "loc": [199, 199], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L198_C12", "vector": [8, 4, 0.9851, 0.005, 4, 0.59, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Change screen to RVIZ. Starting %d, %d' % (trial, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L200_C16", "label": "publish_readings()", "type": "expression", "loc": [200, 200], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L198_C12", "vector": [8, 4, 0.9901, 0.005, 4, 0.59, 1.0, 150, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "publish_readings", "arg_names": [], "import_names": [], "rhs_call_name": "publish_readings", "annotation": ""}, "snippet": " publish_readings( trial, obj, 15, screen_cap = True )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Return_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:Try_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Return_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:While_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Import_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Assign_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:If_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L198_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L198_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L199_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99415:For_L198_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99415:Expr_L200_C16"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('tf')
roslib.load_manifest('sensor_msgs')
roslib.load_manifest('visualization_msgs')
import rospy
import cPickle as pkl
import hrl_lib.rutils as ru
import hrl_lib.viz as viz
import sensor_msgs.msg as sm
import numpy as np, math
import sm_aware_home_explore as ahe
import visualization_msgs.msg as vm
import tf
import tf.transformations as tft
import glob
import json
import yaml
import time
import os
rospy.init_node( 'derp' )
vsm = viz.single_marker
m_id = 0
# Tags
# tag_pts = np.array([ ahe.pts[k][1] for k in ahe.pts.keys() ]).T
# tm = [ viz.single_marker( tag_pts[:,i].reshape([3,1]),
# np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),
# 'sphere', '/map',
# color=[0.0, 1.0, 0.0, 1.0],
# m_id=i ) for i in xrange( tag_pts.shape[1] )]
# Results:
# 'Obj5_Trial8_Servo1_rel_results.pkl'
# {'best_pos': array([-2.165, 0.979, 0.055]),
# 'dtheta': 0.041245071031409619,
# 'dxy': 1.1365249667297239,
# 'loc': 7,
# 'obj_num': 5,
# 'orient_est': 2.8607549289685905,
# 'pos_readings': 717,
# 'servo_yn': True,
# 'tot_readings': 3580,
# 'trial_num': 2}
fnames = glob.glob('Obj[0-9]_Trial[0-9]_Servo1_rel_results.pkl')
def load( fn ):
f = open( fn )
dat = pkl.load( f )
f.close()
return dat
d = [ load( f ) for f in fnames ]
d = [ di for di in d if di['pos_readings'] > 0 ]
def arrow( m_id, res_dict, color ):
m = vsm( np.matrix([ res_dict['best_pos'] ]).T,
np.matrix([ tft.quaternion_from_euler( 0.0,
0.0,
res_dict['orient_est']) ]).T,
'arrow', '/map',
scale = [0.5, 1.0, 1.0],
color = color, # rgba
duration = 10.0,
m_id = m_id )
# color = [0./255, 205./255, 255./255, 1.0], # rgba
return m
pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )
tag_spheres = []
servo_arrows = []
def hextorgba( h ):
return h * 1.0 / 255.0
colors = [ [ hextorgba( i ) for i in [ 0x00, 0x99, 0x00, 0xFF ]], # green
[ hextorgba( i ) for i in [ 0xEE, 0x00, 0x00, 0xFF ]], # red
[ hextorgba( i ) for i in [ 0x00, 0xCC, 0xFF, 0xFF ]]] # teal
for loc in range( 0, 9 ):
m_id += 1
color = colors[ loc % len(colors) ]
tag_spheres.append( vsm( np.matrix([ ahe.pts[loc][1][0],
ahe.pts[loc][1][1],
ahe.pts[loc][1][2] ]).T,
np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),
'sphere', '/map',
color = color, # rgba
duration = 10.0,
m_id = m_id ))
for di in d:
if di['loc'] == loc:
m_id += 1
servo_arrows.append( arrow( m_id, di, color ))
marks = tag_spheres + servo_arrows
while not rospy.is_shutdown():
[ pub_mark.publish( x ) for x in marks ]
rospy.sleep( 1.0 )
print 'WOOT'
| ajibawa-2023/Python-Code-Large/train/row_99416 | 56 | 115 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0174, 0.0087, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0261, 0.0087, 0, 0.66, 0.025, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0348, 0.0087, 0, 0.66, 0.05, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0435, 0.0087, 0, 0.66, 0.075, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0522, 0.0087, 0, 0.66, 0.1, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0609, 0.0087, 0, 0.66, 0.125, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0696, 0.0087, 0, 0.66, 0.15, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0783, 0.0087, 0, 0.66, 0.175, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.087, 0.0087, 0, 0.66, 0.2, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('sensor_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L11_C0", "label": "load_manifest()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0957, 0.0087, 0, 0.66, 0.225, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('visualization_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L12_C0", "label": "rospy import rospy", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1043, 0.0087, 0, 0.66, 0.25, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L14_C0", "label": "cPickle import pkl", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1217, 0.0087, 0, 0.66, 0.275, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L15_C0", "label": "hrl_lib.rutils import ru", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1304, 0.0087, 0, 0.66, 0.3, 847, 0, 1, 0, 0, 847, 0, 0], "semantic": {"name": "hrl_lib.rutils", "arg_names": [], "import_names": ["ru"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.rutils as ru"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L16_C0", "label": "hrl_lib.viz import viz", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1391, 0.0087, 0, 0.66, 0.325, 48, 0, 1, 0, 0, 48, 0, 0], "semantic": {"name": "hrl_lib.viz", "arg_names": [], "import_names": ["viz"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.viz as viz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L17_C0", "label": "sensor_msgs.msg import sm", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1478, 0.0087, 0, 0.66, 0.35, 531, 0, 1, 0, 0, 531, 0, 0], "semantic": {"name": "sensor_msgs.msg", "arg_names": [], "import_names": ["sm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sensor_msgs.msg as sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L18_C0", "label": "numpy import np, math", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1565, 0.0087, 0, 0.66, 0.375, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L19_C0", "label": "sm_aware_home_explore import ahe", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1652, 0.0087, 0, 0.66, 0.4, 54, 0, 1, 0, 0, 54, 0, 0], "semantic": {"name": "sm_aware_home_explore", "arg_names": [], "import_names": ["ahe"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sm_aware_home_explore as ahe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L20_C0", "label": "visualization_msgs.msg import vm", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1739, 0.0087, 0, 0.66, 0.425, 124, 0, 1, 0, 0, 124, 0, 0], "semantic": {"name": "visualization_msgs.msg", "arg_names": [], "import_names": ["vm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import visualization_msgs.msg as vm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L21_C0", "label": "tf import tf", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1826, 0.0087, 0, 0.66, 0.45, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L22_C0", "label": "tf.transformations import tft", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1913, 0.0087, 0, 0.66, 0.475, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tft"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tft"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L23_C0", "label": "glob import glob", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.0087, 0, 0.66, 0.5, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L24_C0", "label": "json import json", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.2087, 0.0087, 0, 0.66, 0.525, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L25_C0", "label": "yaml import yaml", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.2174, 0.0087, 0, 0.66, 0.55, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L26_C0", "label": "time import time", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.2261, 0.0087, 0, 0.66, 0.575, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Import_L27_C0", "label": "os import os", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.2348, 0.0087, 0, 0.66, 0.6, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L29_C0", "label": "init_node()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.2522, 0.0087, 0, 0.66, 0.625, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": "rospy.init_node( 'derp' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L30_C0", "label": "vsm =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.2609, 0.0087, 0, 0.66, 0.65, 910, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vsm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "vsm = viz.single_marker"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L31_C0", "label": "m_id =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.2696, 0.0087, 0, 0.66, 0.675, 683, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "m_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "m_id = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L53_C0", "label": "fnames = glob()", "type": "assigned_variable", "loc": [53, 53], "level": 0, "parent": null, "vector": [14, 0, 0.4609, 0.0087, 0, 0.66, 0.7, 641, 3, 1, 0, 0, 958, 10, 1], "semantic": {"name": "fnames", "arg_names": [], "import_names": [], "rhs_call_name": "glob", "annotation": ""}, "snippet": "fnames = glob.glob('Obj[0-9]_Trial[0-9]_Servo1_rel_results.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "label": "load", "type": "function", "loc": [54, 58], "level": 0, "parent": null, "vector": [2, 0, 0.487, 0.0435, 0, 0.66, 0.725, 37, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "load", "arg_names": ["fn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load( fn ):\n f = open( fn )\n dat = pkl.load( f )\n f.close()\n return dat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L55_C4", "label": "f = open()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "vector": [14, 1, 0.4783, 0.0087, 1, 0.67, 0.0, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fn )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L56_C4", "label": "dat = load()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "vector": [14, 1, 0.487, 0.0087, 1, 0.67, 0.3333, 934, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "dat", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " dat = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L57_C4", "label": "close()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "vector": [8, 1, 0.4957, 0.0087, 1, 0.67, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "vector": [13, 1, 0.5043, 0.0087, 1, 0.67, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L60_C0", "label": "d =", "type": "assigned_variable", "loc": [60, 60], "level": 0, "parent": null, "vector": [14, 0, 0.5217, 0.0087, 0, 0.66, 0.75, 355, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "d = [ load( f ) for f in fnames ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L61_C0", "label": "d =", "type": "assigned_variable", "loc": [61, 61], "level": 0, "parent": null, "vector": [14, 0, 0.5304, 0.0087, 0, 0.66, 0.775, 355, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "d = [ di for di in d if di['pos_readings'] > 0 ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L63_C0", "label": "arrow", "type": "function", "loc": [63, 75], "level": 0, "parent": null, "vector": [2, 0, 0.6, 0.113, 0, 0.66, 0.8, 635, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "arrow", "arg_names": ["m_id", "res_dict", "color"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def arrow( m_id, res_dict, color ):\n m = vsm( np.matrix([ res_dict['best_pos'] ]).T,\n np.matrix([ tft.quaternion_from_euler( 0.0,\n 0.0,\n res_dict['orient_est']) ]).T,\n 'arrow', '/map',\n scale = [0.5, 1.0, 1.0],\n color = color, # rgba"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L64_C4", "label": "m = vsm()", "type": "assigned_variable", "loc": [64, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L63_C0", "vector": [14, 1, 0.5913, 0.0783, 1, 0.35, 0.0, 711, 3, 8, 0, 0, 910, 10, 4], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "vsm", "annotation": ""}, "snippet": " m = vsm( np.matrix([ res_dict['best_pos'] ]).T,\n np.matrix([ tft.quaternion_from_euler( 0.0,\n 0.0,\n res_dict['orient_est']) ]).T,\n 'arrow', '/map',\n scale = [0.5, 1.0, 1.0],\n color = color, # rgba\n duration = 10.0,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Return_L75_C4", "label": "return", "type": "return", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L63_C0", "vector": [13, 1, 0.6522, 0.0087, 1, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L77_C0", "label": "pub_mark = Publisher()", "type": "assigned_variable", "loc": [77, 77], "level": 0, "parent": null, "vector": [14, 0, 0.6696, 0.0087, 0, 0.66, 0.825, 577, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub_mark", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": "pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L79_C0", "label": "tag_spheres =", "type": "assigned_variable", "loc": [79, 79], "level": 0, "parent": null, "vector": [14, 0, 0.687, 0.0087, 0, 0.66, 0.85, 369, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "tag_spheres", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "tag_spheres = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L80_C0", "label": "servo_arrows =", "type": "assigned_variable", "loc": [80, 80], "level": 0, "parent": null, "vector": [14, 0, 0.6957, 0.0087, 0, 0.66, 0.875, 12, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "servo_arrows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "servo_arrows = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L82_C0", "label": "hextorgba", "type": "function", "loc": [82, 83], "level": 0, "parent": null, "vector": [2, 0, 0.7174, 0.0174, 0, 0.66, 0.9, 631, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "hextorgba", "arg_names": ["h"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def hextorgba( h ):\n return h * 1.0 / 255.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Return_L83_C4", "label": "return", "type": "return", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L82_C0", "vector": [13, 1, 0.7217, 0.0087, 1, 0.69, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return h * 1.0 / 255.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L85_C0", "label": "colors =", "type": "assigned_variable", "loc": [85, 87], "level": 0, "parent": null, "vector": [14, 0, 0.7478, 0.0261, 0, 0.66, 0.925, 656, 0, 0, 0, 0, 0, 5, 3], "semantic": {"name": "colors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "colors = [ [ hextorgba( i ) for i in [ 0x00, 0x99, 0x00, 0xFF ]], # green\n [ hextorgba( i ) for i in [ 0xEE, 0x00, 0x00, 0xFF ]], # red\n [ hextorgba( i ) for i in [ 0x00, 0xCC, 0xFF, 0xFF ]]] # teal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L89_C0", "label": "for loc", "type": "for", "loc": [89, 104], "level": 0, "parent": null, "vector": [6, 0, 0.8391, 0.1391, 0, 0.66, 0.95, 822, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for loc in range( 0, 9 ):\n m_id += 1\n color = colors[ loc % len(colors) ]\n tag_spheres.append( vsm( np.matrix([ ahe.pts[loc][1][0],\n ahe.pts[loc][1][1],\n ahe.pts[loc][1][2] ]).T,\n np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),\n 'sphere', '/map',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L91_C4", "label": "color =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L89_C0", "vector": [14, 1, 0.7913, 0.0087, 1, 0.88, 0.0, 776, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " color = colors[ loc % len(colors) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L92_C4", "label": "append()", "type": "expression", "loc": [92, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L89_C0", "vector": [8, 1, 0.8304, 0.0696, 1, 0.88, 0.5, 243, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " tag_spheres.append( vsm( np.matrix([ ahe.pts[loc][1][0],\n ahe.pts[loc][1][1],\n ahe.pts[loc][1][2] ]).T,\n np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),\n 'sphere', '/map',\n color = color, # rgba\n duration = 10.0,\n m_id = m_id ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L101_C4", "label": "for di", "type": "for", "loc": [101, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L89_C0", "vector": [6, 1, 0.8913, 0.0348, 1, 0.88, 1.0, 700, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "di", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for di in d:\n if di['loc'] == loc:\n m_id += 1\n servo_arrows.append( arrow( m_id, di, color ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:If_L102_C8", "label": "if", "type": "if", "loc": [102, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L101_C4", "vector": [4, 2, 0.8957, 0.0261, 2, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if di['loc'] == loc:\n m_id += 1\n servo_arrows.append( arrow( m_id, di, color ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L104_C12", "label": "append()", "type": "expression", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:If_L102_C8", "vector": [8, 3, 0.9043, 0.0087, 3, 0.16, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " servo_arrows.append( arrow( m_id, di, color ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L108_C0", "label": "marks =", "type": "assigned_variable", "loc": [108, 108], "level": 0, "parent": null, "vector": [14, 0, 0.9391, 0.0087, 0, 0.66, 0.975, 22, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "marks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "marks = tag_spheres + servo_arrows"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:While_L110_C0", "label": "while", "type": "while", "loc": [110, 113], "level": 0, "parent": null, "vector": [5, 0, 0.9696, 0.0348, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while not rospy.is_shutdown():\n [ pub_mark.publish( x ) for x in marks ]\n rospy.sleep( 1.0 )\n print('WOOT')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L111_C4", "label": "expression", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:While_L110_C0", "vector": [8, 1, 0.9652, 0.0087, 1, 0.51, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [ pub_mark.publish( x ) for x in marks ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L112_C4", "label": "sleep()", "type": "expression", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:While_L110_C0", "vector": [8, 1, 0.9739, 0.0087, 1, 0.51, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L113_C4", "label": "print()", "type": "expression", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99416:While_L110_C0", "vector": [8, 1, 0.9826, 0.0087, 1, 0.51, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('WOOT')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Return_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Return_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:For_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:If_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:While_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:While_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99416:While_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99416:Expr_L113_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('tf')
roslib.load_manifest('sensor_msgs')
roslib.load_manifest('visualization_msgs')
import rospy
import cPickle as pkl
import hrl_lib.rutils as ru
import hrl_lib.viz as viz
import sensor_msgs.msg as sm
import numpy as np, math
import sm_aware_home_explore as ahe
import visualization_msgs.msg as vm
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--trial', action='store', type='int', dest='trial',
help='trial number (0-8)')
# p.add_option('--fname', action='store', type='string', dest='fname',
# help='File name. Should be woot_150_x_reads.pkl', default='')
opt, args = p.parse_args()
fname = 'search_aware_home/woot_150_'+str(opt.trial)+'_reads.pkl'
f = open( fname, 'r' )
r = pkl.load(f)
f.close()
xyz = np.array([ [p.ps_base_map.pose.position.x,
p.ps_base_map.pose.position.y,
p.ps_base_map.pose.position.z ] for p in r ]).T
rospy.init_node( 'pub_traj' )
pts = ru.np_to_pointcloud( xyz, '/map' )
pub_pts = rospy.Publisher( '/robot_traj', sm.PointCloud )
pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )
rospy.sleep( 0.5 )
tag_pts = np.array([ ahe.pts[k][1] for k in ahe.pts.keys() ]).T
tm = [ viz.single_marker( tag_pts[:,i].reshape([3,1]),
np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),
'sphere', '/map',
color=[0.0, 1.0, 0.0, 1.0],
m_id=i ) for i in xrange( tag_pts.shape[1] )]
while not rospy.is_shutdown():
pts.header.stamp = rospy.Time.now()
pub_pts.publish( pts )
[ pub_mark.publish( x ) for x in tm ]
rospy.sleep( 1.0 )
| ajibawa-2023/Python-Code-Large/train/row_99417 | 40 | 62 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0161, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0484, 0.0161, 0, 0.66, 0.0556, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0645, 0.0161, 0, 0.66, 0.1111, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0806, 0.0161, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0968, 0.0161, 0, 0.66, 0.2222, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1129, 0.0161, 0, 0.66, 0.2778, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.129, 0.0161, 0, 0.66, 0.3333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.1452, 0.0161, 0, 0.66, 0.3889, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.1613, 0.0161, 0, 0.66, 0.4444, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('sensor_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L11_C0", "label": "load_manifest()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.1774, 0.0161, 0, 0.66, 0.5, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('visualization_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L12_C0", "label": "rospy import rospy", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1935, 0.0161, 0, 0.66, 0.5556, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L14_C0", "label": "cPickle import pkl", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.2258, 0.0161, 0, 0.66, 0.6111, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L15_C0", "label": "hrl_lib.rutils import ru", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.2419, 0.0161, 0, 0.66, 0.6667, 847, 0, 1, 0, 0, 847, 0, 0], "semantic": {"name": "hrl_lib.rutils", "arg_names": [], "import_names": ["ru"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.rutils as ru"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L16_C0", "label": "hrl_lib.viz import viz", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.2581, 0.0161, 0, 0.66, 0.7222, 48, 0, 1, 0, 0, 48, 0, 0], "semantic": {"name": "hrl_lib.viz", "arg_names": [], "import_names": ["viz"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.viz as viz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L17_C0", "label": "sensor_msgs.msg import sm", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2742, 0.0161, 0, 0.66, 0.7778, 531, 0, 1, 0, 0, 531, 0, 0], "semantic": {"name": "sensor_msgs.msg", "arg_names": [], "import_names": ["sm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sensor_msgs.msg as sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L18_C0", "label": "numpy import np, math", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.2903, 0.0161, 0, 0.66, 0.8333, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L19_C0", "label": "sm_aware_home_explore import ahe", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.3065, 0.0161, 0, 0.66, 0.8889, 54, 0, 1, 0, 0, 54, 0, 0], "semantic": {"name": "sm_aware_home_explore", "arg_names": [], "import_names": ["ahe"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sm_aware_home_explore as ahe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L20_C0", "label": "visualization_msgs.msg import vm", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.3226, 0.0161, 0, 0.66, 0.9444, 124, 0, 1, 0, 0, 124, 0, 0], "semantic": {"name": "visualization_msgs.msg", "arg_names": [], "import_names": ["vm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import visualization_msgs.msg as vm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "label": "if", "type": "if", "loc": [23, 61], "level": 0, "parent": null, "vector": [4, 0, 0.6774, 0.629, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')\n # p.add_option('--fname', action='store', type='string', dest='fname',\n # help='File name. Should be woot_150_x_reads.pkl', default='')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L24_C4", "label": "optparse import optparse", "type": "import", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [1, 1, 0.3871, 0.0161, 1, 0.46, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L25_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.4032, 0.0161, 1, 0.46, 0.0625, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L26_C4", "label": "add_option()", "type": "expression", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [8, 1, 0.4274, 0.0323, 1, 0.46, 0.125, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L31_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.5, 0.0161, 1, 0.46, 0.1875, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L33_C4", "label": "fname =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.5323, 0.0161, 1, 0.46, 0.25, 190, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = 'search_aware_home/woot_150_'+str(opt.trial)+'_reads.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L35_C4", "label": "f = open()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.5645, 0.0161, 1, 0.46, 0.3125, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L36_C4", "label": "r = load()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.5806, 0.0161, 1, 0.46, 0.375, 436, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " r = pkl.load(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L37_C4", "label": "close()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [8, 1, 0.5968, 0.0161, 1, 0.46, 0.4375, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L39_C4", "label": "xyz =", "type": "assigned_variable", "loc": [39, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.6452, 0.0484, 1, 0.46, 0.5, 164, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xyz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xyz = np.array([ [p.ps_base_map.pose.position.x,\n p.ps_base_map.pose.position.y,\n p.ps_base_map.pose.position.z ] for p in r ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L43_C4", "label": "init_node()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [8, 1, 0.6935, 0.0161, 1, 0.46, 0.5625, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'pub_traj' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L44_C4", "label": "pts = np_to_pointcloud()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.7097, 0.0161, 1, 0.46, 0.625, 195, 3, 2, 0, 0, 712, 10, 1], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "np_to_pointcloud", "annotation": ""}, "snippet": " pts = ru.np_to_pointcloud( xyz, '/map' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L45_C4", "label": "pub_pts = Publisher()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.7258, 0.0161, 1, 0.46, 0.6875, 427, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub_pts", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " pub_pts = rospy.Publisher( '/robot_traj', sm.PointCloud )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L46_C4", "label": "pub_mark = Publisher()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.7419, 0.0161, 1, 0.46, 0.75, 577, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub_mark", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L47_C4", "label": "sleep()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [8, 1, 0.7581, 0.0161, 1, 0.46, 0.8125, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.5 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L49_C4", "label": "tag_pts =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.7903, 0.0161, 1, 0.46, 0.875, 659, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tag_pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag_pts = np.array([ ahe.pts[k][1] for k in ahe.pts.keys() ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L50_C4", "label": "tm =", "type": "assigned_variable", "loc": [50, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [14, 1, 0.8387, 0.0806, 1, 0.46, 0.9375, 404, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "tm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tm = [ viz.single_marker( tag_pts[:,i].reshape([3,1]),\n np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),\n 'sphere', '/map',\n color=[0.0, 1.0, 0.0, 1.0],\n m_id=i ) for i in xrange( tag_pts.shape[1] )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "label": "while", "type": "while", "loc": [57, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "vector": [5, 1, 0.9516, 0.0806, 1, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not rospy.is_shutdown():\n pts.header.stamp = rospy.Time.now()\n pub_pts.publish( pts )\n [ pub_mark.publish( x ) for x in tm ]\n rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L58_C8", "label": "pts.header.stamp = now()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "vector": [14, 2, 0.9355, 0.0161, 2, 0.78, 0.0, 489, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "pts.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " pts.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L59_C8", "label": "publish()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "vector": [8, 2, 0.9516, 0.0161, 2, 0.78, 0.3333, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " pub_pts.publish( pts )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L60_C8", "label": "expression", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "vector": [8, 2, 0.9677, 0.0161, 2, 0.78, 0.6667, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [ pub_mark.publish( x ) for x in tm ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L61_C8", "label": "sleep()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "vector": [8, 2, 0.9839, 0.0161, 2, 0.78, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 1.0 )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Import_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99417:While_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99417:Expr_L61_C8"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
import rospy
tdb = { 0: ['OrangeMedBot',[]],
1: ['TravisTVremo',[]],
2: ['RedBottle ',[]],
3: ['OnMetalKeys ',[]],
4: ['WhiteMedsBot',[]],
5: ['BlueMedsBox ',[]],
6: ['TeddyBearToy',[]],
7: ['CordlessPhon',[]],
8: ['BlueHairBrus',[]]}
pts = { 0: ['BehindTree',[3.757, 6.017, 0.036]],
1: ['FireplaceMantle',[5.090, 4.238, 1.514]],
2: ['CircleEndTable',[5.399, 2.857, 0.607]],
3: ['Couch',[3.944, 1.425, 0.527]],
4: ['RectEndTable',[3.302, 0.932, 0.534]],
5: ['BehindKitchenTable',[-0.339, -2.393, 0.793]],
6: ['NearDishwaser',[-1.926, -0.835, 0.946]],
7: ['InCupboard',[-3.257, 1.294, 1.397]],
8: ['OnFilingCabinet',[-0.083, 2.332, 0.670]]}
import smach
import actionlib
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
from rfid_demos import sm_rfid_explore
from rfid_behaviors import recorder
from hrl_lib import util
from rfid_datacapture.srv import BagCapture, BagCaptureRequest
class DummyClass():
def __init__(self, tagid):
self.tagid = tagid
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--fname', action='store', type='string', dest='fname',
help='File name. Should be without extension. [eg. \'trial\']', default='')
p.add_option('--radius', action='store', type='float', dest='radius',
help='Exploration radius in meters.', default=4.0)
opt, args = p.parse_args()
if opt.fname == '':
print 'Fname required'
exit()
fname_base = '/u/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/search_bags/'
fname = fname_base + opt.fname
sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],
input_keys = [ 'bagfile_name',
'bagfile_topics',
'tagid',
'explore_radius' ])
with sm:
smach.StateMachine.add(
'START_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request_slots = ['topics','dest'] ),
remapping = {'topics':'bagfile_topics',
'dest':'bagfile_name'},
transitions = {'succeeded':'SEARCH'})
sm_search = sm_rfid_explore.sm_search()
smach.StateMachine.add(
'SEARCH',
sm_search,
transitions = {'succeeded':'STOP_BAG_CAPTURE'},
remapping = {'tagid':'tagid',
'explore_radius':'explore_radius'})
smach.StateMachine.add(
'STOP_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request = BagCaptureRequest('','') ),
transitions = {'succeeded':'succeeded'})
rospy.init_node('smach_datacap_rfid_explore')
rec = recorder.Recorder( serv_name = 'temp_recorder', node_name = 'temp_recorder_py' )
rec.process_service( None ) # start recording
sm.userdata.tagid = ''
sm.userdata.explore_radius = opt.radius
sm.userdata.bagfile_name = fname
sm.userdata.bagfile_topics = '/tf /visarr /rfid/ears_reader /rfid/ears_reader_arr /map /robot_pose_ekf/odom_combined'
outcome = sm.execute()
rec.process_service( None ) # stop recording
print 'Saving recorder pickle data.'
util.save_pickle( rec.recorder_data, fname + '_reads.pkl' )
print 'Saving best read locations.'
tagids = ['person ','OrangeMedBot' ,'SpectrMedBot','OnMetalKeys ',
'TravisTVremo','Red Mug ']
for t in tagids:
print '\tTagid: \'%s\'' % t,
tname = t.replace( ' ', '' )
try:
pos = rec.bestvantage( DummyClass( t ))
pos.header.stamp = rospy.Time(0)
dat = pos.__str__() + '\n'
f = open( fname + '_tag_' + tname + '.yaml', 'w' )
f.write( dat )
f.close()
print ' Done.'
except:
print ' No reads. Done.'
pass
| ajibawa-2023/Python-Code-Large/train/row_99418 | 61 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0075, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0224, 0.0075, 0, 0.66, 0.0556, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0299, 0.0075, 0, 0.66, 0.1111, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0373, 0.0075, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0448, 0.0075, 0, 0.66, 0.2222, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0522, 0.0075, 0, 0.66, 0.2778, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0597, 0.0075, 0, 0.66, 0.3333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Import_L9_C0", "label": "rospy import rospy", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0672, 0.0075, 0, 0.66, 0.3889, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L12_C0", "label": "tdb =", "type": "assigned_variable", "loc": [12, 20], "level": 0, "parent": null, "vector": [14, 0, 0.1194, 0.0672, 0, 0.66, 0.4444, 84, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "tdb", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "tdb = { 0: ['OrangeMedBot',[]],\n 1: ['TravisTVremo',[]],\n 2: ['RedBottle ',[]],\n 3: ['OnMetalKeys ',[]],\n 4: ['WhiteMedsBot',[]],\n 5: ['BlueMedsBox ',[]],\n 6: ['TeddyBearToy',[]],\n 7: ['CordlessPhon',[]],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L22_C0", "label": "pts =", "type": "assigned_variable", "loc": [22, 30], "level": 0, "parent": null, "vector": [14, 0, 0.194, 0.0672, 0, 0.66, 0.5, 195, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pts = { 0: ['BehindTree',[3.757, 6.017, 0.036]],\n 1: ['FireplaceMantle',[5.090, 4.238, 1.514]],\n 2: ['CircleEndTable',[5.399, 2.857, 0.607]],\n 3: ['Couch',[3.944, 1.425, 0.527]],\n 4: ['RectEndTable',[3.302, 0.932, 0.534]],\n 5: ['BehindKitchenTable',[-0.339, -2.393, 0.793]],\n 6: ['NearDishwaser',[-1.926, -0.835, 0.946]],\n 7: ['InCupboard',[-3.257, 1.294, 1.397]],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Import_L32_C0", "label": "smach import smach", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.2388, 0.0075, 0, 0.66, 0.5556, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Import_L33_C0", "label": "actionlib import actionlib", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.2463, 0.0075, 0, 0.66, 0.6111, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:ImportFrom_L35_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.2612, 0.0075, 0, 0.66, 0.6667, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:ImportFrom_L36_C0", "label": "from rfid_demos import sm_rfid_explore", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.2687, 0.0075, 0, 0.66, 0.7222, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "rfid_demos", "arg_names": [], "import_names": ["sm_rfid_explore"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_demos import sm_rfid_explore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:ImportFrom_L37_C0", "label": "from rfid_behaviors import recorder", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.2761, 0.0075, 0, 0.66, 0.7778, 746, 0, 1, 0, 0, 746, 0, 0], "semantic": {"name": "rfid_behaviors", "arg_names": [], "import_names": ["recorder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors import recorder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:ImportFrom_L38_C0", "label": "from hrl_lib import util", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.2836, 0.0075, 0, 0.66, 0.8333, 649, 0, 1, 0, 0, 649, 0, 0], "semantic": {"name": "hrl_lib", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_lib import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:ImportFrom_L39_C0", "label": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest", "type": "import", "loc": [39, 39], "level": 0, "parent": null, "vector": [1, 0, 0.291, 0.0075, 0, 0.66, 0.8889, 252, 0, 2, 0, 0, 252, 0, 0], "semantic": {"name": "rfid_datacapture.srv", "arg_names": [], "import_names": ["BagCapture", "BagCaptureRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:ClassDef_L41_C0", "label": "DummyClass", "type": "class", "loc": [41, 43], "level": 0, "parent": null, "vector": [3, 0, 0.3134, 0.0224, 0, 0.66, 0.9444, 9, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "DummyClass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DummyClass():\n def __init__(self, tagid):\n self.tagid = tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:FunctionDef_L42_C4", "label": "__init__", "type": "function", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:ClassDef_L41_C0", "vector": [2, 1, 0.3172, 0.0149, 1, 0.85, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "tagid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, tagid):\n self.tagid = tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L43_C8", "label": "self.tagid =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:FunctionDef_L42_C4", "vector": [14, 2, 0.3209, 0.0075, 2, 0.57, 0.0, 251, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tagid = tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "label": "if", "type": "if", "loc": [45, 133], "level": 0, "parent": null, "vector": [4, 0, 0.6642, 0.6642, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 33], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--fname', action='store', type='string', dest='fname',\n help='File name. Should be without extension. [eg. \\'trial\\']', default='')\n p.add_option('--radius', action='store', type='float', dest='radius',\n help='Exploration radius in meters.', default=4.0)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Import_L46_C4", "label": "optparse import optparse", "type": "import", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [1, 1, 0.3433, 0.0075, 1, 0.46, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L47_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.3507, 0.0075, 1, 0.46, 0.0455, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L48_C4", "label": "add_option()", "type": "expression", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.3619, 0.0149, 1, 0.46, 0.0909, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--fname', action='store', type='string', dest='fname',\n help='File name. Should be without extension. [eg. \\'trial\\']', default='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L50_C4", "label": "add_option()", "type": "expression", "loc": [50, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.3769, 0.0149, 1, 0.46, 0.1364, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--radius', action='store', type='float', dest='radius',\n help='Exploration radius in meters.', default=4.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L53_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.3955, 0.0075, 1, 0.46, 0.1818, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L55_C4", "label": "if", "type": "if", "loc": [55, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [4, 1, 0.4179, 0.0224, 1, 0.46, 0.2273, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.fname == '':\n print('Fname required')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L56_C8", "label": "print()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L55_C4", "vector": [8, 2, 0.4179, 0.0075, 2, 0.66, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Fname required')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L57_C8", "label": "exit()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L55_C4", "vector": [8, 2, 0.4254, 0.0075, 2, 0.66, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L58_C4", "label": "fname_base =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.4328, 0.0075, 1, 0.46, 0.2727, 962, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fname_base", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname_base = '/u/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/search_bags/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L59_C4", "label": "fname =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.4403, 0.0075, 1, 0.46, 0.3182, 190, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = fname_base + opt.fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L63_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [63, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.4851, 0.0373, 1, 0.46, 0.3636, 21, 3, 2, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],\n input_keys = [ 'bagfile_name',\n 'bagfile_topics',\n 'tagid',\n 'explore_radius' ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L69_C8", "label": "add()", "type": "expression", "loc": [69, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.541, 0.0597, 1, 0.46, 0.0, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'START_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request_slots = ['topics','dest'] ),\n remapping = {'topics':'bagfile_topics',\n 'dest':'bagfile_name'},\n transitions = {'succeeded':'SEARCH'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L78_C8", "label": "sm_search = sm_search()", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.5821, 0.0075, 1, 0.46, 0.3333, 542, 3, 0, 0, 0, 542, 10, 1], "semantic": {"name": "sm_search", "arg_names": [], "import_names": [], "rhs_call_name": "sm_search", "annotation": ""}, "snippet": " sm_search = sm_rfid_explore.sm_search()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L80_C8", "label": "add()", "type": "expression", "loc": [80, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.6157, 0.0448, 1, 0.46, 0.6667, 241, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'SEARCH',\n sm_search,\n transitions = {'succeeded':'STOP_BAG_CAPTURE'},\n remapping = {'tagid':'tagid',\n 'explore_radius':'explore_radius'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L87_C8", "label": "add()", "type": "expression", "loc": [87, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.6679, 0.0448, 1, 0.46, 1.0, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'STOP_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request = BagCaptureRequest('','') ),\n transitions = {'succeeded':'succeeded'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L96_C4", "label": "init_node()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.7164, 0.0075, 1, 0.46, 0.4091, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('smach_datacap_rfid_explore')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L98_C4", "label": "rec = Recorder()", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.7313, 0.0075, 1, 0.46, 0.4545, 100, 3, 2, 0, 0, 495, 10, 1], "semantic": {"name": "rec", "arg_names": [], "import_names": [], "rhs_call_name": "Recorder", "annotation": ""}, "snippet": " rec = recorder.Recorder( serv_name = 'temp_recorder', node_name = 'temp_recorder_py' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L99_C4", "label": "process_service()", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.7388, 0.0075, 1, 0.46, 0.5, 430, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_service", "arg_names": [], "import_names": [], "rhs_call_name": "process_service", "annotation": ""}, "snippet": " rec.process_service( None ) # start recording"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L102_C4", "label": "sm.userdata.tagid =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.7612, 0.0075, 1, 0.46, 0.5455, 452, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sm.userdata.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.tagid = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L103_C4", "label": "sm.userdata.explore_radius =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.7687, 0.0075, 1, 0.46, 0.5909, 383, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sm.userdata.explore_radius", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.explore_radius = opt.radius"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L104_C4", "label": "sm.userdata.bagfile_name =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.7761, 0.0075, 1, 0.46, 0.6364, 565, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sm.userdata.bagfile_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.bagfile_name = fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L105_C4", "label": "sm.userdata.bagfile_topics =", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.7836, 0.0075, 1, 0.46, 0.6818, 446, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sm.userdata.bagfile_topics", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.bagfile_topics = '/tf /visarr /rfid/ears_reader /rfid/ears_reader_arr /map /robot_pose_ekf/odom_combined'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L107_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.7985, 0.0075, 1, 0.46, 0.7273, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L109_C4", "label": "process_service()", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.8134, 0.0075, 1, 0.46, 0.7727, 430, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_service", "arg_names": [], "import_names": [], "rhs_call_name": "process_service", "annotation": ""}, "snippet": " rec.process_service( None ) # stop recording"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L111_C4", "label": "print()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.8284, 0.0075, 1, 0.46, 0.8182, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Saving recorder pickle data.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L112_C4", "label": "save_pickle()", "type": "expression", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.8358, 0.0075, 1, 0.46, 0.8636, 390, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save_pickle", "arg_names": [], "import_names": [], "rhs_call_name": "save_pickle", "annotation": ""}, "snippet": " util.save_pickle( rec.recorder_data, fname + '_reads.pkl' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L114_C4", "label": "print()", "type": "expression", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [8, 1, 0.8507, 0.0075, 1, 0.46, 0.9091, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Saving best read locations.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L115_C4", "label": "tagids =", "type": "assigned_variable", "loc": [115, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [14, 1, 0.8619, 0.0149, 1, 0.46, 0.9545, 635, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "tagids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tagids = ['person ','OrangeMedBot' ,'SpectrMedBot','OnMetalKeys ',\n 'TravisTVremo','Red Mug ']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:For_L118_C4", "label": "for t", "type": "for", "loc": [118, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "vector": [6, 1, 0.9366, 0.1194, 1, 0.46, 1.0, 15, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in tagids:\n print('\\tTagid: \\'%s\\'' % t,)\n tname = t.replace( ' ', '' )\n\n try:\n pos = rec.bestvantage( DummyClass( t ))\n pos.header.stamp = rospy.Time(0)\n dat = pos.__str__() + '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L119_C8", "label": "print()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:For_L118_C4", "vector": [8, 2, 0.8881, 0.0075, 2, 0.79, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tTagid: \\'%s\\'' % t,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L120_C8", "label": "tname = replace()", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:For_L118_C4", "vector": [14, 2, 0.8955, 0.0075, 2, 0.79, 0.5, 985, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "tname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tname = t.replace( ' ', '' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "label": "try", "type": "try", "loc": [122, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:For_L118_C4", "vector": [7, 2, 0.9515, 0.0896, 2, 0.79, 1.0, 0, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n pos = rec.bestvantage( DummyClass( t ))\n pos.header.stamp = rospy.Time(0)\n dat = pos.__str__() + '\\n'\n\n f = open( fname + '_tag_' + tname + '.yaml', 'w' )\n f.write( dat )\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L123_C12", "label": "pos = bestvantage()", "type": "assigned_variable", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "vector": [14, 3, 0.9179, 0.0075, 3, 0.77, 0.0, 627, 3, 1, 0, 0, 412, 10, 2], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "bestvantage", "annotation": ""}, "snippet": " pos = rec.bestvantage( DummyClass( t ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L124_C12", "label": "pos.header.stamp = Time()", "type": "assigned_variable", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "vector": [14, 3, 0.9254, 0.0075, 3, 0.77, 0.1667, 876, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "pos.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " pos.header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L125_C12", "label": "dat =", "type": "assigned_variable", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "vector": [14, 3, 0.9328, 0.0075, 3, 0.77, 0.3333, 934, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dat = pos.__str__() + '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L127_C12", "label": "f = open()", "type": "assigned_variable", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "vector": [14, 3, 0.9478, 0.0075, 3, 0.77, 0.5, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname + '_tag_' + tname + '.yaml', 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L128_C12", "label": "write()", "type": "expression", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "vector": [8, 3, 0.9552, 0.0075, 3, 0.77, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write( dat )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L129_C12", "label": "close()", "type": "expression", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "vector": [8, 3, 0.9627, 0.0075, 3, 0.77, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L130_C12", "label": "print()", "type": "expression", "loc": [130, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "vector": [8, 3, 0.9701, 0.0075, 3, 0.77, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' Done.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L132_C12", "label": "print()", "type": "expression", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "vector": [8, 3, 0.9851, 0.0075, 3, 0.77, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' No reads. Done.')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99418:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Import_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:For_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:For_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:For_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:For_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Assign_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L130_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99418:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99418:Expr_L132_C12"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('tf')
roslib.load_manifest('sensor_msgs')
roslib.load_manifest('rosbag')
roslib.load_manifest('visualization_msgs')
import rospy
import cPickle as pkl
import hrl_lib.rutils as ru
import hrl_lib.viz as viz
import sensor_msgs.msg as sm
import numpy as np, math
import sm_aware_home_explore as ahe
import rosbag
import visualization_msgs.msg as vm
from hrl_lib.cmd_process import CmdProcess
import glob
import json
import yaml
import time
import os
def publish_robotpose( trial, obj, pub_time = 30e3, screen_cap = False ):
print 'Change screen to RVIZ. Starting %d, %d' % (trial, obj)
loc = ( trial + obj ) % 9
obj_name = ahe.tdb[obj][0]
tname = obj_name.replace( ' ', '' )
# woot_150_6_tag_BlueHairBrus_headpost.bag
fname = 'search_aware_home/woot_150_'+str(trial)+'_tag_'+tname+'_headpost.bag'
# Start the new bagplay
bp = bagplay( fname )
bp.run()
while not bp.is_finished():
try:
rospy.init_node( 'markpub' )
pub_mark = rospy.Publisher( '/robot_pose', vm.Marker )
except:
print 'Init Failure.'
# Publish the robot marker
vsm = viz.single_marker
mark = [ vsm( np.matrix([ 0.0, 0.0, 0.0 ]).T,
np.matrix([ 0.0, 0.0, 0.0, 1.0 ]).T,
'cube', '/base_link',
scale = [0.65, 0.65, 0.001],
color = [158./255, 86./255, 192./255, 0.9], # rgba,
duration = 30.0,
m_id = 20000 )]
[ pub_mark.publish( x ) for x in mark ]
sim_safe_sleep( 1.0 ) # Cannot use rostime, since it will stall when bag stops
# Screenshot!
if screen_cap:
os.system( 'scrot -d 2 -u Obj%d_Trial%d_RobotView.png' % ( obj, trial ))
# Let markers expire
print 'Waiting for markers and points to expire'
t0 = time.time()
t_sleep = 60.0
while time.time() - t0 < t_sleep and not rospy.is_shutdown():
if int(time.time() - t0) % 5 == 0:
print 'Time left: %d' % (t_sleep - int(time.time() - t0))
time.sleep( 1.0 )
return
def sim_safe_sleep( dur, real_time_sleep = 0.05 ):
t0 = rospy.Time.now().to_sec()
ct = rospy.Time.now().to_sec()
while True:
if ct - t0 >= dur:
break
time.sleep( real_time_sleep )
nt = rospy.Time.now().to_sec()
if nt == ct: # rostime will stop when bag not playing -- exit immediately.
break
ct = nt
return
def bagplay( fname ):
# to use:
# bp = bagplay( my_file_name )
# bp.run() # starts the execution
# while not bp.is_finished():
# rospy.sleep( 0.5 )
# bp.kill() # not necessary
cmd = 'rosbag play --clock ' + fname + ' -r 2.0 -q'
rospy.logout( 'Launching bag file: %s' % fname )
return CmdProcess( cmd.split() )
def order_by_rostime( dat ):
# dat is [[trial, obj], ... ]
# I'm too lazy to figure out how to reset time and prevent "TF_OLD_DATA" errors / warnings.
# Instead, we're just going to order the bag playback in wall-clock order.
def build_fname( t,o ):
# woot_150_6_tag_BlueHairBrus_headpost.bag
fname = 'search_aware_home/woot_150_'+str(t)+'_tag_'+ahe.tdb[o][0].replace( ' ', '' )+'_headpost.bag'
return fname
dat = [ [t,o] + [ build_fname(t,o) ] for t,o in dat ]
dat = [ d for d in dat if glob.glob( d[-1] ) != [] ]
rospy.logout( 'Ordering the bagfiles in increasing order of start time.' )
def gettime( fname ):
print fname
# returns the timestamp of the first message
b = rosbag.Bag( fname )
msg = b.read_messages().next()
tt = msg[-1].to_sec()
b.close()
return tt
start_times = [ gettime( d[-1] ) for d in dat ]
rospy.logout( 'Done ordering.' )
return [ [dat[ind][0],dat[ind][1]] for ind in np.argsort( start_times ) ]
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
# p.add_option('--fname', action='store', type='string', dest='fname',
# help='File name. Should be woot_150_x_reads.pkl', default='')
p.add_option('--trial', action='store', type='int', dest='trial',
help='trial number (0-8)')
p.add_option('--obj', action='store', type='int', dest='obj',
help='object number (0-8)')
p.add_option('--sc', action='store_true', dest='sc',
help='Take screenshot', default=False)
# p.add_option('--loc', action='store', type='int', dest='loc',
# help='location number (0-8)')
opt, args = p.parse_args()
if opt.trial < 9:
publish_robotpose( opt.trial, opt.obj, screen_cap = opt.sc )
else:
print 'Click on RVIZ!'
time.sleep( 3 )
#X,Y = np.meshgrid( range(0,9), range(0,9) )
X,Y = np.meshgrid( range(0,9), range(0,9) )
trial_obj = zip( Y.flatten(), X.flatten() )
[ publish_robotpose( trial, obj, 15, screen_cap = True )
for trial, obj in order_by_rostime(trial_obj) ]
| ajibawa-2023/Python-Code-Large/train/row_99419 | 98 | 171 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0117, 0.0058, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0175, 0.0058, 0, 0.66, 0.0333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0234, 0.0058, 0, 0.66, 0.0667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0292, 0.0058, 0, 0.66, 0.1, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0351, 0.0058, 0, 0.66, 0.1333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0409, 0.0058, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0468, 0.0058, 0, 0.66, 0.2, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0526, 0.0058, 0, 0.66, 0.2333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0585, 0.0058, 0, 0.66, 0.2667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('sensor_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L11_C0", "label": "load_manifest()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0643, 0.0058, 0, 0.66, 0.3, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rosbag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L12_C0", "label": "load_manifest()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0702, 0.0058, 0, 0.66, 0.3333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('visualization_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L13_C0", "label": "rospy import rospy", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.076, 0.0058, 0, 0.66, 0.3667, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L15_C0", "label": "cPickle import pkl", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0877, 0.0058, 0, 0.66, 0.4, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L16_C0", "label": "hrl_lib.rutils import ru", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0936, 0.0058, 0, 0.66, 0.4333, 847, 0, 1, 0, 0, 847, 0, 0], "semantic": {"name": "hrl_lib.rutils", "arg_names": [], "import_names": ["ru"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.rutils as ru"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L17_C0", "label": "hrl_lib.viz import viz", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0994, 0.0058, 0, 0.66, 0.4667, 48, 0, 1, 0, 0, 48, 0, 0], "semantic": {"name": "hrl_lib.viz", "arg_names": [], "import_names": ["viz"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.viz as viz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L18_C0", "label": "sensor_msgs.msg import sm", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0058, 0, 0.66, 0.5, 531, 0, 1, 0, 0, 531, 0, 0], "semantic": {"name": "sensor_msgs.msg", "arg_names": [], "import_names": ["sm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sensor_msgs.msg as sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L19_C0", "label": "numpy import np, math", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.0058, 0, 0.66, 0.5333, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L20_C0", "label": "sm_aware_home_explore import ahe", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.117, 0.0058, 0, 0.66, 0.5667, 54, 0, 1, 0, 0, 54, 0, 0], "semantic": {"name": "sm_aware_home_explore", "arg_names": [], "import_names": ["ahe"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sm_aware_home_explore as ahe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L21_C0", "label": "rosbag import rosbag", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1228, 0.0058, 0, 0.66, 0.6, 243, 0, 1, 0, 0, 243, 0, 0], "semantic": {"name": "rosbag", "arg_names": [], "import_names": ["rosbag"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rosbag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L22_C0", "label": "visualization_msgs.msg import vm", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1287, 0.0058, 0, 0.66, 0.6333, 124, 0, 1, 0, 0, 124, 0, 0], "semantic": {"name": "visualization_msgs.msg", "arg_names": [], "import_names": ["vm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import visualization_msgs.msg as vm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:ImportFrom_L23_C0", "label": "from hrl_lib.cmd_process import CmdProcess", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1345, 0.0058, 0, 0.66, 0.6667, 659, 0, 1, 0, 0, 659, 0, 0], "semantic": {"name": "hrl_lib.cmd_process", "arg_names": [], "import_names": ["CmdProcess"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_lib.cmd_process import CmdProcess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L24_C0", "label": "glob import glob", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1404, 0.0058, 0, 0.66, 0.7, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L25_C0", "label": "json import json", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1462, 0.0058, 0, 0.66, 0.7333, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L26_C0", "label": "yaml import yaml", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.152, 0.0058, 0, 0.66, 0.7667, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L27_C0", "label": "time import time", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0058, 0, 0.66, 0.8, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L28_C0", "label": "os import os", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.1637, 0.0058, 0, 0.66, 0.8333, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "label": "publish_robotpose", "type": "function", "loc": [30, 82], "level": 0, "parent": null, "vector": [2, 0, 0.3275, 0.3099, 0, 0.66, 0.8667, 321, 0, 4, 0, 0, 0, 0, 25], "semantic": {"name": "publish_robotpose", "arg_names": ["trial", "obj", "pub_time", "screen_cap"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def publish_robotpose( trial, obj, pub_time = 30e3, screen_cap = False ):\n print('Change screen to RVIZ. Starting %d, %d' % (trial, obj))\n loc = ( trial + obj ) % 9\n\n obj_name = ahe.tdb[obj][0]\n tname = obj_name.replace( ' ', '' )\n\n # woot_150_6_tag_BlueHairBrus_headpost.bag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L31_C4", "label": "print()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [8, 1, 0.1813, 0.0058, 1, 0.04, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Change screen to RVIZ. Starting %d, %d' % (trial, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L32_C4", "label": "loc =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [14, 1, 0.1871, 0.0058, 1, 0.04, 0.0769, 822, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc = ( trial + obj ) % 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L34_C4", "label": "obj_name =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [14, 1, 0.1988, 0.0058, 1, 0.04, 0.1538, 412, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_name = ahe.tdb[obj][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L35_C4", "label": "tname = replace()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [14, 1, 0.2047, 0.0058, 1, 0.04, 0.2308, 985, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "tname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tname = obj_name.replace( ' ', '' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L38_C4", "label": "fname =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [14, 1, 0.2222, 0.0058, 1, 0.04, 0.3077, 190, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = 'search_aware_home/woot_150_'+str(trial)+'_tag_'+tname+'_headpost.bag'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L41_C4", "label": "bp = bagplay()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [14, 1, 0.2398, 0.0058, 1, 0.04, 0.3846, 226, 3, 1, 0, 0, 603, 10, 1], "semantic": {"name": "bp", "arg_names": [], "import_names": [], "rhs_call_name": "bagplay", "annotation": ""}, "snippet": " bp = bagplay( fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L42_C4", "label": "run()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [8, 1, 0.2456, 0.0058, 1, 0.04, 0.4615, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " bp.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "label": "while", "type": "while", "loc": [44, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [5, 1, 0.3216, 0.1345, 1, 0.04, 0.5385, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not bp.is_finished():\n try:\n rospy.init_node( 'markpub' )\n pub_mark = rospy.Publisher( '/robot_pose', vm.Marker )\n except:\n print('Init Failure.')\n\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Try_L45_C8", "label": "try", "type": "try", "loc": [45, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "vector": [7, 2, 0.2749, 0.0292, 2, 0.68, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node( 'markpub' )\n pub_mark = rospy.Publisher( '/robot_pose', vm.Marker )\n except:\n print('Init Failure.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L46_C12", "label": "init_node()", "type": "expression", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:Try_L45_C8", "vector": [8, 3, 0.269, 0.0058, 3, 0.49, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'markpub' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L47_C12", "label": "pub_mark = Publisher()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:Try_L45_C8", "vector": [14, 3, 0.2749, 0.0058, 3, 0.49, 1.0, 577, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub_mark", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " pub_mark = rospy.Publisher( '/robot_pose', vm.Marker )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L49_C12", "label": "print()", "type": "expression", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:Try_L45_C8", "vector": [8, 3, 0.2865, 0.0058, 3, 0.49, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Init Failure.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L54_C8", "label": "vsm =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "vector": [14, 2, 0.3158, 0.0058, 2, 0.68, 0.25, 910, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vsm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vsm = viz.single_marker"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L55_C8", "label": "mark =", "type": "assigned_variable", "loc": [55, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "vector": [14, 2, 0.3392, 0.0409, 2, 0.68, 0.5, 688, 0, 0, 0, 0, 0, 5, 3], "semantic": {"name": "mark", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mark = [ vsm( np.matrix([ 0.0, 0.0, 0.0 ]).T,\n np.matrix([ 0.0, 0.0, 0.0, 1.0 ]).T,\n 'cube', '/base_link',\n scale = [0.65, 0.65, 0.001],\n color = [158./255, 86./255, 192./255, 0.9], # rgba,\n duration = 30.0,\n m_id = 20000 )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L63_C8", "label": "expression", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "vector": [8, 2, 0.3684, 0.0058, 2, 0.68, 0.75, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [ pub_mark.publish( x ) for x in mark ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L66_C8", "label": "sim_safe_sleep()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "vector": [8, 2, 0.386, 0.0058, 2, 0.68, 1.0, 35, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sim_safe_sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sim_safe_sleep", "annotation": ""}, "snippet": " sim_safe_sleep( 1.0 ) # Cannot use rostime, since it will stall when bag stops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L70_C4", "label": "if", "type": "if", "loc": [70, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [4, 1, 0.4123, 0.0117, 1, 0.04, 0.6154, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if screen_cap:\n os.system( 'scrot -d 2 -u Obj%d_Trial%d_RobotView.png' % ( obj, trial ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L71_C8", "label": "system()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L70_C4", "vector": [8, 2, 0.4152, 0.0058, 2, 0.51, 0.0, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system( 'scrot -d 2 -u Obj%d_Trial%d_RobotView.png' % ( obj, trial ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L74_C4", "label": "print()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [8, 1, 0.4327, 0.0058, 1, 0.04, 0.6923, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Waiting for markers and points to expire')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L75_C4", "label": "t0 = time()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [14, 1, 0.4386, 0.0058, 1, 0.04, 0.7692, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L76_C4", "label": "t_sleep =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [14, 1, 0.4444, 0.0058, 1, 0.04, 0.8462, 149, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "t_sleep", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_sleep = 60.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L77_C4", "label": "while", "type": "while", "loc": [77, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [5, 1, 0.4591, 0.0234, 1, 0.04, 0.9231, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while time.time() - t0 < t_sleep and not rospy.is_shutdown():\n if int(time.time() - t0) % 5 == 0:\n print('Time left: %d' % (t_sleep - int(time.time() - t0)))\n time.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L78_C8", "label": "if", "type": "if", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L77_C4", "vector": [4, 2, 0.4591, 0.0117, 2, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if int(time.time() - t0) % 5 == 0:\n print('Time left: %d' % (t_sleep - int(time.time() - t0)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L79_C12", "label": "print()", "type": "expression", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L78_C8", "vector": [8, 3, 0.462, 0.0058, 3, 0.2, 0.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Time left: %d' % (t_sleep - int(time.time() - t0)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L80_C8", "label": "sleep()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L77_C4", "vector": [8, 2, 0.4678, 0.0058, 2, 0.33, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L82_C4", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "vector": [13, 1, 0.4795, 0.0058, 1, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "label": "sim_safe_sleep", "type": "function", "loc": [85, 99], "level": 0, "parent": null, "vector": [2, 0, 0.538, 0.0877, 0, 0.66, 0.9, 35, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "sim_safe_sleep", "arg_names": ["dur", "real_time_sleep"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sim_safe_sleep( dur, real_time_sleep = 0.05 ):\n t0 = rospy.Time.now().to_sec()\n ct = rospy.Time.now().to_sec()\n while True:\n if ct - t0 >= dur:\n break\n\n time.sleep( real_time_sleep )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L86_C4", "label": "t0 = to_sec()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "vector": [14, 1, 0.5029, 0.0058, 1, 0.08, 0.0, 573, 3, 0, 0, 0, 750, 10, 2], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " t0 = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L87_C4", "label": "ct = to_sec()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "vector": [14, 1, 0.5088, 0.0058, 1, 0.08, 0.3333, 147, 3, 0, 0, 0, 750, 10, 2], "semantic": {"name": "ct", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " ct = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "label": "while", "type": "while", "loc": [88, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "vector": [5, 1, 0.5439, 0.0643, 1, 0.08, 0.6667, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if ct - t0 >= dur:\n break\n\n time.sleep( real_time_sleep )\n nt = rospy.Time.now().to_sec()\n\n if nt == ct: # rostime will stop when bag not playing -- exit immediately."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L89_C8", "label": "if", "type": "if", "loc": [89, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "vector": [4, 2, 0.5234, 0.0117, 2, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ct - t0 >= dur:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L92_C8", "label": "sleep()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "vector": [8, 2, 0.538, 0.0058, 2, 0.91, 0.25, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( real_time_sleep )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L93_C8", "label": "nt = to_sec()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "vector": [14, 2, 0.5439, 0.0058, 2, 0.91, 0.5, 96, 3, 0, 0, 0, 750, 10, 2], "semantic": {"name": "nt", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " nt = rospy.Time.now().to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L95_C8", "label": "if", "type": "if", "loc": [95, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "vector": [4, 2, 0.5585, 0.0117, 2, 0.91, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nt == ct: # rostime will stop when bag not playing -- exit immediately.\n break "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L98_C8", "label": "ct =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "vector": [14, 2, 0.5731, 0.0058, 2, 0.91, 1.0, 147, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ct = nt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L99_C4", "label": "return", "type": "return", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "vector": [13, 1, 0.5789, 0.0058, 1, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L101_C0", "label": "bagplay", "type": "function", "loc": [101, 110], "level": 0, "parent": null, "vector": [2, 0, 0.617, 0.0585, 0, 0.66, 0.9333, 603, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "bagplay", "arg_names": ["fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bagplay( fname ):\n # to use:\n # bp = bagplay( my_file_name )\n # bp.run() # starts the execution\n # while not bp.is_finished():\n # rospy.sleep( 0.5 )\n # bp.kill() # not necessary\n cmd = 'rosbag play --clock ' + fname + ' -r 2.0 -q'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L108_C4", "label": "cmd =", "type": "assigned_variable", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L101_C0", "vector": [14, 1, 0.6316, 0.0058, 1, 0.06, 0.0, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = 'rosbag play --clock ' + fname + ' -r 2.0 -q'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L109_C4", "label": "logout()", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L101_C0", "vector": [8, 1, 0.6374, 0.0058, 1, 0.06, 0.5, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Launching bag file: %s' % fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L110_C4", "label": "return", "type": "return", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L101_C0", "vector": [13, 1, 0.6433, 0.0058, 1, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return CmdProcess( cmd.split() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "label": "order_by_rostime", "type": "function", "loc": [113, 140], "level": 0, "parent": null, "vector": [2, 0, 0.7398, 0.1637, 0, 0.66, 0.9667, 441, 0, 1, 1, 0, 0, 0, 14], "semantic": {"name": "order_by_rostime", "arg_names": ["dat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def order_by_rostime( dat ):\n # dat is [[trial, obj], ... ]\n # I'm too lazy to figure out how to reset time and prevent \"TF_OLD_DATA\" errors / warnings.\n # Instead, we're just going to order the bag playback in wall-clock order.\n\n def build_fname( t,o ):\n # woot_150_6_tag_BlueHairBrus_headpost.bag\n fname = 'search_aware_home/woot_150_'+str(t)+'_tag_'+ahe.tdb[o][0].replace( ' ', '' )+'_headpost.bag'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L118_C4", "label": "build_fname", "type": "function", "loc": [118, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "vector": [2, 1, 0.6988, 0.0234, 1, 0.97, 0.0, 774, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "build_fname", "arg_names": ["t", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_fname( t,o ):\n # woot_150_6_tag_BlueHairBrus_headpost.bag\n fname = 'search_aware_home/woot_150_'+str(t)+'_tag_'+ahe.tdb[o][0].replace( ' ', '' )+'_headpost.bag'\n return fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L120_C8", "label": "fname =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L118_C4", "vector": [14, 2, 0.7018, 0.0058, 2, 0.37, 0.0, 190, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = 'search_aware_home/woot_150_'+str(t)+'_tag_'+ahe.tdb[o][0].replace( ' ', '' )+'_headpost.bag'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L121_C8", "label": "return", "type": "return", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L118_C4", "vector": [13, 2, 0.7076, 0.0058, 2, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L124_C4", "label": "dat =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "vector": [14, 1, 0.7251, 0.0058, 1, 0.97, 0.1429, 934, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dat = [ [t,o] + [ build_fname(t,o) ] for t,o in dat ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L125_C4", "label": "dat =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "vector": [14, 1, 0.731, 0.0058, 1, 0.97, 0.2857, 934, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dat = [ d for d in dat if glob.glob( d[-1] ) != [] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L127_C4", "label": "logout()", "type": "expression", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "vector": [8, 1, 0.7427, 0.0058, 1, 0.97, 0.4286, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Ordering the bagfiles in increasing order of start time.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "label": "gettime", "type": "function", "loc": [128, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "vector": [2, 1, 0.769, 0.0468, 1, 0.97, 0.5714, 526, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "gettime", "arg_names": ["fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def gettime( fname ):\n print(fname)\n # returns the timestamp of the first message\n b = rosbag.Bag( fname )\n msg = b.read_messages().next()\n tt = msg[-1].to_sec()\n b.close()\n return tt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L129_C8", "label": "print()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "vector": [8, 2, 0.7544, 0.0058, 2, 0.88, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(fname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L131_C8", "label": "b = Bag()", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "vector": [14, 2, 0.7661, 0.0058, 2, 0.88, 0.2, 756, 3, 1, 0, 0, 568, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " b = rosbag.Bag( fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L132_C8", "label": "msg = next()", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "vector": [14, 2, 0.7719, 0.0058, 2, 0.88, 0.4, 712, 3, 0, 0, 0, 11, 10, 2], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "next", "annotation": ""}, "snippet": " msg = b.read_messages().next()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L133_C8", "label": "tt = to_sec()", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "vector": [14, 2, 0.7778, 0.0058, 2, 0.88, 0.6, 266, 3, 0, 0, 0, 750, 10, 1], "semantic": {"name": "tt", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " tt = msg[-1].to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L134_C8", "label": "close()", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "vector": [8, 2, 0.7836, 0.0058, 2, 0.88, 0.8, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " b.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L135_C8", "label": "return", "type": "return", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "vector": [13, 2, 0.7895, 0.0058, 2, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L137_C4", "label": "start_times =", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "vector": [14, 1, 0.8012, 0.0058, 1, 0.97, 0.7143, 800, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start_times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start_times = [ gettime( d[-1] ) for d in dat ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L138_C4", "label": "logout()", "type": "expression", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "vector": [8, 1, 0.807, 0.0058, 1, 0.97, 0.8571, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Done ordering.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L140_C4", "label": "return", "type": "return", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "vector": [13, 1, 0.8187, 0.0058, 1, 0.97, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [ [dat[ind][0],dat[ind][1]] for ind in np.argsort( start_times ) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "label": "if", "type": "if", "loc": [143, 169], "level": 0, "parent": null, "vector": [4, 0, 0.9123, 0.1579, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n # p.add_option('--fname', action='store', type='string', dest='fname',\n # help='File name. Should be woot_150_x_reads.pkl', default='')\n p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')\n p.add_option('--obj', action='store', type='int', dest='obj',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L144_C4", "label": "optparse import optparse", "type": "import", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "vector": [1, 1, 0.8421, 0.0058, 1, 0.11, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L145_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "vector": [14, 1, 0.848, 0.0058, 1, 0.11, 0.1667, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L148_C4", "label": "add_option()", "type": "expression", "loc": [148, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "vector": [8, 1, 0.8684, 0.0117, 1, 0.11, 0.3333, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L150_C4", "label": "add_option()", "type": "expression", "loc": [150, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "vector": [8, 1, 0.8801, 0.0117, 1, 0.11, 0.5, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--obj', action='store', type='int', dest='obj',\n help='object number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L152_C4", "label": "add_option()", "type": "expression", "loc": [152, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "vector": [8, 1, 0.8918, 0.0117, 1, 0.11, 0.6667, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--sc', action='store_true', dest='sc',\n help='Take screenshot', default=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L157_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "vector": [14, 1, 0.9181, 0.0058, 1, 0.11, 0.8333, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "label": "if", "type": "if", "loc": [159, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "vector": [4, 1, 0.9591, 0.0643, 1, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.trial < 9:\n publish_robotpose( opt.trial, opt.obj, screen_cap = opt.sc )\n else:\n print('Click on RVIZ!')\n time.sleep( 3 )\n\n #X,Y = np.meshgrid( range(0,9), range(0,9) )\n X,Y = np.meshgrid( range(0,9), range(0,9) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L160_C8", "label": "publish_robotpose()", "type": "expression", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "vector": [8, 2, 0.9357, 0.0058, 2, 0.54, 0.0, 321, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "publish_robotpose", "arg_names": [], "import_names": [], "rhs_call_name": "publish_robotpose", "annotation": ""}, "snippet": " publish_robotpose( opt.trial, opt.obj, screen_cap = opt.sc )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L162_C8", "label": "print()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "vector": [8, 2, 0.9474, 0.0058, 2, 0.54, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Click on RVIZ!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L163_C8", "label": "sleep()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "vector": [8, 2, 0.9532, 0.0058, 2, 0.54, 0.4, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L166_C8", "label": "X, Y = meshgrid()", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "vector": [14, 2, 0.9708, 0.0058, 2, 0.54, 0.6, 835, 3, 2, 0, 0, 500, 10, 3], "semantic": {"name": "X, Y", "arg_names": [], "import_names": [], "rhs_call_name": "meshgrid", "annotation": ""}, "snippet": " X,Y = np.meshgrid( range(0,9), range(0,9) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L167_C8", "label": "trial_obj = zip()", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "vector": [14, 2, 0.9766, 0.0058, 2, 0.54, 0.8, 888, 3, 2, 0, 0, 814, 10, 3], "semantic": {"name": "trial_obj", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " trial_obj = zip( Y.flatten(), X.flatten() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L168_C8", "label": "expression", "type": "expression", "loc": [168, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "vector": [8, 2, 0.9854, 0.0117, 2, 0.54, 1.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [ publish_robotpose( trial, obj, 15, screen_cap = True )\n for trial, obj in order_by_rostime(trial_obj) ]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Try_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:Try_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:Try_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:Try_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:While_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Return_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Import_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99419:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99419:Expr_L168_C8"}] |
x = '''
\\begin{landscape}
\\begin{table}[p]
\\newcolumntype{x}[1]{>{\\centering\\hspace{0pt}}p{#1}}
\\newcolumntype{y}[1]{>{\\raggedleft\\hspace{0pt}}p{#1}}
\\centering
\\begin{tabular}{ | y{2cm} | c | c | c | c | r }
\\toprule
\\textbf{\\Large Object:} & Orange Meds & TV Remote & Red Bottle & Keys & \\multirow{4}{1.0cm}{\\LARGE ...} \\\\
\\midrule
\\midrule
\\textbf{Reads} & %s & %s & %s & %s & \\\\
\\textbf{$\\Delta xy$} & %s & %s & %s & %s & \\\\
\\textbf{$\\Delta \\Theta$} & %s & %s & %s & %s & \\\\
\\bottomrule
\\end{tabular}
\\vskip 30pt
\\begin{tabular}{ c | c | c | c | c | c | }
\\toprule
\\multirow{4}{0.5cm}{\\LARGE ...} & Med Bottle & Med Box & Teddy Bear & Cordless Phone & Hair Brush \\\\
\\midrule
\\midrule
& %s & %s & %s & %s & %s \\\\
& %s & %s & %s & %s & %s \\\\
& %s & %s & %s & %s & %s \\\\
\\bottomrule
\\end{tabular}
\\vskip 30pt
\\begin{tabular}{r r@{ = }l r@{ = }l}
\\toprule
\\multicolumn{5}{c}{\\textbf{\\Large OVERALL FOR LOCATION \\#%d}}\\\\
\\midrule
\\midrule
\\textbf{Reads:} & $\\mu$ & %3.1f & $\\sigma$ & %3.1f \\\\
\\textbf{$\\Delta xy$} & $\\mu$ & %3.1f m & $\\sigma$ & %3.1f m \\\\
\\textbf{$|\\Delta \\Theta|$} & $\\mu$ & %3.1f$^o$ & $\\sigma$ & %3.1f$^o$ \\\\
\\bottomrule
\\end{tabular}
\\caption{ RFID Search Performance for Tagged Objects at Location \\#%d }
\\label{tab:search-results-%d}
\end{table}
\end{landscape}
'''
| ajibawa-2023/Python-Code-Large/train/row_99420 | 1 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99420:Assign_L1_C0", "label": "x =", "type": "assigned_variable", "loc": [1, 48], "level": 0, "parent": null, "vector": [14, 0, 0.5104, 1.0, 0, 0.66, 0.0, 190, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "x = '''\n\\\\begin{landscape}\n\\\\begin{table}[p]\n \\\\newcolumntype{x}[1]{>{\\\\centering\\\\hspace{0pt}}p{#1}}\n \\\\newcolumntype{y}[1]{>{\\\\raggedleft\\\\hspace{0pt}}p{#1}}\n \\\\centering\n \\\\begin{tabular}{ | y{2cm} | c | c | c | c | r }\n \\\\toprule"}] | [] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
import rospy
import smach
import actionlib
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
from rfid_demos import sm_rfid_explore
from rfid_behaviors import recorder
from hrl_lib import util
from rfid_datacapture.srv import BagCapture, BagCaptureRequest
from rfid_demos import sm_rfid_servo_approach
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--fname', action='store', type='string', dest='fname',
help='File name. Should be without extension. [eg. \'trial\']', default='')
p.add_option('--tag', action='store', type='string', dest='tagid',
help='Tagid to approach', default='person ')
opt, args = p.parse_args()
if opt.fname == '':
print 'Fname required'
exit()
fname_base = '/u/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/search_aware_home/'
fname = fname_base + opt.fname
print 'SERVO APPROACH to ID: \'%s\'' % (opt.tagid)
rospy.init_node('smach_servo_datacapture')
sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],
input_keys = [ 'bagfile_name',
'bagfile_topics',
'tagid'])
with sm:
smach.StateMachine.add(
'START_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request_slots = ['topics','dest'] ),
remapping = {'topics':'bagfile_topics',
'dest':'bagfile_name'},
transitions = {'succeeded':'SERVO'})
sm_servo = sm_rfid_servo_approach.sm_rfid_servo_approach()
smach.StateMachine.add(
'SERVO',
sm_servo,
transitions = {'succeeded':'STOP_BAG_CAPTURE'},
remapping = {'tagid':'tagid'})
smach.StateMachine.add(
'STOP_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request = BagCaptureRequest('','') ),
transitions = {'succeeded':'succeeded'})
sm.userdata.tagid = opt.tagid
sm.userdata.bagfile_name = fname + '_servo'
sm.userdata.bagfile_topics = '/tf /rfid/ears_reader /rfid/ears_reader_arr /map /robot_pose_ekf/odom_combined /navigation/cmd_vel'
outcome = sm.execute()
| ajibawa-2023/Python-Code-Large/train/row_99421 | 38 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0267, 0.0133, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.0133, 0, 0.66, 0.0625, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0533, 0.0133, 0, 0.66, 0.125, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.0133, 0, 0.66, 0.1875, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.08, 0.0133, 0, 0.66, 0.25, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0933, 0.0133, 0, 0.66, 0.3125, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.1067, 0.0133, 0, 0.66, 0.375, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Import_L9_C0", "label": "rospy import rospy", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.12, 0.0133, 0, 0.66, 0.4375, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Import_L11_C0", "label": "smach import smach", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1467, 0.0133, 0, 0.66, 0.5, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Import_L12_C0", "label": "actionlib import actionlib", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.16, 0.0133, 0, 0.66, 0.5625, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:ImportFrom_L14_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1867, 0.0133, 0, 0.66, 0.625, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:ImportFrom_L15_C0", "label": "from rfid_demos import sm_rfid_explore", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.0133, 0, 0.66, 0.6875, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "rfid_demos", "arg_names": [], "import_names": ["sm_rfid_explore"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_demos import sm_rfid_explore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:ImportFrom_L16_C0", "label": "from rfid_behaviors import recorder", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.2133, 0.0133, 0, 0.66, 0.75, 746, 0, 1, 0, 0, 746, 0, 0], "semantic": {"name": "rfid_behaviors", "arg_names": [], "import_names": ["recorder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors import recorder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:ImportFrom_L17_C0", "label": "from hrl_lib import util", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2267, 0.0133, 0, 0.66, 0.8125, 649, 0, 1, 0, 0, 649, 0, 0], "semantic": {"name": "hrl_lib", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_lib import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:ImportFrom_L18_C0", "label": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.24, 0.0133, 0, 0.66, 0.875, 252, 0, 2, 0, 0, 252, 0, 0], "semantic": {"name": "rfid_datacapture.srv", "arg_names": [], "import_names": ["BagCapture", "BagCaptureRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:ImportFrom_L19_C0", "label": "from rfid_demos import sm_rfid_servo_approach", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2533, 0.0133, 0, 0.66, 0.9375, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "rfid_demos", "arg_names": [], "import_names": ["sm_rfid_servo_approach"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_demos import sm_rfid_servo_approach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "label": "if", "type": "if", "loc": [21, 74], "level": 0, "parent": null, "vector": [4, 0, 0.6333, 0.72, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--fname', action='store', type='string', dest='fname',\n help='File name. Should be without extension. [eg. \\'trial\\']', default='')\n\n p.add_option('--tag', action='store', type='string', dest='tagid',\n help='Tagid to approach', default='person ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Import_L22_C4", "label": "optparse import optparse", "type": "import", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [1, 1, 0.2933, 0.0133, 1, 0.57, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L23_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.3067, 0.0133, 1, 0.57, 0.0714, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L24_C4", "label": "add_option()", "type": "expression", "loc": [24, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [8, 1, 0.3267, 0.0267, 1, 0.57, 0.1429, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--fname', action='store', type='string', dest='fname',\n help='File name. Should be without extension. [eg. \\'trial\\']', default='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L27_C4", "label": "add_option()", "type": "expression", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [8, 1, 0.3667, 0.0267, 1, 0.57, 0.2143, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--tag', action='store', type='string', dest='tagid',\n help='Tagid to approach', default='person ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L29_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.3867, 0.0133, 1, 0.57, 0.2857, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L31_C4", "label": "if", "type": "if", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [4, 1, 0.4267, 0.04, 1, 0.57, 0.3571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.fname == '':\n print('Fname required')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L32_C8", "label": "print()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L31_C4", "vector": [8, 2, 0.4267, 0.0133, 2, 0.69, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Fname required')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L33_C8", "label": "exit()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L31_C4", "vector": [8, 2, 0.44, 0.0133, 2, 0.69, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L34_C4", "label": "fname_base =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.4533, 0.0133, 1, 0.57, 0.4286, 962, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fname_base", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname_base = '/u/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/search_aware_home/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L35_C4", "label": "fname =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.4667, 0.0133, 1, 0.57, 0.5, 190, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = fname_base + opt.fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L37_C4", "label": "print()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [8, 1, 0.4933, 0.0133, 1, 0.57, 0.5714, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('SERVO APPROACH to ID: \\'%s\\'' % (opt.tagid))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L39_C4", "label": "init_node()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [8, 1, 0.52, 0.0133, 1, 0.57, 0.6429, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('smach_servo_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L41_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [41, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.5667, 0.0533, 1, 0.57, 0.7143, 21, 3, 2, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],\n input_keys = [ 'bagfile_name',\n 'bagfile_topics',\n 'tagid'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L46_C8", "label": "add()", "type": "expression", "loc": [46, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [8, 1, 0.66, 0.1067, 1, 0.57, 0.0, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'START_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request_slots = ['topics','dest'] ),\n remapping = {'topics':'bagfile_topics',\n 'dest':'bagfile_name'},\n transitions = {'succeeded':'SERVO'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L55_C8", "label": "sm_servo = sm_rfid_servo_approach()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.7333, 0.0133, 1, 0.57, 0.3333, 460, 3, 0, 0, 0, 183, 10, 1], "semantic": {"name": "sm_servo", "arg_names": [], "import_names": [], "rhs_call_name": "sm_rfid_servo_approach", "annotation": ""}, "snippet": " sm_servo = sm_rfid_servo_approach.sm_rfid_servo_approach()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L57_C8", "label": "add()", "type": "expression", "loc": [57, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [8, 1, 0.7867, 0.0667, 1, 0.57, 0.6667, 241, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'SERVO',\n sm_servo,\n transitions = {'succeeded':'STOP_BAG_CAPTURE'},\n remapping = {'tagid':'tagid'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L63_C8", "label": "add()", "type": "expression", "loc": [63, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [8, 1, 0.8733, 0.08, 1, 0.57, 1.0, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'STOP_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request = BagCaptureRequest('','') ),\n transitions = {'succeeded':'succeeded'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L70_C4", "label": "sm.userdata.tagid =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.9333, 0.0133, 1, 0.57, 0.7857, 452, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sm.userdata.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.tagid = opt.tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L71_C4", "label": "sm.userdata.bagfile_name =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.9467, 0.0133, 1, 0.57, 0.8571, 565, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sm.userdata.bagfile_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.bagfile_name = fname + '_servo'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L72_C4", "label": "sm.userdata.bagfile_topics =", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.96, 0.0133, 1, 0.57, 0.9286, 446, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sm.userdata.bagfile_topics", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.bagfile_topics = '/tf /rfid/ears_reader /rfid/ears_reader_arr /map /robot_pose_ekf/odom_combined /navigation/cmd_vel'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L74_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "vector": [14, 1, 0.9867, 0.0133, 1, 0.57, 1.0, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Import_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99421:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99421:Assign_L74_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('tf')
import rospy
import rfid_datacapture.math_util as mu
import sm_aware_home_explore as ahe
import glob
import yaml
import tf
import tf.transformations as tft
import json
import numpy as np, math
import cPickle as pkl
import template
print 'THIS FILE DEPRICATED AND INACCURATE!!! USE REL_STATS!'
res = []
for i in xrange( 9 ): # trial
for j in xrange( 9 ): # object
skip = False # (hacky)
obj_num = j
obj_name = ahe.tdb[j][0]
tname = obj_name.replace( ' ', '' )
trial_num = i
loc = (i + j) % 9
loc_name = ahe.pts[loc][0]
loc_pos = np.array(ahe.pts[loc][1]) # Tag ground-truth location
print 'Trial %d with Object %d (%s) at Position %d (%s)' % (i, obj_num, obj_name, loc, loc_name)
fname = 'search_aware_home/woot_150_'+str(i)+'_reads.pkl'
f = open( fname, 'r' )
summary = pkl.load( f )
f.close()
pos_readings = sum([ True for p in summary if p.read.rssi != -1 and p.read.tagID == obj_name ])
tot_readings = len( summary )
print '\t Positive Reads: %d of %d (%2.2f)' % ( pos_readings,
tot_readings,
100.0 * pos_readings / tot_readings )
search_fname = 'search_aware_home/woot_150_' + str(i) + '_tag_' + tname + '.yaml'
glob_r = glob.glob( search_fname )
if glob_r == []:
print '\t No results for this instance.'
skip = True
if len(glob_r) > 1:
print '\t Multiple results...?! Weirdness. Skipping.'
skip = True
servo_fname = 'search_aware_home/woot_150_' + str(i) + '_tag_' + tname + '_end.txt'
glob_r = glob.glob( servo_fname )
if glob_r == []:
print '\t No results for this instance.'
skip = True
if len(glob_r) > 1:
print '\t Multiple results...?! Weirdness. Skipping.'
skip = True
if not skip:
f = open( search_fname )
y = yaml.load( f )
f.close()
# "Best" Location determined by search
efq = tft.euler_from_quaternion
search_theta = efq( [ y['pose']['orientation']['x'],
y['pose']['orientation']['y'],
y['pose']['orientation']['z'],
y['pose']['orientation']['w'] ])[-1]
search_pos = np.array([ y['pose']['position']['x'],
y['pose']['position']['y'],
y['pose']['position']['z'] ])
search_true_theta = np.arctan2( loc_pos[1] - search_pos[1], # y / x
loc_pos[0] - search_pos[0] )
search_theta_diff = mu.standard_rad( search_theta - search_true_theta )
search_pos_diff = np.linalg.norm( search_pos - loc_pos )
print '\t Post-Search Stats:'
print '\t\t Tag-Robot distance err (m): %2.3f' % (search_pos_diff)
print '\t\t Tag-Robot orient err (deg): %2.3f' % (math.degrees(search_theta_diff))
print '\t\t Debug Stats', math.degrees(search_theta), math.degrees(search_true_theta), search_pos, loc_pos
# Location after Servoing
f = open( servo_fname )
r = f.readlines()
f.close()
# ['At time 1313069718.853\n',
# '- Translation: [2.811, 1.711, 0.051]\n',
# '- Rotation: in Quaternion [0.003, 0.001, -0.114, 0.993]\n',
# ' in RPY [0.005, 0.003, -0.229]\n',
# 'At time 1313069719.853\n',
# '- Translation: [2.811, 1.711, 0.051]\n',
# '- Rotation: in Quaternion [0.003, 0.001, -0.114, 0.993]\n',
# ' in RPY [0.005, 0.002, -0.229]\n']
rpy = r[-1].find('RPY')+3
servo_theta = json.loads( r[-1][rpy:] )[-1]
tion = r[-3].find('tion:')+5
servo_pos = np.array(json.loads( r[-3][tion:] ))
servo_true_theta = np.arctan2( loc_pos[1] - servo_pos[1], # y / x
loc_pos[0] - servo_pos[0] )
servo_theta_diff = mu.standard_rad( servo_theta - servo_true_theta )
servo_pos_diff = np.linalg.norm( servo_pos - loc_pos )
print '\t Post-Servo Stats:'
print '\t\t Tag-Robot distance err (m): %2.3f' % (servo_pos_diff)
print '\t\t Tag-Robot orient err (deg): %2.3f' % (math.degrees(servo_theta_diff))
print '\t\t Debug Stats', math.degrees(servo_theta), math.degrees(servo_true_theta), servo_pos, loc_pos
res.append( [ loc, obj_num, i, pos_readings, tot_readings, servo_pos_diff, math.degrees(servo_theta_diff) ] )
else:
res.append( [ loc, obj_num, i, pos_readings, tot_readings, '--', '--' ] )
print '\t Done.\n\n'
res.sort()
print '\n\nRESULTS SORTED\n\n'
def pprint(r):
print 'Location %d, Object %d, Trial %d' % (r[0], r[1], r[2])
if r[3] > 0:
print '\tPos Reads: %d' % (r[3])
print '\tTot Reads: %d' % (r[4])
print '\tPercent Reads: %2.3f' % (r[3]*100.0/r[4])
print '\tDist Err (m): %2.3f' % (r[5])
print '\tAng Err (deg): %2.3f' % (r[6])
else:
print '\tPos Reads: %d' % (r[3])
print '\tTot Reads: %d' % (r[4])
print '\tPercent Reads: %2.3f' % (r[3]*100.0/r[4])
print '\tDist Err (m): ----'
print '\tAng Err (deg): ----'
[ pprint(r) for r in res ]
print '\n\n######### OUTPUTTING TEX TABLES from template.py #########\n\n'
def delta_xy( r ):
if r[3] > 0:
return '%2.3f m' % (r[5])
else:
return '$--$'
def delta_theta( r ):
if r[3] > 0:
return '%2.1f$^o$' % (r[6])
else:
return '$--$'
for i in xrange( 9 ):
io = [ r for r in res if r[0] == i ]
if len(io) != 9:
print 'BIG PROBLEM. IO != 9'
exit()
args = []
# Top Table
args += [ '%d / %d (%2.1f\\%%)' % (r[3], r[4], r[3] * 100.0 / r[4]) for r in io ][0:4]
args += [ delta_xy(r) for r in io ][0:4]
args += [ delta_theta(r) for r in io ][0:4]
# Bottom Table
args += [ '%d / %d (%2.1f\\%%)' % (r[3], r[4], r[3] * 100.0 / r[4]) for r in io ][4:]
args += [ delta_xy(r) for r in io ][4:]
args += [ delta_theta(r) for r in io ][4:]
# Overall Table
args += [ io[0][0] ] # Title
args += [ np.mean( [ r[3] for r in io ] ),
np.std( [ r[3] for r in io ] ) ] # Reads
args += [ np.mean( [ r[5] for r in io if r[3] > 0 ] ),
np.std( [ r[5] for r in io if r[3] > 0 ] )] # Distances (Only meaningful for detected tags)
args += [ np.mean( np.abs([ r[6] for r in io if r[3] > 0 ]) ),
np.std( np.abs([ r[6] for r in io if r[3] > 0 ]) )] # |angle| (Only meaningful for detected tags)
# Caption
args += [ io[0][0], io[0][0] ]
io_templated = template.x % tuple( args )
f = open('rfid_search_loc%d_table.tex' % (i),'w')
f.write( io_templated )
f.close()
print 'THIS FILE DEPRICATED AND INACCURATE!!! USE REL_STATS!'
| ajibawa-2023/Python-Code-Large/train/row_99422 | 33 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L1_C0", "label": "roslib import roslib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L2_C0", "label": "rospy import rospy", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0465, 0.0233, 0, 0.66, 0.0714, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L4_C0", "label": "rfid_datacapture.math_util import mu", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.093, 0.0233, 0, 0.66, 0.1429, 974, 0, 1, 0, 0, 974, 0, 0], "semantic": {"name": "rfid_datacapture.math_util", "arg_names": [], "import_names": ["mu"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_datacapture.math_util as mu"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L5_C0", "label": "sm_aware_home_explore import ahe", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1163, 0.0233, 0, 0.66, 0.2143, 54, 0, 1, 0, 0, 54, 0, 0], "semantic": {"name": "sm_aware_home_explore", "arg_names": [], "import_names": ["ahe"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sm_aware_home_explore as ahe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L6_C0", "label": "glob import glob", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1395, 0.0233, 0, 0.66, 0.2857, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L7_C0", "label": "yaml import yaml", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1628, 0.0233, 0, 0.66, 0.3571, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L8_C0", "label": "tf import tf", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.186, 0.0233, 0, 0.66, 0.4286, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L9_C0", "label": "tf.transformations import tft", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.2093, 0.0233, 0, 0.66, 0.5, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tft"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tft"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L10_C0", "label": "json import json", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.2326, 0.0233, 0, 0.66, 0.5714, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L11_C0", "label": "numpy import np, math", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2558, 0.0233, 0, 0.66, 0.6429, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L12_C0", "label": "cPickle import pkl", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2791, 0.0233, 0, 0.66, 0.7143, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Import_L13_C0", "label": "template import template", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.3023, 0.0233, 0, 0.66, 0.7857, 549, 0, 1, 0, 0, 549, 0, 0], "semantic": {"name": "template", "arg_names": [], "import_names": ["template"], "rhs_call_name": "", "annotation": ""}, "snippet": "import template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L16_C0", "label": "pprint", "type": "function", "loc": [16, 29], "level": 0, "parent": null, "vector": [2, 0, 0.5233, 0.3256, 0, 0.66, 0.8571, 276, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "pprint", "arg_names": ["r"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pprint(r):\n print('Location %d, Object %d, Trial %d' % (r[0], r[1], r[2]))\n if r[3] > 0:\n print('\\tPos Reads: %d' % (r[3]))\n print('\\tTot Reads: %d' % (r[4]))\n print('\\tPercent Reads: %2.3f' % (r[3]*100.0/r[4]))\n print('\\tDist Err (m): %2.3f' % (r[5]))\n print('\\tAng Err (deg): %2.3f' % (r[6]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L17_C4", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L16_C0", "vector": [8, 1, 0.3953, 0.0233, 1, 0.38, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Location %d, Object %d, Trial %d' % (r[0], r[1], r[2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "label": "if", "type": "if", "loc": [18, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L16_C0", "vector": [4, 1, 0.5465, 0.2791, 1, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r[3] > 0:\n print('\\tPos Reads: %d' % (r[3]))\n print('\\tTot Reads: %d' % (r[4]))\n print('\\tPercent Reads: %2.3f' % (r[3]*100.0/r[4]))\n print('\\tDist Err (m): %2.3f' % (r[5]))\n print('\\tAng Err (deg): %2.3f' % (r[6]))\n else:\n print('\\tPos Reads: %d' % (r[3]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L19_C8", "label": "print()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.4419, 0.0233, 2, 0.01, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tPos Reads: %d' % (r[3]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L20_C8", "label": "print()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.4651, 0.0233, 2, 0.01, 0.1111, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tTot Reads: %d' % (r[4]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L21_C8", "label": "print()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.4884, 0.0233, 2, 0.01, 0.2222, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tPercent Reads: %2.3f' % (r[3]*100.0/r[4]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L22_C8", "label": "print()", "type": "expression", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.5116, 0.0233, 2, 0.01, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tDist Err (m): %2.3f' % (r[5]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L23_C8", "label": "print()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.5349, 0.0233, 2, 0.01, 0.4444, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tAng Err (deg): %2.3f' % (r[6]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L25_C8", "label": "print()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.5814, 0.0233, 2, 0.01, 0.5556, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tPos Reads: %d' % (r[3]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L26_C8", "label": "print()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.6047, 0.0233, 2, 0.01, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tTot Reads: %d' % (r[4]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L27_C8", "label": "print()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.6279, 0.0233, 2, 0.01, 0.7778, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tPercent Reads: %2.3f' % (r[3]*100.0/r[4]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L28_C8", "label": "print()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.6512, 0.0233, 2, 0.01, 0.8889, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tDist Err (m): ----')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L29_C8", "label": "print()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "vector": [8, 2, 0.6744, 0.0233, 2, 0.01, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tAng Err (deg): ----')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L31_C0", "label": "delta_xy", "type": "function", "loc": [31, 35], "level": 0, "parent": null, "vector": [2, 0, 0.7674, 0.1163, 0, 0.66, 0.9286, 497, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "delta_xy", "arg_names": ["r"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def delta_xy( r ):\n if r[3] > 0:\n return '%2.3f m' % (r[5])\n else:\n return '$--$'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L32_C4", "label": "if", "type": "if", "loc": [32, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L31_C0", "vector": [4, 1, 0.7791, 0.093, 1, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r[3] > 0:\n return '%2.3f m' % (r[5])\n else:\n return '$--$'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Return_L33_C8", "label": "return", "type": "return", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L32_C4", "vector": [13, 2, 0.7674, 0.0233, 2, 0.32, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%2.3f m' % (r[5])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Return_L35_C8", "label": "return", "type": "return", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L32_C4", "vector": [13, 2, 0.814, 0.0233, 2, 0.32, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '$--$'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L37_C0", "label": "delta_theta", "type": "function", "loc": [37, 41], "level": 0, "parent": null, "vector": [2, 0, 0.907, 0.1163, 0, 0.66, 1.0, 348, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "delta_theta", "arg_names": ["r"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def delta_theta( r ):\n if r[3] > 0:\n return '%2.1f$^o$' % (r[6])\n else:\n return '$--$'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L38_C4", "label": "if", "type": "if", "loc": [38, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L37_C0", "vector": [4, 1, 0.9186, 0.093, 1, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r[3] > 0:\n return '%2.1f$^o$' % (r[6])\n else:\n return '$--$'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Return_L39_C8", "label": "return", "type": "return", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L38_C4", "vector": [13, 2, 0.907, 0.0233, 2, 0.05, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%2.1f$^o$' % (r[6])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99422:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L38_C4", "vector": [13, 2, 0.9535, 0.0233, 2, 0.05, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '$--$'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Return_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Return_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Return_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99422:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99422:Return_L41_C8"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('pr2_controllers_msgs')
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
import rospy
import smach
import actionlib
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
from pr2_controllers_msgs.msg import PointHeadAction, PointHeadGoal
from rfid_datacapture.srv import BagCapture, BagCaptureRequest
def head_capture( ):
# Create a SMACH state machine
sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],
input_keys = [ 'bagfile_name', 'bagfile_topics' ])
with sm:
def PointAdd( x, y, z, dur, state, res ):
pgoal = PointHeadGoal()
pgoal.target.header.frame_id = '/torso_lift_link'
pgoal.target.point.x = x
pgoal.target.point.y = y
pgoal.target.point.z = z
pgoal.min_duration = rospy.Duration( dur )
pgoal.max_velocity = 1.0
smach.StateMachine.add(
state,
SimpleActionState( '/head_traj_controller/point_head_action',
PointHeadAction,
goal = pgoal ),
transitions = { 'succeeded' : res })
return
PointAdd( 0.00, -1.00, -0.60, 5.0, 'PH1', 'START_BAG_CAPTURE' )
smach.StateMachine.add(
'START_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request_slots = ['topics','dest'] ),
remapping = {'topics':'bagfile_topics',
'dest':'bagfile_name'},
transitions = {'succeeded':'PH2'})
PointAdd( 0.00, 1.00, -0.60, 15.0, 'PH2', 'PH3' )
PointAdd( 0.00, 1.00, -0.20, 3.0, 'PH3', 'PH4' )
PointAdd( 0.00, -1.00, -0.20, 15.0, 'PH4', 'PH5' )
PointAdd( 0.00, -1.00, 0.30, 3.0, 'PH5', 'PH6' )
PointAdd( 0.00, 1.00, 0.30, 15.0, 'PH6', 'PH7' )
PointAdd( 1.00, 0.00, 0.00, 7.5, 'PH7', 'STOP_BAG_CAPTURE' )
smach.StateMachine.add(
'STOP_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request = BagCaptureRequest('','') ),
transitions = {'succeeded':'succeeded'})
return sm
class DelayState( smach.State ):
def __init__( self, delay = 3.0 ):
smach.State.__init__(self,outcomes=['succeeded', 'aborted'])
self.delay = delay
def execute( self, userdata ):
rospy.sleep( self.delay )
return 'succeeded'
def cam_capture( ):
# Create a SMACH state machine
sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],
input_keys = [ 'bagfile_name', 'bagfile_topics' ])
with sm:
smach.StateMachine.add(
'START_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request_slots = ['topics','dest'] ),
remapping = {'topics':'bagfile_topics',
'dest':'bagfile_name'},
transitions = {'succeeded':'DELAY'})
smach.StateMachine.add(
'DELAY',
DelayState(),
transitions = {'succeeded':'STOP_BAG_CAPTURE'})
smach.StateMachine.add(
'STOP_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request = BagCaptureRequest('','') ),
transitions = {'succeeded':'succeeded'})
return sm
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--fname', action='store', type='string', dest='fname',
help='File name. Should be without extension. [eg. \'trial\']', default='')
opt, args = p.parse_args()
if opt.fname == '':
print 'Fname required'
exit()
rospy.init_node('smach_head_capture')
sm = head_capture()
sis = IntrospectionServer('sm_head_capture', sm, '/SM_HEAD_CAPTURE')
sis.start()
fname_base = '/u/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/search_aware_home/'
fname = fname_base + opt.fname
sm.userdata.bagfile_name = fname
#sm.userdata.bagfile_topics = '/tf /kinect_head/rgb/points_throttled /kinect_head/rgb/image_color'
sm.userdata.bagfile_topics = '/tf /kinect_head/rgb/points_throttled'
outcome = sm.execute()
#raw_input( 'Hit [ENTER] to begin capturing camera.' )
sm_cam = cam_capture()
sm_cam.userdata.bagfile_name = fname + '_cam'
sm_cam.userdata.bagfile_topics = '/tf /kinect_head/rgb/image_color'
sm_cam.execute()
sis.stop()
| ajibawa-2023/Python-Code-Large/train/row_99423 | 68 | 146 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0137, 0.0068, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0205, 0.0068, 0, 0.66, 0.0714, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('pr2_controllers_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0274, 0.0068, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0342, 0.0068, 0, 0.66, 0.2143, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0411, 0.0068, 0, 0.66, 0.2857, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Import_L7_C0", "label": "rospy import rospy", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0479, 0.0068, 0, 0.66, 0.3571, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Import_L9_C0", "label": "smach import smach", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0616, 0.0068, 0, 0.66, 0.4286, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Import_L10_C0", "label": "actionlib import actionlib", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0685, 0.0068, 0, 0.66, 0.5, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:ImportFrom_L12_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0822, 0.0068, 0, 0.66, 0.5714, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:ImportFrom_L13_C0", "label": "from pr2_controllers_msgs.msg import PointHeadAction, PointHeadGoal", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.089, 0.0068, 0, 0.66, 0.6429, 457, 0, 2, 0, 0, 457, 0, 0], "semantic": {"name": "pr2_controllers_msgs.msg", "arg_names": [], "import_names": ["PointHeadAction", "PointHeadGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pr2_controllers_msgs.msg import PointHeadAction, PointHeadGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:ImportFrom_L14_C0", "label": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0959, 0.0068, 0, 0.66, 0.7143, 252, 0, 2, 0, 0, 252, 0, 0], "semantic": {"name": "rfid_datacapture.srv", "arg_names": [], "import_names": ["BagCapture", "BagCaptureRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "label": "head_capture", "type": "function", "loc": [16, 64], "level": 0, "parent": null, "vector": [2, 0, 0.274, 0.3356, 0, 0.66, 0.7857, 402, 0, 0, 1, 0, 0, 0, 17], "semantic": {"name": "head_capture", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def head_capture( ):\n # Create a SMACH state machine\n sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],\n input_keys = [ 'bagfile_name', 'bagfile_topics' ])\n with sm:\n\n def PointAdd( x, y, z, dur, state, res ):\n pgoal = PointHeadGoal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L18_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [14, 1, 0.1267, 0.0137, 1, 0.01, 0.0, 21, 3, 2, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],\n input_keys = [ 'bagfile_name', 'bagfile_topics' ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "label": "PointAdd", "type": "function", "loc": [22, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [2, 1, 0.1986, 0.1027, 1, 0.01, 0.0, 429, 0, 6, 0, 0, 0, 0, 4], "semantic": {"name": "PointAdd", "arg_names": ["x", "y", "z", "dur", "state", "res"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def PointAdd( x, y, z, dur, state, res ):\n pgoal = PointHeadGoal()\n pgoal.target.header.frame_id = '/torso_lift_link'\n pgoal.target.point.x = x\n pgoal.target.point.y = y\n pgoal.target.point.z = z\n pgoal.min_duration = rospy.Duration( dur )\n pgoal.max_velocity = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L23_C12", "label": "pgoal = PointHeadGoal()", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [14, 2, 0.1575, 0.0068, 2, 0.53, 0.0, 882, 3, 0, 0, 0, 479, 10, 1], "semantic": {"name": "pgoal", "arg_names": [], "import_names": [], "rhs_call_name": "PointHeadGoal", "annotation": ""}, "snippet": " pgoal = PointHeadGoal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L24_C12", "label": "pgoal.target.header.frame_id =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [14, 2, 0.1644, 0.0068, 2, 0.53, 0.125, 99, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pgoal.target.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.target.header.frame_id = '/torso_lift_link'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L25_C12", "label": "pgoal.target.point.x =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [14, 2, 0.1712, 0.0068, 2, 0.53, 0.25, 801, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pgoal.target.point.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.target.point.x = x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L26_C12", "label": "pgoal.target.point.y =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [14, 2, 0.1781, 0.0068, 2, 0.53, 0.375, 59, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pgoal.target.point.y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.target.point.y = y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L27_C12", "label": "pgoal.target.point.z =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [14, 2, 0.1849, 0.0068, 2, 0.53, 0.5, 591, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pgoal.target.point.z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.target.point.z = z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L28_C12", "label": "pgoal.min_duration = Duration()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [14, 2, 0.1918, 0.0068, 2, 0.53, 0.625, 457, 3, 1, 0, 0, 972, 10, 1], "semantic": {"name": "pgoal.min_duration", "arg_names": [], "import_names": [], "rhs_call_name": "Duration", "annotation": ""}, "snippet": " pgoal.min_duration = rospy.Duration( dur )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L29_C12", "label": "pgoal.max_velocity =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [14, 2, 0.1986, 0.0068, 2, 0.53, 0.75, 412, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "pgoal.max_velocity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pgoal.max_velocity = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L30_C12", "label": "add()", "type": "expression", "loc": [30, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [8, 2, 0.2226, 0.0411, 2, 0.53, 0.875, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n state,\n SimpleActionState( '/head_traj_controller/point_head_action',\n PointHeadAction,\n goal = pgoal ),\n transitions = { 'succeeded' : res })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Return_L36_C12", "label": "return", "type": "return", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "vector": [13, 2, 0.2466, 0.0068, 2, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L38_C8", "label": "PointAdd()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.2603, 0.0068, 1, 0.01, 0.1, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( 0.00, -1.00, -0.60, 5.0, 'PH1', 'START_BAG_CAPTURE' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L40_C8", "label": "add()", "type": "expression", "loc": [40, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.2979, 0.0548, 1, 0.01, 0.2, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'START_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request_slots = ['topics','dest'] ),\n remapping = {'topics':'bagfile_topics',\n 'dest':'bagfile_name'},\n transitions = {'succeeded':'PH2'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L50_C8", "label": "PointAdd()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.3425, 0.0068, 1, 0.01, 0.3, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( 0.00, 1.00, -0.60, 15.0, 'PH2', 'PH3' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L51_C8", "label": "PointAdd()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.3493, 0.0068, 1, 0.01, 0.4, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( 0.00, 1.00, -0.20, 3.0, 'PH3', 'PH4' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L52_C8", "label": "PointAdd()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.3562, 0.0068, 1, 0.01, 0.5, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( 0.00, -1.00, -0.20, 15.0, 'PH4', 'PH5' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L53_C8", "label": "PointAdd()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.363, 0.0068, 1, 0.01, 0.6, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( 0.00, -1.00, 0.30, 3.0, 'PH5', 'PH6' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L54_C8", "label": "PointAdd()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.3699, 0.0068, 1, 0.01, 0.7, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( 0.00, 1.00, 0.30, 15.0, 'PH6', 'PH7' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L55_C8", "label": "PointAdd()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.3767, 0.0068, 1, 0.01, 0.8, 429, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "PointAdd", "arg_names": [], "import_names": [], "rhs_call_name": "PointAdd", "annotation": ""}, "snippet": " PointAdd( 1.00, 0.00, 0.00, 7.5, 'PH7', 'STOP_BAG_CAPTURE' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L57_C8", "label": "add()", "type": "expression", "loc": [57, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [8, 1, 0.4075, 0.0411, 1, 0.01, 0.9, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'STOP_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request = BagCaptureRequest('','') ),\n transitions = {'succeeded':'succeeded'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Return_L64_C8", "label": "return", "type": "return", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "vector": [13, 1, 0.4384, 0.0068, 1, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:ClassDef_L67_C0", "label": "DelayState", "type": "class", "loc": [67, 74], "level": 0, "parent": null, "vector": [3, 0, 0.4829, 0.0548, 0, 0.66, 0.8571, 485, 0, 2, 0, 0, 892, 0, 2], "semantic": {"name": "DelayState", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DelayState( smach.State ):\n def __init__( self, delay = 3.0 ):\n smach.State.__init__(self,outcomes=['succeeded', 'aborted'])\n self.delay = delay\n\n def execute( self, userdata ):\n rospy.sleep( self.delay )\n return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L68_C4", "label": "__init__", "type": "function", "loc": [68, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:ClassDef_L67_C0", "vector": [2, 1, 0.4726, 0.0205, 1, 0.28, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "delay"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, delay = 3.0 ):\n smach.State.__init__(self,outcomes=['succeeded', 'aborted'])\n self.delay = delay"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L69_C8", "label": "__init__()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L68_C4", "vector": [8, 2, 0.4726, 0.0068, 2, 0.23, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self,outcomes=['succeeded', 'aborted'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L70_C8", "label": "self.delay =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L68_C4", "vector": [14, 2, 0.4795, 0.0068, 2, 0.23, 1.0, 576, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.delay", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.delay = delay"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L72_C4", "label": "execute", "type": "function", "loc": [72, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:ClassDef_L67_C0", "vector": [2, 1, 0.5, 0.0205, 1, 0.28, 1.0, 569, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute( self, userdata ):\n rospy.sleep( self.delay )\n return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L73_C8", "label": "sleep()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L72_C4", "vector": [8, 2, 0.5, 0.0068, 2, 0.29, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( self.delay )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Return_L74_C8", "label": "return", "type": "return", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L72_C4", "vector": [13, 2, 0.5068, 0.0068, 2, 0.29, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "label": "cam_capture", "type": "function", "loc": [77, 104], "level": 0, "parent": null, "vector": [2, 0, 0.6199, 0.1918, 0, 0.66, 0.9286, 985, 0, 0, 1, 0, 0, 0, 8], "semantic": {"name": "cam_capture", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cam_capture( ):\n # Create a SMACH state machine\n sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],\n input_keys = [ 'bagfile_name', 'bagfile_topics' ])\n with sm:\n\n smach.StateMachine.add(\n 'START_BAG_CAPTURE',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L79_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "vector": [14, 1, 0.5445, 0.0137, 1, 0.15, 0.0, 21, 3, 2, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'],\n input_keys = [ 'bagfile_name', 'bagfile_topics' ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L83_C8", "label": "add()", "type": "expression", "loc": [83, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "vector": [8, 1, 0.5925, 0.0548, 1, 0.15, 0.0, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'START_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request_slots = ['topics','dest'] ),\n remapping = {'topics':'bagfile_topics',\n 'dest':'bagfile_name'},\n transitions = {'succeeded':'DELAY'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L92_C8", "label": "add()", "type": "expression", "loc": [92, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "vector": [8, 1, 0.6404, 0.0274, 1, 0.15, 0.3333, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'DELAY',\n DelayState(),\n transitions = {'succeeded':'STOP_BAG_CAPTURE'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L97_C8", "label": "add()", "type": "expression", "loc": [97, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "vector": [8, 1, 0.6815, 0.0411, 1, 0.15, 0.6667, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'STOP_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request = BagCaptureRequest('','') ),\n transitions = {'succeeded':'succeeded'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Return_L104_C8", "label": "return", "type": "return", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "vector": [13, 1, 0.7123, 0.0068, 1, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "label": "if", "type": "if", "loc": [107, 143], "level": 0, "parent": null, "vector": [4, 0, 0.8562, 0.2534, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--fname', action='store', type='string', dest='fname',\n help='File name. Should be without extension. [eg. \\'trial\\']', default='')\n\n opt, args = p.parse_args()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Import_L108_C4", "label": "optparse import optparse", "type": "import", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [1, 1, 0.7397, 0.0068, 1, 0.82, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L109_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.7466, 0.0068, 1, 0.82, 0.0556, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L110_C4", "label": "add_option()", "type": "expression", "loc": [110, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [8, 1, 0.7568, 0.0137, 1, 0.82, 0.1111, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--fname', action='store', type='string', dest='fname',\n help='File name. Should be without extension. [eg. \\'trial\\']', default='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L113_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.774, 0.0068, 1, 0.82, 0.1667, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L115_C4", "label": "if", "type": "if", "loc": [115, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [4, 1, 0.7945, 0.0205, 1, 0.82, 0.2222, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.fname == '':\n print('Fname required')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L116_C8", "label": "print()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L115_C4", "vector": [8, 2, 0.7945, 0.0068, 2, 0.18, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Fname required')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L117_C8", "label": "exit()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L115_C4", "vector": [8, 2, 0.8014, 0.0068, 2, 0.18, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L119_C4", "label": "init_node()", "type": "expression", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [8, 1, 0.8151, 0.0068, 1, 0.82, 0.2778, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('smach_head_capture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L121_C4", "label": "sm = head_capture()", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.8288, 0.0068, 1, 0.82, 0.3333, 21, 3, 0, 0, 0, 402, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "head_capture", "annotation": ""}, "snippet": " sm = head_capture()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L123_C4", "label": "sis = IntrospectionServer()", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.8425, 0.0068, 1, 0.82, 0.3889, 608, 3, 3, 0, 0, 702, 10, 1], "semantic": {"name": "sis", "arg_names": [], "import_names": [], "rhs_call_name": "IntrospectionServer", "annotation": ""}, "snippet": " sis = IntrospectionServer('sm_head_capture', sm, '/SM_HEAD_CAPTURE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L124_C4", "label": "start()", "type": "expression", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [8, 1, 0.8493, 0.0068, 1, 0.82, 0.4444, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " sis.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L126_C4", "label": "fname_base =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.863, 0.0068, 1, 0.82, 0.5, 962, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fname_base", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname_base = '/u/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/search_aware_home/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L127_C4", "label": "fname =", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.8699, 0.0068, 1, 0.82, 0.5556, 190, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = fname_base + opt.fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L129_C4", "label": "sm.userdata.bagfile_name =", "type": "assigned_variable", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.8836, 0.0068, 1, 0.82, 0.6111, 565, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sm.userdata.bagfile_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.bagfile_name = fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L131_C4", "label": "sm.userdata.bagfile_topics =", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.8973, 0.0068, 1, 0.82, 0.6667, 446, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sm.userdata.bagfile_topics", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm.userdata.bagfile_topics = '/tf /kinect_head/rgb/points_throttled'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L133_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.911, 0.0068, 1, 0.82, 0.7222, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L137_C4", "label": "sm_cam = cam_capture()", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.9384, 0.0068, 1, 0.82, 0.7778, 927, 3, 0, 0, 0, 985, 10, 1], "semantic": {"name": "sm_cam", "arg_names": [], "import_names": [], "rhs_call_name": "cam_capture", "annotation": ""}, "snippet": " sm_cam = cam_capture()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L138_C4", "label": "sm_cam.userdata.bagfile_name =", "type": "assigned_variable", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.9452, 0.0068, 1, 0.82, 0.8333, 733, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sm_cam.userdata.bagfile_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm_cam.userdata.bagfile_name = fname + '_cam'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L139_C4", "label": "sm_cam.userdata.bagfile_topics =", "type": "assigned_variable", "loc": [139, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [14, 1, 0.9521, 0.0068, 1, 0.82, 0.8889, 493, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sm_cam.userdata.bagfile_topics", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm_cam.userdata.bagfile_topics = '/tf /kinect_head/rgb/image_color'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L141_C4", "label": "execute()", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [8, 1, 0.9658, 0.0068, 1, 0.82, 0.9444, 569, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " sm_cam.execute()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L143_C4", "label": "stop()", "type": "expression", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "vector": [8, 1, 0.9795, 0.0068, 1, 0.82, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " sis.stop()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Return_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Return_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Return_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Return_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Import_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99423:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99423:Expr_L143_C4"}] |
__all__ = [
'utils'
'process_bags_friis'
'process_bags_utils'
]
| ajibawa-2023/Python-Code-Large/train/row_99424 | 1 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99424:Assign_L1_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [1, 5], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.8333, 0, 0.66, 0.0, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n'utils'\n'process_bags_friis'\n'process_bags_utils'\n]"}] | [] |
#! /usr/bin/python
import roslib
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('rfid_demos')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('rosbag')
import rospy
import tf
from rfid_behaviors.srv import RecorderSrv, RecorderSrvResponse
from rfid_behaviors.srv import NextBestVantage
from rfid_behaviors.msg import RecorderReads
import hrl_rfid.ros_M5e_client as rmc
from geometry_msgs.msg import PoseStamped
from hrl_rfid.msg import RFIDread
from hrl_lib import util
import process_bags_utils as pbut
from rfid_behaviors import recorder
import rosbag
import glob
import numpy as np,math
SERVO_FNAMES = 'search_cap/search_aware_home/*_servo.bag'
# This is a modified version of rfid_behaviors.recorder.py
class TmpRecorder( ):
def __init__( self, serv_name = 'rfid_recorder', node_name = 'rfid_recorder_py' ):
rospy.logout( 'rfid_recorder: initializing' )
try:
rospy.init_node(node_name)
except:
pass
self.name = 'ears'
self.should_rec = False
self.listener = tf.TransformListener()
# rospy.logout( 'RFID Recorder: Waiting on transforms' )
# self.listener.waitForTransform('/ear_antenna_left', '/map',
# rospy.Time(0), timeout = rospy.Duration(100) )
# self.listener.waitForTransform('/ear_antenna_right', '/map',
# rospy.Time(0), timeout = rospy.Duration(100) )
self.data = []
self._sub = rospy.Subscriber( '/rfid/' + self.name + '_reader', RFIDread, self.add_datum)
rospy.logout( 'rfid_recorder: ready' )
def process_datum( self, datum ):
# Hooray for lexical scope (listener)!
ant_lookup = { 'EleLeftEar': '/ear_antenna_left',
'EleRightEar': '/ear_antenna_right' }
ps_ant = PoseStamped()
ps_ant.header.stamp = rospy.Time( 0 )
ps_ant.header.frame_id = ant_lookup[ datum.antenna_name ]
ps_base = PoseStamped()
ps_base.header.stamp = rospy.Time( 0 )
ps_base.header.frame_id = '/base_link'
try:
ps_ant_map = self.listener.transformPose( '/map', ps_ant )
ps_base_map = self.listener.transformPose( '/map', ps_base )
rv = RecorderReads()
rv.read = datum
rv.ps_ant_map = ps_ant_map
rv.ps_base_map = ps_base_map
except:
rospy.logout( 'RFID Recorder: TF failed. Ignoring read.' )
rv = None
return rv
def add_datum( self, datum ):
# Hooray for lexical scope (data)!
pd = self.process_datum( datum )
if pd != None:
self.data.append( pd )
def order_bagfiles( fnames ):
# I'm too lazy to figure out how to reset time and prevent "TF_OLD_DATA" errors / warnings.
# Instead, we're just going to order the bag playback in wall-clock order.
rospy.logout( 'Ordering the bagfiles in increasing order of start time.' )
def gettime( fname ):
# returns the timestamp of the first message
b = rosbag.Bag( fname )
msg = b.read_messages().next()
tt = msg[-1].to_sec()
b.close()
return tt
start_times = [ gettime( f ) for f in fnames ]
rospy.logout( 'Done ordering.' )
return [ fnames[ind] for ind in np.argsort( start_times ) ]
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--fname', action='store', dest='fname',
help='filename', default = '')
opt, args = p.parse_args()
rospy.init_node( 'process_servo_reads' )
ordered_fnames = order_bagfiles( glob.glob(SERVO_FNAMES) )
print 'starting recorder.'
rec = TmpRecorder( serv_name = 'temp_recorder', node_name = 'temp_recorder_py' )
print 'done starting'
for i,fname in enumerate( ordered_fnames ):
rospy.logout( 'Processing [ %d of %d ]: %s' % (i+1, len(ordered_fnames), fname) )
rec.data = []
# Start the new bagplay
bp = pbut.bagplay( fname )
bp.run()
while not bp.is_finished():
print 'Still waiting...'
pbut.sim_safe_sleep( 1.0 ) # Cannot use rostime, since it will stall when bag stops
print 'Done Waiting.'
print 'Saving recorder pickle data.'
util.save_pickle( rec.data, fname.replace('.bag','.pkl') )
| ajibawa-2023/Python-Code-Large/train/row_99425 | 88 | 138 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0072, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0217, 0.0072, 0, 0.66, 0.04, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.029, 0.0072, 0, 0.66, 0.08, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0362, 0.0072, 0, 0.66, 0.12, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0435, 0.0072, 0, 0.66, 0.16, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_demos')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0507, 0.0072, 0, 0.66, 0.2, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.058, 0.0072, 0, 0.66, 0.24, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0652, 0.0072, 0, 0.66, 0.28, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rosbag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L10_C0", "label": "rospy import rospy", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0725, 0.0072, 0, 0.66, 0.32, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L12_C0", "label": "tf import tf", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0072, 0, 0.66, 0.36, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:ImportFrom_L14_C0", "label": "from rfid_behaviors.srv import RecorderSrv, RecorderSrvResponse", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1014, 0.0072, 0, 0.66, 0.4, 647, 0, 2, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["RecorderSrv", "RecorderSrvResponse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import RecorderSrv, RecorderSrvResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:ImportFrom_L15_C0", "label": "from rfid_behaviors.srv import NextBestVantage", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1087, 0.0072, 0, 0.66, 0.44, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["NextBestVantage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import NextBestVantage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:ImportFrom_L16_C0", "label": "from rfid_behaviors.msg import RecorderReads", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1159, 0.0072, 0, 0.66, 0.48, 903, 0, 1, 0, 0, 903, 0, 0], "semantic": {"name": "rfid_behaviors.msg", "arg_names": [], "import_names": ["RecorderReads"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.msg import RecorderReads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L17_C0", "label": "hrl_rfid.ros_M5e_client import rmc", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1232, 0.0072, 0, 0.66, 0.52, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "hrl_rfid.ros_M5e_client", "arg_names": [], "import_names": ["rmc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_rfid.ros_M5e_client as rmc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:ImportFrom_L18_C0", "label": "from geometry_msgs.msg import PoseStamped", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1304, 0.0072, 0, 0.66, 0.56, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:ImportFrom_L19_C0", "label": "from hrl_rfid.msg import RFIDread", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1377, 0.0072, 0, 0.66, 0.6, 328, 0, 1, 0, 0, 328, 0, 0], "semantic": {"name": "hrl_rfid.msg", "arg_names": [], "import_names": ["RFIDread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.msg import RFIDread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:ImportFrom_L20_C0", "label": "from hrl_lib import util", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1449, 0.0072, 0, 0.66, 0.64, 649, 0, 1, 0, 0, 649, 0, 0], "semantic": {"name": "hrl_lib", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_lib import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L22_C0", "label": "process_bags_utils import pbut", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1594, 0.0072, 0, 0.66, 0.68, 709, 0, 1, 0, 0, 709, 0, 0], "semantic": {"name": "process_bags_utils", "arg_names": [], "import_names": ["pbut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import process_bags_utils as pbut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:ImportFrom_L23_C0", "label": "from rfid_behaviors import recorder", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0072, 0, 0.66, 0.72, 746, 0, 1, 0, 0, 746, 0, 0], "semantic": {"name": "rfid_behaviors", "arg_names": [], "import_names": ["recorder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors import recorder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L24_C0", "label": "rosbag import rosbag", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1739, 0.0072, 0, 0.66, 0.76, 243, 0, 1, 0, 0, 243, 0, 0], "semantic": {"name": "rosbag", "arg_names": [], "import_names": ["rosbag"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rosbag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L25_C0", "label": "glob import glob", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1812, 0.0072, 0, 0.66, 0.8, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L26_C0", "label": "numpy import np, math", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.1884, 0.0072, 0, 0.66, 0.84, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np,math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L28_C0", "label": "SERVO_FNAMES =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.2029, 0.0072, 0, 0.66, 0.88, 859, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SERVO_FNAMES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SERVO_FNAMES = 'search_cap/search_aware_home/*_servo.bag'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:ClassDef_L32_C0", "label": "TmpRecorder", "type": "class", "loc": [32, 85], "level": 0, "parent": null, "vector": [3, 0, 0.4239, 0.3913, 0, 0.66, 0.92, 445, 0, 3, 0, 0, 0, 0, 15], "semantic": {"name": "TmpRecorder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TmpRecorder( ):\n def __init__( self, serv_name = 'rfid_recorder', node_name = 'rfid_recorder_py' ):\n rospy.logout( 'rfid_recorder: initializing' )\n try:\n rospy.init_node(node_name)\n except:\n pass\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "label": "__init__", "type": "function", "loc": [33, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:ClassDef_L32_C0", "vector": [2, 1, 0.3152, 0.1594, 1, 0.19, 0.0, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "serv_name", "node_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, serv_name = 'rfid_recorder', node_name = 'rfid_recorder_py' ):\n rospy.logout( 'rfid_recorder: initializing' )\n try:\n rospy.init_node(node_name)\n except:\n pass\n\n self.name = 'ears'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L34_C8", "label": "logout()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "vector": [8, 2, 0.2464, 0.0072, 2, 0.5, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rfid_recorder: initializing' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L35_C8", "label": "try", "type": "try", "loc": [35, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "vector": [7, 2, 0.2645, 0.029, 2, 0.5, 0.1429, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node(node_name)\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L36_C12", "label": "init_node()", "type": "expression", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L35_C8", "vector": [8, 3, 0.2609, 0.0072, 3, 0.11, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node(node_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L40_C8", "label": "self.name =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "vector": [14, 2, 0.2899, 0.0072, 2, 0.5, 0.2857, 689, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = 'ears'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L42_C8", "label": "self.should_rec =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "vector": [14, 2, 0.3043, 0.0072, 2, 0.5, 0.4286, 911, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_rec", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_rec = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L44_C8", "label": "self.listener = TransformListener()", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "vector": [14, 2, 0.3188, 0.0072, 2, 0.5, 0.5714, 686, 3, 0, 0, 0, 108, 10, 1], "semantic": {"name": "self.listener", "arg_names": [], "import_names": [], "rhs_call_name": "TransformListener", "annotation": ""}, "snippet": " self.listener = tf.TransformListener()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L51_C8", "label": "self.data =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "vector": [14, 2, 0.3696, 0.0072, 2, 0.5, 0.7143, 838, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L52_C8", "label": "self._sub = Subscriber()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "vector": [14, 2, 0.3768, 0.0072, 2, 0.5, 0.8571, 531, 3, 3, 0, 0, 455, 10, 1], "semantic": {"name": "self._sub", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " self._sub = rospy.Subscriber( '/rfid/' + self.name + '_reader', RFIDread, self.add_datum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L54_C8", "label": "logout()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "vector": [8, 2, 0.3913, 0.0072, 2, 0.5, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rfid_recorder: ready' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "label": "process_datum", "type": "function", "loc": [56, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:ClassDef_L32_C0", "vector": [2, 1, 0.4891, 0.1739, 1, 0.19, 0.5, 595, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "process_datum", "arg_names": ["self", "datum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_datum( self, datum ):\n # Hooray for lexical scope (listener)!\n ant_lookup = { 'EleLeftEar': '/ear_antenna_left',\n 'EleRightEar': '/ear_antenna_right' }\n\n ps_ant = PoseStamped()\n ps_ant.header.stamp = rospy.Time( 0 )\n ps_ant.header.frame_id = ant_lookup[ datum.antenna_name ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L58_C8", "label": "ant_lookup =", "type": "assigned_variable", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [14, 2, 0.4239, 0.0145, 2, 0.97, 0.0, 120, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ant_lookup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ant_lookup = { 'EleLeftEar': '/ear_antenna_left',\n 'EleRightEar': '/ear_antenna_right' }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L61_C8", "label": "ps_ant = PoseStamped()", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [14, 2, 0.442, 0.0072, 2, 0.97, 0.125, 903, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "ps_ant", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " ps_ant = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L62_C8", "label": "ps_ant.header.stamp = Time()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [14, 2, 0.4493, 0.0072, 2, 0.97, 0.25, 616, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "ps_ant.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " ps_ant.header.stamp = rospy.Time( 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L63_C8", "label": "ps_ant.header.frame_id =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [14, 2, 0.4565, 0.0072, 2, 0.97, 0.375, 786, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps_ant.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps_ant.header.frame_id = ant_lookup[ datum.antenna_name ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L65_C8", "label": "ps_base = PoseStamped()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [14, 2, 0.471, 0.0072, 2, 0.97, 0.5, 802, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "ps_base", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " ps_base = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L66_C8", "label": "ps_base.header.stamp = Time()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [14, 2, 0.4783, 0.0072, 2, 0.97, 0.625, 800, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "ps_base.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " ps_base.header.stamp = rospy.Time( 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L67_C8", "label": "ps_base.header.frame_id =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [14, 2, 0.4855, 0.0072, 2, 0.97, 0.75, 445, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ps_base.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps_base.header.frame_id = '/base_link'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "label": "try", "type": "try", "loc": [69, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [7, 2, 0.5326, 0.0725, 2, 0.97, 0.875, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n ps_ant_map = self.listener.transformPose( '/map', ps_ant )\n ps_base_map = self.listener.transformPose( '/map', ps_base )\n rv = RecorderReads()\n rv.read = datum\n rv.ps_ant_map = ps_ant_map\n rv.ps_base_map = ps_base_map \n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L70_C12", "label": "ps_ant_map = transformPose()", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "vector": [14, 3, 0.5072, 0.0072, 3, 0.78, 0.0, 222, 3, 2, 0, 0, 654, 10, 1], "semantic": {"name": "ps_ant_map", "arg_names": [], "import_names": [], "rhs_call_name": "transformPose", "annotation": ""}, "snippet": " ps_ant_map = self.listener.transformPose( '/map', ps_ant )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L71_C12", "label": "ps_base_map = transformPose()", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "vector": [14, 3, 0.5145, 0.0072, 3, 0.78, 0.2, 679, 3, 2, 0, 0, 654, 10, 1], "semantic": {"name": "ps_base_map", "arg_names": [], "import_names": [], "rhs_call_name": "transformPose", "annotation": ""}, "snippet": " ps_base_map = self.listener.transformPose( '/map', ps_base )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L72_C12", "label": "rv = RecorderReads()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "vector": [14, 3, 0.5217, 0.0072, 3, 0.78, 0.4, 222, 3, 0, 0, 0, 522, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "RecorderReads", "annotation": ""}, "snippet": " rv = RecorderReads()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L73_C12", "label": "rv.read =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "vector": [14, 3, 0.529, 0.0072, 3, 0.78, 0.6, 846, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.read = datum"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L74_C12", "label": "rv.ps_ant_map =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "vector": [14, 3, 0.5362, 0.0072, 3, 0.78, 0.8, 306, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.ps_ant_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.ps_ant_map = ps_ant_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L75_C12", "label": "rv.ps_base_map =", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "vector": [14, 3, 0.5435, 0.0072, 3, 0.78, 1.0, 369, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.ps_base_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.ps_base_map = ps_base_map "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L77_C12", "label": "logout()", "type": "expression", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "vector": [8, 3, 0.558, 0.0072, 3, 0.78, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'RFID Recorder: TF failed. Ignoring read.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L78_C12", "label": "rv =", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "vector": [14, 3, 0.5652, 0.0072, 3, 0.78, 1.0, 222, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Return_L79_C8", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "vector": [13, 2, 0.5725, 0.0072, 2, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L81_C4", "label": "add_datum", "type": "function", "loc": [81, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:ClassDef_L32_C0", "vector": [2, 1, 0.6014, 0.0362, 1, 0.19, 1.0, 258, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "add_datum", "arg_names": ["self", "datum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_datum( self, datum ):\n # Hooray for lexical scope (data)!\n pd = self.process_datum( datum )\n if pd != None:\n self.data.append( pd )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L83_C8", "label": "pd = process_datum()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L81_C4", "vector": [14, 2, 0.6014, 0.0072, 2, 0.72, 0.0, 51, 3, 1, 0, 0, 595, 10, 1], "semantic": {"name": "pd", "arg_names": [], "import_names": [], "rhs_call_name": "process_datum", "annotation": ""}, "snippet": " pd = self.process_datum( datum )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L84_C8", "label": "if", "type": "if", "loc": [84, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L81_C4", "vector": [4, 2, 0.6123, 0.0145, 2, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pd != None:\n self.data.append( pd )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L85_C12", "label": "append()", "type": "expression", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L84_C8", "vector": [8, 3, 0.6159, 0.0072, 3, 0.91, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.data.append( pd )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "label": "order_bagfiles", "type": "function", "loc": [89, 104], "level": 0, "parent": null, "vector": [2, 0, 0.6993, 0.1159, 0, 0.66, 0.96, 429, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "order_bagfiles", "arg_names": ["fnames"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def order_bagfiles( fnames ):\n # I'm too lazy to figure out how to reset time and prevent \"TF_OLD_DATA\" errors / warnings.\n # Instead, we're just going to order the bag playback in wall-clock order.\n\n rospy.logout( 'Ordering the bagfiles in increasing order of start time.' )\n def gettime( fname ):\n # returns the timestamp of the first message\n b = rosbag.Bag( fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L93_C4", "label": "logout()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "vector": [8, 1, 0.6739, 0.0072, 1, 0.99, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Ordering the bagfiles in increasing order of start time.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "label": "gettime", "type": "function", "loc": [94, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "vector": [2, 1, 0.7029, 0.0507, 1, 0.99, 0.25, 526, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "gettime", "arg_names": ["fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def gettime( fname ):\n # returns the timestamp of the first message\n b = rosbag.Bag( fname )\n msg = b.read_messages().next()\n tt = msg[-1].to_sec()\n b.close()\n return tt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L96_C8", "label": "b = Bag()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "vector": [14, 2, 0.6957, 0.0072, 2, 0.04, 0.0, 756, 3, 1, 0, 0, 568, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " b = rosbag.Bag( fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L97_C8", "label": "msg = next()", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "vector": [14, 2, 0.7029, 0.0072, 2, 0.04, 0.25, 712, 3, 0, 0, 0, 11, 10, 2], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "next", "annotation": ""}, "snippet": " msg = b.read_messages().next()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L98_C8", "label": "tt = to_sec()", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "vector": [14, 2, 0.7101, 0.0072, 2, 0.04, 0.5, 266, 3, 0, 0, 0, 750, 10, 1], "semantic": {"name": "tt", "arg_names": [], "import_names": [], "rhs_call_name": "to_sec", "annotation": ""}, "snippet": " tt = msg[-1].to_sec()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L99_C8", "label": "close()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "vector": [8, 2, 0.7174, 0.0072, 2, 0.04, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " b.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Return_L100_C8", "label": "return", "type": "return", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "vector": [13, 2, 0.7246, 0.0072, 2, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L102_C4", "label": "start_times =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "vector": [14, 1, 0.7391, 0.0072, 1, 0.99, 0.5, 800, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start_times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start_times = [ gettime( f ) for f in fnames ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L103_C4", "label": "logout()", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "vector": [8, 1, 0.7464, 0.0072, 1, 0.99, 0.75, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Done ordering.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Return_L104_C4", "label": "return", "type": "return", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "vector": [13, 1, 0.7536, 0.0072, 1, 0.99, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [ fnames[ind] for ind in np.argsort( start_times ) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "label": "if", "type": "if", "loc": [107, 138], "level": 0, "parent": null, "vector": [4, 0, 0.8877, 0.2319, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--fname', action='store', dest='fname',\n help='filename', default = '')\n opt, args = p.parse_args()\n\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L108_C4", "label": "optparse import optparse", "type": "import", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [1, 1, 0.7826, 0.0072, 1, 0.1, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L109_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [14, 1, 0.7899, 0.0072, 1, 0.1, 0.1111, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L110_C4", "label": "add_option()", "type": "expression", "loc": [110, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [8, 1, 0.8007, 0.0145, 1, 0.1, 0.2222, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--fname', action='store', dest='fname',\n help='filename', default = '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L112_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [14, 1, 0.8116, 0.0072, 1, 0.1, 0.3333, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L115_C4", "label": "init_node()", "type": "expression", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [8, 1, 0.8333, 0.0072, 1, 0.1, 0.4444, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'process_servo_reads' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L117_C4", "label": "ordered_fnames = order_bagfiles()", "type": "assigned_variable", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [14, 1, 0.8478, 0.0072, 1, 0.1, 0.5556, 194, 3, 1, 0, 0, 429, 10, 2], "semantic": {"name": "ordered_fnames", "arg_names": [], "import_names": [], "rhs_call_name": "order_bagfiles", "annotation": ""}, "snippet": " ordered_fnames = order_bagfiles( glob.glob(SERVO_FNAMES) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L119_C4", "label": "print()", "type": "expression", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [8, 1, 0.8623, 0.0072, 1, 0.1, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('starting recorder.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L120_C4", "label": "rec = TmpRecorder()", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [14, 1, 0.8696, 0.0072, 1, 0.1, 0.7778, 100, 3, 2, 0, 0, 445, 10, 1], "semantic": {"name": "rec", "arg_names": [], "import_names": [], "rhs_call_name": "TmpRecorder", "annotation": ""}, "snippet": " rec = TmpRecorder( serv_name = 'temp_recorder', node_name = 'temp_recorder_py' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L121_C4", "label": "print()", "type": "expression", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [8, 1, 0.8768, 0.0072, 1, 0.1, 0.8889, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('done starting')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "label": "for i, fname", "type": "for", "loc": [123, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "vector": [6, 1, 0.9457, 0.1159, 1, 0.1, 1.0, 641, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "i, fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i,fname in enumerate( ordered_fnames ):\n rospy.logout( 'Processing [ %d of %d ]: %s' % (i+1, len(ordered_fnames), fname) )\n\n rec.data = []\n\n # Start the new bagplay\n bp = pbut.bagplay( fname )\n bp.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L124_C8", "label": "logout()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "vector": [8, 2, 0.8986, 0.0072, 2, 0.86, 0.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Processing [ %d of %d ]: %s' % (i+1, len(ordered_fnames), fname) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L126_C8", "label": "rec.data =", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "vector": [14, 2, 0.913, 0.0072, 2, 0.86, 0.1429, 800, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rec.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rec.data = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L129_C8", "label": "bp = bagplay()", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "vector": [14, 2, 0.9348, 0.0072, 2, 0.86, 0.2857, 226, 3, 1, 0, 0, 603, 10, 1], "semantic": {"name": "bp", "arg_names": [], "import_names": [], "rhs_call_name": "bagplay", "annotation": ""}, "snippet": " bp = pbut.bagplay( fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L130_C8", "label": "run()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "vector": [8, 2, 0.942, 0.0072, 2, 0.86, 0.4286, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " bp.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:While_L132_C8", "label": "while", "type": "while", "loc": [132, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "vector": [5, 2, 0.9638, 0.0217, 2, 0.86, 0.5714, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not bp.is_finished():\n print('Still waiting...')\n pbut.sim_safe_sleep( 1.0 ) # Cannot use rostime, since it will stall when bag stops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L133_C12", "label": "print()", "type": "expression", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:While_L132_C8", "vector": [8, 3, 0.9638, 0.0072, 3, 0.74, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Still waiting...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L134_C12", "label": "sim_safe_sleep()", "type": "expression", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:While_L132_C8", "vector": [8, 3, 0.971, 0.0072, 3, 0.74, 1.0, 35, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sim_safe_sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sim_safe_sleep", "annotation": ""}, "snippet": " pbut.sim_safe_sleep( 1.0 ) # Cannot use rostime, since it will stall when bag stops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L135_C8", "label": "print()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "vector": [8, 2, 0.9783, 0.0072, 2, 0.86, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done Waiting.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L137_C8", "label": "print()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "vector": [8, 2, 0.9928, 0.0072, 2, 0.86, 0.8571, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Saving recorder pickle data.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L138_C8", "label": "save_pickle()", "type": "expression", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "vector": [8, 2, 1.0, 0.0072, 2, 0.86, 1.0, 390, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "save_pickle", "arg_names": [], "import_names": [], "rhs_call_name": "save_pickle", "annotation": ""}, "snippet": " util.save_pickle( rec.data, fname.replace('.bag','.pkl') )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99425:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:Try_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Return_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L84_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Return_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Return_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Import_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:While_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:While_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:While_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99425:For_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99425:Expr_L138_C8"}] |
#!/usr/bin/python
# Basically a giant script.
import roslib
roslib.load_manifest( 'geometry_msgs' ) # the pickle files containe Point and Pose Stamped.
roslib.load_manifest( 'sensor_msgs' )
import rospy
from geometry_msgs.msg import PointStamped, PoseStamped
from sensor_msgs.msg import PointCloud
import sys
import glob
import yaml
import time
import optparse
import cPickle as pkl
import numpy as np, math
import pylab as pl
import friis
import point_cloud_utils as pcu
PLOT = False
# glob_files: '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/datacap/*.pkl'
# filters:
# antennas:
# PR2_Head: '/head_rfid'
# tags:
# 'datacap ':
if __name__ == '__main__':
p = optparse.OptionParser()
p.add_option('--yaml', action='store', type='string', dest='yaml', default='',
help='yaml file that describes this run.')
p.add_option('--plot', action='store_true', dest='plot',
help='Pop-up the resulting plot')
opt, args = p.parse_args()
yaml_fname = opt.yaml
PLOT = opt.plot
else:
yaml_fname = ''
# SCRIPT:
if not yaml_fname:
print 'YAML file required!'
exit()
else:
f = open( yaml_fname )
yaml_config = yaml.load( f )
f.close()
def add_files( d, arg ):
fname, fcount = arg
print 'Loading (%d of %d): %s' % (fcount, len(fnames), fname)
f = open( fname, 'r' )
d_new = pkl.load( f )
f.close()
for k in d_new.keys():
if not d.has_key( k ):
d[k] = []
d[k] += d_new[k]
return d
def base_map_xy( reading ):
# Model estimate of P^inc_tag.
# r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading
d_rdr = reading[0]
d_tag = reading[1]
read = reading[2]
d_rot = reading[3]
ps = reading[4]
tag_map, rdr_map, rot_map, base_map = ps
return [ base_map.pose.position.x, base_map.pose.position.y ]
fnames = reduce( lambda x,y: x+y, [ glob.glob(i) for i in yaml_config['glob_files'] ], [] )
def pos_finish( reads_list ):
d_rdr = reads_list[-1][0]
d_tag = reads_list[-1][1]
read = reads_list[-1][2]
d_rot = reads_list[-1][3]
ps = reads_list[-1][4]
base_map = ps[3]
bmx = base_map.pose.position.x
bmy = base_map.pose.position.y
if bmx < 7+2 and bmx > 7-2 and bmy > 3-2 and bmy < 3+2:
rv = True
else:
rv = False
return rv
if len(glob.glob(yaml_config['use_combined'])) > 0:
print 'Loading pickle: %s' % (yaml_config['use_combined'])
f = open( yaml_config['use_combined'], 'r' )
data = pkl.load( f )
f.close()
print 'Done.'
else:
f = open( yaml_config['use_combined'], 'w' )
#d = reduce( add_files, zip(fnames,range(len(fnames))), {} )
data = []
# Apply Filters:
for i,fname in enumerate( fnames ):
print 'Loading (%d of %d): %s' % (i, len(fnames), fname)
f = open( fname, 'r' )
d_new = pkl.load( f )
f.close()
for k in d_new.keys():
if dict.fromkeys(yaml_config['filters']['tags']).has_key( k ):
data += [ base_map_xy(r) + [ r[2][0], pos_finish( d_new[k] )] for r in d_new[k] ]
data = np.array( data ).T # 4xN: x,y,rssi,positive finish
print 'Dumping data into combined pickle file: %s ' % (yaml_config['use_combined'])
f = open( yaml_config['use_combined'], 'w' )
pkl.dump( data, f, -1 )
f.close()
print 'Done. Re-run.'
exit()
# data will be 4xN => x, y, RSSI, positive finish (bool)
# Calculate Useful Values
xy = data[0:2,:]
xyz = np.row_stack([ xy, np.zeros( xy.shape[1] )])
rssi = data[2]
pos_read = data[3]
pp = pcu.np_points_to_ros( np.matrix(xyz[:,np.where(pos_read > 0.5)[0]]) )
pp.header.frame_id = '/map'
pn = pcu.np_points_to_ros( np.matrix(xyz[:,np.where(pos_read < 0.5)[0]]) )
pn.header.frame_id = '/map'
rospy.init_node( 'traj_pub_node' )
time.sleep( 0.3 )
print 'PUBLISHING'
pubp = rospy.Publisher( 'traj_pub_pos', PointCloud )
pubn = rospy.Publisher( 'traj_pub_neg', PointCloud )
while not rospy.is_shutdown():
pp.header.stamp = rospy.Time.now()
pn.header.stamp = rospy.Time.now()
pubp.publish( pp )
pubn.publish( pn )
rospy.sleep( 0.5 )
| ajibawa-2023/Python-Code-Large/train/row_99426 | 104 | 168 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L5_C0", "label": "roslib import roslib", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0298, 0.006, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0357, 0.006, 0, 0.66, 0.027, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'geometry_msgs' ) # the pickle files containe Point and Pose Stamped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.006, 0, 0.66, 0.0541, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'sensor_msgs' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L8_C0", "label": "rospy import rospy", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.006, 0, 0.66, 0.0811, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:ImportFrom_L10_C0", "label": "from geometry_msgs.msg import PointStamped, PoseStamped", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0595, 0.006, 0, 0.66, 0.1081, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PointStamped", "PoseStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PointStamped, PoseStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:ImportFrom_L11_C0", "label": "from sensor_msgs.msg import PointCloud", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0655, 0.006, 0, 0.66, 0.1351, 531, 0, 1, 0, 0, 531, 0, 0], "semantic": {"name": "sensor_msgs.msg", "arg_names": [], "import_names": ["PointCloud"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sensor_msgs.msg import PointCloud"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L14_C0", "label": "sys import sys", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.006, 0, 0.66, 0.1622, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L15_C0", "label": "glob import glob", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0893, 0.006, 0, 0.66, 0.1892, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L16_C0", "label": "yaml import yaml", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.006, 0, 0.66, 0.2162, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L17_C0", "label": "time import time", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1012, 0.006, 0, 0.66, 0.2432, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L18_C0", "label": "optparse import optparse", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1071, 0.006, 0, 0.66, 0.2703, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L19_C0", "label": "cPickle import pkl", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1131, 0.006, 0, 0.66, 0.2973, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L20_C0", "label": "numpy import np, math", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.119, 0.006, 0, 0.66, 0.3243, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L21_C0", "label": "pylab import pl", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.006, 0, 0.66, 0.3514, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L23_C0", "label": "friis import friis", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1369, 0.006, 0, 0.66, 0.3784, 769, 0, 1, 0, 0, 769, 0, 0], "semantic": {"name": "friis", "arg_names": [], "import_names": ["friis"], "rhs_call_name": "", "annotation": ""}, "snippet": "import friis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Import_L24_C0", "label": "point_cloud_utils import pcu", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.006, 0, 0.66, 0.4054, 539, 0, 1, 0, 0, 539, 0, 0], "semantic": {"name": "point_cloud_utils", "arg_names": [], "import_names": ["pcu"], "rhs_call_name": "", "annotation": ""}, "snippet": "import point_cloud_utils as pcu"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L26_C0", "label": "PLOT =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.1548, 0.006, 0, 0.66, 0.4324, 614, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "PLOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PLOT = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "label": "if", "type": "if", "loc": [35, 46], "level": 0, "parent": null, "vector": [4, 0, 0.2411, 0.0714, 0, 0.66, 0.4595, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n p = optparse.OptionParser()\n p.add_option('--yaml', action='store', type='string', dest='yaml', default='',\n help='yaml file that describes this run.')\n p.add_option('--plot', action='store_true', dest='plot',\n help='Pop-up the resulting plot')\n opt, args = p.parse_args()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L36_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "vector": [14, 1, 0.2143, 0.006, 1, 0.32, 0.0, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L37_C4", "label": "add_option()", "type": "expression", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "vector": [8, 1, 0.2232, 0.0119, 1, 0.32, 0.1667, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--yaml', action='store', type='string', dest='yaml', default='',\n help='yaml file that describes this run.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L39_C4", "label": "add_option()", "type": "expression", "loc": [39, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "vector": [8, 1, 0.2351, 0.0119, 1, 0.32, 0.3333, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--plot', action='store_true', dest='plot',\n help='Pop-up the resulting plot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L41_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "vector": [14, 1, 0.244, 0.006, 1, 0.32, 0.5, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L43_C4", "label": "yaml_fname =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "vector": [14, 1, 0.256, 0.006, 1, 0.32, 0.6667, 590, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yaml_fname = opt.yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L44_C4", "label": "PLOT =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "vector": [14, 1, 0.2619, 0.006, 1, 0.32, 0.8333, 614, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "PLOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PLOT = opt.plot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L46_C4", "label": "yaml_fname =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "vector": [14, 1, 0.2738, 0.006, 1, 0.32, 1.0, 590, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yaml_fname = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "label": "if", "type": "if", "loc": [52, 58], "level": 0, "parent": null, "vector": [4, 0, 0.3274, 0.0417, 0, 0.66, 0.4865, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not yaml_fname:\n print('YAML file required!')\n exit()\nelse:\n f = open( yaml_fname )\n yaml_config = yaml.load( f )\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L53_C4", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "vector": [8, 1, 0.3155, 0.006, 1, 0.41, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('YAML file required!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L54_C4", "label": "exit()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "vector": [8, 1, 0.3214, 0.006, 1, 0.41, 0.25, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L56_C4", "label": "f = open()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "vector": [14, 1, 0.3333, 0.006, 1, 0.41, 0.5, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L57_C4", "label": "yaml_config = load()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "vector": [14, 1, 0.3393, 0.006, 1, 0.41, 0.75, 248, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "yaml_config", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " yaml_config = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L58_C4", "label": "close()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "vector": [8, 1, 0.3452, 0.006, 1, 0.41, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "label": "add_files", "type": "function", "loc": [60, 72], "level": 0, "parent": null, "vector": [2, 0, 0.3929, 0.0774, 0, 0.66, 0.5135, 46, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "add_files", "arg_names": ["d", "arg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def add_files( d, arg ):\n fname, fcount = arg\n print('Loading (%d of %d): %s' % (fcount, len(fnames), fname))\n f = open( fname, 'r' )\n d_new = pkl.load( f )\n f.close()\n\n for k in d_new.keys():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L61_C4", "label": "fname, fcount =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "vector": [14, 1, 0.3631, 0.006, 1, 0.42, 0.0, 111, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname, fcount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname, fcount = arg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L62_C4", "label": "print()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "vector": [8, 1, 0.369, 0.006, 1, 0.42, 0.1667, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading (%d of %d): %s' % (fcount, len(fnames), fname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L63_C4", "label": "f = open()", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "vector": [14, 1, 0.375, 0.006, 1, 0.42, 0.3333, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L64_C4", "label": "d_new = load()", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "vector": [14, 1, 0.381, 0.006, 1, 0.42, 0.5, 388, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "d_new", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " d_new = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L65_C4", "label": "close()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "vector": [8, 1, 0.3869, 0.006, 1, 0.42, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L67_C4", "label": "for k", "type": "for", "loc": [67, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "vector": [6, 1, 0.4077, 0.0238, 1, 0.42, 0.8333, 954, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in d_new.keys():\n if not d.has_key( k ):\n d[k] = []\n d[k] += d_new[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L68_C8", "label": "if", "type": "if", "loc": [68, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L67_C4", "vector": [4, 2, 0.4077, 0.0119, 2, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not d.has_key( k ):\n d[k] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L69_C12", "label": "assign", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L68_C8", "vector": [14, 3, 0.4107, 0.006, 3, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[k] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Return_L72_C4", "label": "return", "type": "return", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "vector": [13, 1, 0.4286, 0.006, 1, 0.42, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "label": "base_map_xy", "type": "function", "loc": [74, 84], "level": 0, "parent": null, "vector": [2, 0, 0.4702, 0.0655, 0, 0.66, 0.5405, 984, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "base_map_xy", "arg_names": ["reading"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def base_map_xy( reading ):\n # Model estimate of P^inc_tag.\n # r_rdr, theta_rdr, phi_rdr, r_tag, theta_tag, phi_tag, rssi, antname, tagid = reading\n d_rdr = reading[0]\n d_tag = reading[1]\n read = reading[2]\n d_rot = reading[3]\n ps = reading[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L77_C4", "label": "d_rdr =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "vector": [14, 1, 0.4583, 0.006, 1, 0.98, 0.0, 836, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rdr = reading[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L78_C4", "label": "d_tag =", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "vector": [14, 1, 0.4643, 0.006, 1, 0.98, 0.1667, 632, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_tag = reading[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L79_C4", "label": "read =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "vector": [14, 1, 0.4702, 0.006, 1, 0.98, 0.3333, 453, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " read = reading[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L80_C4", "label": "d_rot =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "vector": [14, 1, 0.4762, 0.006, 1, 0.98, 0.5, 134, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rot = reading[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L81_C4", "label": "ps =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "vector": [14, 1, 0.4821, 0.006, 1, 0.98, 0.6667, 232, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps = reading[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L83_C4", "label": "tag_map, rdr_map, rot_map, base_map =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "vector": [14, 1, 0.494, 0.006, 1, 0.98, 0.8333, 892, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tag_map, rdr_map, rot_map, base_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag_map, rdr_map, rot_map, base_map = ps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Return_L84_C4", "label": "return", "type": "return", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "vector": [13, 1, 0.5, 0.006, 1, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [ base_map.pose.position.x, base_map.pose.position.y ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L87_C0", "label": "fnames = reduce()", "type": "assigned_variable", "loc": [87, 87], "level": 0, "parent": null, "vector": [14, 0, 0.5179, 0.006, 0, 0.66, 0.5676, 641, 3, 3, 0, 0, 622, 10, 2], "semantic": {"name": "fnames", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": "fnames = reduce( lambda x,y: x+y, [ glob.glob(i) for i in yaml_config['glob_files'] ], [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "label": "pos_finish", "type": "function", "loc": [89, 104], "level": 0, "parent": null, "vector": [2, 0, 0.5744, 0.0952, 0, 0.66, 0.5946, 628, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "pos_finish", "arg_names": ["reads_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pos_finish( reads_list ):\n d_rdr = reads_list[-1][0]\n d_tag = reads_list[-1][1]\n read = reads_list[-1][2]\n d_rot = reads_list[-1][3]\n ps = reads_list[-1][4]\n\n base_map = ps[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L90_C4", "label": "d_rdr =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [14, 1, 0.5357, 0.006, 1, 0.13, 0.0, 836, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rdr = reads_list[-1][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L91_C4", "label": "d_tag =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [14, 1, 0.5417, 0.006, 1, 0.13, 0.1111, 632, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_tag = reads_list[-1][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L92_C4", "label": "read =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [14, 1, 0.5476, 0.006, 1, 0.13, 0.2222, 453, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " read = reads_list[-1][2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L93_C4", "label": "d_rot =", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [14, 1, 0.5536, 0.006, 1, 0.13, 0.3333, 134, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d_rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d_rot = reads_list[-1][3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L94_C4", "label": "ps =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [14, 1, 0.5595, 0.006, 1, 0.13, 0.4444, 232, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps = reads_list[-1][4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L96_C4", "label": "base_map =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [14, 1, 0.5714, 0.006, 1, 0.13, 0.5556, 901, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "base_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " base_map = ps[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L97_C4", "label": "bmx =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [14, 1, 0.5774, 0.006, 1, 0.13, 0.6667, 144, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bmx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bmx = base_map.pose.position.x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L98_C4", "label": "bmy =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [14, 1, 0.5833, 0.006, 1, 0.13, 0.7778, 230, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bmy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bmy = base_map.pose.position.y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L100_C4", "label": "if", "type": "if", "loc": [100, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [4, 1, 0.6042, 0.0238, 1, 0.13, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bmx < 7+2 and bmx > 7-2 and bmy > 3-2 and bmy < 3+2:\n rv = True\n else:\n rv = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L101_C8", "label": "rv =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L100_C4", "vector": [14, 2, 0.6012, 0.006, 2, 0.01, 0.0, 222, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L103_C8", "label": "rv =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L100_C4", "vector": [14, 2, 0.6131, 0.006, 2, 0.01, 1.0, 222, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Return_L104_C4", "label": "return", "type": "return", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "vector": [13, 1, 0.619, 0.006, 1, 0.13, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "label": "if", "type": "if", "loc": [106, 136], "level": 0, "parent": null, "vector": [4, 0, 0.7202, 0.1845, 0, 0.66, 0.6216, 0, 0, 0, 0, 0, 0, 0, 26], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if len(glob.glob(yaml_config['use_combined'])) > 0:\n print('Loading pickle: %s' % (yaml_config['use_combined']))\n f = open( yaml_config['use_combined'], 'r' )\n data = pkl.load( f )\n f.close()\n print('Done.')\nelse:\n f = open( yaml_config['use_combined'], 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L107_C4", "label": "print()", "type": "expression", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [8, 1, 0.6369, 0.006, 1, 0.11, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading pickle: %s' % (yaml_config['use_combined']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L108_C4", "label": "f = open()", "type": "assigned_variable", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [14, 1, 0.6429, 0.006, 1, 0.11, 0.0714, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_config['use_combined'], 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L109_C4", "label": "data = load()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [14, 1, 0.6488, 0.006, 1, 0.11, 0.1429, 929, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " data = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L110_C4", "label": "close()", "type": "expression", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [8, 1, 0.6548, 0.006, 1, 0.11, 0.2143, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L111_C4", "label": "print()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [8, 1, 0.6607, 0.006, 1, 0.11, 0.2857, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L113_C4", "label": "f = open()", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [14, 1, 0.6726, 0.006, 1, 0.11, 0.3571, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_config['use_combined'], 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L116_C4", "label": "data =", "type": "assigned_variable", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [14, 1, 0.6905, 0.006, 1, 0.11, 0.4286, 929, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "label": "for i, fname", "type": "for", "loc": [118, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [6, 1, 0.7262, 0.0536, 1, 0.11, 0.5, 641, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "i, fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i,fname in enumerate( fnames ):\n print('Loading (%d of %d): %s' % (i, len(fnames), fname))\n f = open( fname, 'r' )\n d_new = pkl.load( f )\n f.close()\n\n for k in d_new.keys():\n if dict.fromkeys(yaml_config['filters']['tags']).has_key( k ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L119_C8", "label": "print()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "vector": [8, 2, 0.7083, 0.006, 2, 0.11, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading (%d of %d): %s' % (i, len(fnames), fname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L120_C8", "label": "f = open()", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "vector": [14, 2, 0.7143, 0.006, 2, 0.11, 0.25, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L121_C8", "label": "d_new = load()", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "vector": [14, 2, 0.7202, 0.006, 2, 0.11, 0.5, 388, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "d_new", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " d_new = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L122_C8", "label": "close()", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "vector": [8, 2, 0.7262, 0.006, 2, 0.11, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L124_C8", "label": "for k", "type": "for", "loc": [124, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "vector": [6, 2, 0.744, 0.0179, 2, 0.11, 1.0, 954, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in d_new.keys():\n if dict.fromkeys(yaml_config['filters']['tags']).has_key( k ):\n data += [ base_map_xy(r) + [ r[2][0], pos_finish( d_new[k] )] for r in d_new[k] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L125_C12", "label": "if", "type": "if", "loc": [125, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L124_C8", "vector": [4, 3, 0.747, 0.0119, 3, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dict.fromkeys(yaml_config['filters']['tags']).has_key( k ):\n data += [ base_map_xy(r) + [ r[2][0], pos_finish( d_new[k] )] for r in d_new[k] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L128_C4", "label": "data =", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [14, 1, 0.7619, 0.006, 1, 0.11, 0.5714, 929, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = np.array( data ).T # 4xN: x,y,rssi,positive finish"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L130_C4", "label": "print()", "type": "expression", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [8, 1, 0.7738, 0.006, 1, 0.11, 0.6429, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Dumping data into combined pickle file: %s ' % (yaml_config['use_combined']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L131_C4", "label": "f = open()", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [14, 1, 0.7798, 0.006, 1, 0.11, 0.7143, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_config['use_combined'], 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L132_C4", "label": "dump()", "type": "expression", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [8, 1, 0.7857, 0.006, 1, 0.11, 0.7857, 952, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pkl.dump( data, f, -1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L133_C4", "label": "close()", "type": "expression", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [8, 1, 0.7917, 0.006, 1, 0.11, 0.8571, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L135_C4", "label": "print()", "type": "expression", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [8, 1, 0.8036, 0.006, 1, 0.11, 0.9286, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done. Re-run.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L136_C4", "label": "exit()", "type": "expression", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "vector": [8, 1, 0.8095, 0.006, 1, 0.11, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L143_C0", "label": "xy =", "type": "assigned_variable", "loc": [143, 143], "level": 0, "parent": null, "vector": [14, 0, 0.8512, 0.006, 0, 0.66, 0.6486, 358, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "xy = data[0:2,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L144_C0", "label": "xyz = row_stack()", "type": "assigned_variable", "loc": [144, 144], "level": 0, "parent": null, "vector": [14, 0, 0.8571, 0.006, 0, 0.66, 0.6757, 164, 3, 1, 0, 0, 612, 10, 2], "semantic": {"name": "xyz", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": "xyz = np.row_stack([ xy, np.zeros( xy.shape[1] )])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L145_C0", "label": "rssi =", "type": "assigned_variable", "loc": [145, 145], "level": 0, "parent": null, "vector": [14, 0, 0.8631, 0.006, 0, 0.66, 0.7027, 906, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "rssi = data[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L146_C0", "label": "pos_read =", "type": "assigned_variable", "loc": [146, 146], "level": 0, "parent": null, "vector": [14, 0, 0.869, 0.006, 0, 0.66, 0.7297, 346, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pos_read = data[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L148_C0", "label": "pp = np_points_to_ros()", "type": "assigned_variable", "loc": [148, 148], "level": 0, "parent": null, "vector": [14, 0, 0.881, 0.006, 0, 0.66, 0.7568, 632, 3, 1, 0, 0, 955, 10, 3], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "np_points_to_ros", "annotation": ""}, "snippet": "pp = pcu.np_points_to_ros( np.matrix(xyz[:,np.where(pos_read > 0.5)[0]]) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L149_C0", "label": "pp.header.frame_id =", "type": "assigned_variable", "loc": [149, 149], "level": 0, "parent": null, "vector": [14, 0, 0.8869, 0.006, 0, 0.66, 0.7838, 451, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pp.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pp.header.frame_id = '/map'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L151_C0", "label": "pn = np_points_to_ros()", "type": "assigned_variable", "loc": [151, 151], "level": 0, "parent": null, "vector": [14, 0, 0.8988, 0.006, 0, 0.66, 0.8108, 878, 3, 1, 0, 0, 955, 10, 3], "semantic": {"name": "pn", "arg_names": [], "import_names": [], "rhs_call_name": "np_points_to_ros", "annotation": ""}, "snippet": "pn = pcu.np_points_to_ros( np.matrix(xyz[:,np.where(pos_read < 0.5)[0]]) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L152_C0", "label": "pn.header.frame_id =", "type": "assigned_variable", "loc": [152, 152], "level": 0, "parent": null, "vector": [14, 0, 0.9048, 0.006, 0, 0.66, 0.8378, 937, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pn.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pn.header.frame_id = '/map'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L154_C0", "label": "init_node()", "type": "expression", "loc": [154, 154], "level": 0, "parent": null, "vector": [8, 0, 0.9167, 0.006, 0, 0.66, 0.8649, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": "rospy.init_node( 'traj_pub_node' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L155_C0", "label": "sleep()", "type": "expression", "loc": [155, 155], "level": 0, "parent": null, "vector": [8, 0, 0.9226, 0.006, 0, 0.66, 0.8919, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": "time.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L156_C0", "label": "print()", "type": "expression", "loc": [156, 156], "level": 0, "parent": null, "vector": [8, 0, 0.9286, 0.006, 0, 0.66, 0.9189, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('PUBLISHING')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L158_C0", "label": "pubp = Publisher()", "type": "assigned_variable", "loc": [158, 158], "level": 0, "parent": null, "vector": [14, 0, 0.9405, 0.006, 0, 0.66, 0.9459, 867, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pubp", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": "pubp = rospy.Publisher( 'traj_pub_pos', PointCloud )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L159_C0", "label": "pubn = Publisher()", "type": "assigned_variable", "loc": [159, 159], "level": 0, "parent": null, "vector": [14, 0, 0.9464, 0.006, 0, 0.66, 0.973, 675, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pubn", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": "pubn = rospy.Publisher( 'traj_pub_neg', PointCloud )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "label": "while", "type": "while", "loc": [161, 168], "level": 0, "parent": null, "vector": [5, 0, 0.9792, 0.0476, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while not rospy.is_shutdown():\n pp.header.stamp = rospy.Time.now()\n pn.header.stamp = rospy.Time.now()\n\n pubp.publish( pp )\n pubn.publish( pn )\n\n rospy.sleep( 0.5 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L162_C4", "label": "pp.header.stamp = now()", "type": "assigned_variable", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "vector": [14, 1, 0.9643, 0.006, 1, 0.6, 0.0, 263, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "pp.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " pp.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L163_C4", "label": "pn.header.stamp = now()", "type": "assigned_variable", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "vector": [14, 1, 0.9702, 0.006, 1, 0.6, 0.25, 373, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "pn.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " pn.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L165_C4", "label": "publish()", "type": "expression", "loc": [165, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "vector": [8, 1, 0.9821, 0.006, 1, 0.6, 0.5, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " pubp.publish( pp )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L166_C4", "label": "publish()", "type": "expression", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "vector": [8, 1, 0.9881, 0.006, 1, 0.6, 0.75, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " pubn.publish( pn )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L168_C4", "label": "sleep()", "type": "expression", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "vector": [8, 1, 1.0, 0.006, 1, 0.6, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.5 )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Return_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Return_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Return_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:For_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Assign_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99426:While_L161_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99426:Expr_L168_C4"}] |
import roslib
roslib.load_manifest('sensor_msgs')
roslib.load_manifest('geometry_msgs')
import rospy
from sensor_msgs.msg import PointCloud
from geometry_msgs.msg import Point32
from sensor_msgs.msg import ChannelFloat32
import numpy as np
import time
## PointCloud -> 3xN np matrix
# @param ros_pointcloud - robot_msgs/PointCloud
# @return 3xN np matrix
def ros_pointcloud_to_np(ros_pointcloud):
''' ros PointCloud.pts -> 3xN numpy matrix
'''
return ros_pts_to_np(ros_pointcloud.points)
## list of Point32 points -> 3xN np matrix
# @param ros_points - Point32[ ] (for e.g. from robot_msgs/PointCloud or Polygon3D)
# @return 3xN np matrix
def ros_pts_to_np(ros_pts):
pts_list = []
for p in ros_pts:
pts_list.append([p.x,p.y,p.z])
return np.matrix(pts_list).T
## 3xN np matrix -> ros PointCloud
# @param pts - 3xN np matrix
# @return PointCloud as defined in robot_msgs/msg/PointCloud.msg
def np_points_to_ros(pts):
p_list = []
chlist = []
# p_list = [Point32(p[0,0], p[0,1], p[0,2]) for p in pts.T]
# chlist = np.zeros(pts.shape[1]).tolist()
for p in pts.T:
p_list.append(Point32(p[0,0],p[0,1],p[0,2]))
chlist.append(0.)
ch = ChannelFloat32('t',chlist)
pc = PointCloud()
pc.points = p_list
pc.channels = [ch]
return pc
| ajibawa-2023/Python-Code-Large/train/row_99427 | 28 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Import_L1_C0", "label": "roslib import roslib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0204, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L2_C0", "label": "load_manifest()", "type": "expression", "loc": [2, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0408, 0.0204, 0, 0.66, 0.0909, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('sensor_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0612, 0.0204, 0, 0.66, 0.1818, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('geometry_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Import_L4_C0", "label": "rospy import rospy", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0204, 0, 0.66, 0.2727, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:ImportFrom_L6_C0", "label": "from sensor_msgs.msg import PointCloud", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1224, 0.0204, 0, 0.66, 0.3636, 531, 0, 1, 0, 0, 531, 0, 0], "semantic": {"name": "sensor_msgs.msg", "arg_names": [], "import_names": ["PointCloud"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sensor_msgs.msg import PointCloud"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:ImportFrom_L7_C0", "label": "from geometry_msgs.msg import Point32", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0204, 0, 0.66, 0.4545, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Point32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Point32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:ImportFrom_L8_C0", "label": "from sensor_msgs.msg import ChannelFloat32", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1633, 0.0204, 0, 0.66, 0.5455, 531, 0, 1, 0, 0, 531, 0, 0], "semantic": {"name": "sensor_msgs.msg", "arg_names": [], "import_names": ["ChannelFloat32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sensor_msgs.msg import ChannelFloat32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Import_L9_C0", "label": "numpy import np", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1837, 0.0204, 0, 0.66, 0.6364, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Import_L10_C0", "label": "time import time", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.2041, 0.0204, 0, 0.66, 0.7273, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L15_C0", "label": "ros_pointcloud_to_np", "type": "function", "loc": [15, 18], "level": 0, "parent": null, "vector": [2, 0, 0.3367, 0.0816, 0, 0.66, 0.8182, 928, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "ros_pointcloud_to_np", "arg_names": ["ros_pointcloud"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ros_pointcloud_to_np(ros_pointcloud):\n ''' ros PointCloud.pts -> 3xN numpy matrix\n '''\n return ros_pts_to_np(ros_pointcloud.points)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L15_C0", "vector": [8, 1, 0.3367, 0.0408, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ''' ros PointCloud.pts -> 3xN numpy matrix\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Return_L18_C4", "label": "return", "type": "return", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L15_C0", "vector": [13, 1, 0.3673, 0.0204, 1, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ros_pts_to_np(ros_pointcloud.points)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L23_C0", "label": "ros_pts_to_np", "type": "function", "loc": [23, 28], "level": 0, "parent": null, "vector": [2, 0, 0.5204, 0.1224, 0, 0.66, 0.9091, 846, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "ros_pts_to_np", "arg_names": ["ros_pts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ros_pts_to_np(ros_pts):\n pts_list = []\n for p in ros_pts:\n pts_list.append([p.x,p.y,p.z])\n\n return np.matrix(pts_list).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L24_C4", "label": "pts_list =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L23_C0", "vector": [14, 1, 0.4898, 0.0204, 1, 0.14, 0.0, 713, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pts_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L25_C4", "label": "for p", "type": "for", "loc": [25, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L23_C0", "vector": [6, 1, 0.5204, 0.0408, 1, 0.14, 0.5, 491, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for p in ros_pts:\n pts_list.append([p.x,p.y,p.z])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L26_C8", "label": "append()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L25_C4", "vector": [8, 2, 0.5306, 0.0204, 2, 0.33, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " pts_list.append([p.x,p.y,p.z])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Return_L28_C4", "label": "return", "type": "return", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L23_C0", "vector": [13, 1, 0.5714, 0.0204, 1, 0.14, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.matrix(pts_list).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "label": "np_points_to_ros", "type": "function", "loc": [33, 47], "level": 0, "parent": null, "vector": [2, 0, 0.8163, 0.3061, 0, 0.66, 1.0, 955, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "np_points_to_ros", "arg_names": ["pts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def np_points_to_ros(pts):\n p_list = []\n chlist = []\n\n# p_list = [Point32(p[0,0], p[0,1], p[0,2]) for p in pts.T]\n# chlist = np.zeros(pts.shape[1]).tolist()\n for p in pts.T:\n p_list.append(Point32(p[0,0],p[0,1],p[0,2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L34_C4", "label": "p_list =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "vector": [14, 1, 0.6939, 0.0204, 1, 0.68, 0.0, 98, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "p_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L35_C4", "label": "chlist =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "vector": [14, 1, 0.7143, 0.0204, 1, 0.68, 0.1429, 132, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "chlist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chlist = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L39_C4", "label": "for p", "type": "for", "loc": [39, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "vector": [6, 1, 0.8163, 0.0612, 1, 0.68, 0.2857, 491, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for p in pts.T:\n p_list.append(Point32(p[0,0],p[0,1],p[0,2]))\n chlist.append(0.)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L40_C8", "label": "append()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L39_C4", "vector": [8, 2, 0.8163, 0.0204, 2, 0.7, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " p_list.append(Point32(p[0,0],p[0,1],p[0,2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L41_C8", "label": "append()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L39_C4", "vector": [8, 2, 0.8367, 0.0204, 2, 0.7, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " chlist.append(0.)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L43_C4", "label": "ch = ChannelFloat32()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "vector": [14, 1, 0.8776, 0.0204, 1, 0.68, 0.4286, 263, 3, 2, 0, 0, 678, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "ChannelFloat32", "annotation": ""}, "snippet": " ch = ChannelFloat32('t',chlist)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L44_C4", "label": "pc = PointCloud()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "vector": [14, 1, 0.898, 0.0204, 1, 0.68, 0.5714, 876, 3, 0, 0, 0, 428, 10, 1], "semantic": {"name": "pc", "arg_names": [], "import_names": [], "rhs_call_name": "PointCloud", "annotation": ""}, "snippet": " pc = PointCloud()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L45_C4", "label": "pc.points =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "vector": [14, 1, 0.9184, 0.0204, 1, 0.68, 0.7143, 774, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pc.points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pc.points = p_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L46_C4", "label": "pc.channels =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "vector": [14, 1, 0.9388, 0.0204, 1, 0.68, 0.8571, 626, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pc.channels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pc.channels = [ch]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99427:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "vector": [13, 1, 0.9592, 0.0204, 1, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pc"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Return_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Return_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99427:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99427:Return_L47_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('robotis')
roslib.load_manifest('geometry_msgs')
roslib.load_manifest('move_base_msgs')
roslib.load_manifest('std_msgs')
roslib.load_manifest('tf')
import rospy
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
from rfid_servoing.msg import ServoAction, ServoGoal
from robotis.srv import MoveAng, MoveAngRequest
from geometry_msgs.msg import PoseStamped, Quaternion
from move_base_msgs.msg import MoveBaseAction
from std_msgs.msg import String
from rfid_datacapture.srv import BagCapture, BagCaptureRequest
import rfid_datacapture.utils as rdut
import numpy as np, math
def sm_rfid_servo_approach( yaml_fname ):
# Create a SMACH state machine
sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'])
# Open the container
with sm:
smach.StateMachine.add(
'CAPTURE_MONITOR',
rdut.YAMLproc( yaml_fname ),
remapping = {'next_move_pose':'next_move_pose', # output
'bagfile_name':'bagfile_name', # output
'bagfile_topics':'bagfile_topics', # output
'tagid':'tagid'}, # output
transitions = {'aborted':'succeeded',
'succeeded':'MOVE_POSITION'})
smach.StateMachine.add(
'MOVE_POSITION',
SimpleActionState( '/move_base',
MoveBaseAction,
goal_slots = [ 'target_pose' ]),
remapping = { 'target_pose' : 'next_move_pose' }, # input
transitions = {'aborted':'MANUAL_SKIP',
'preempted':'aborted',
'succeeded':'START_BAG_CAPTURE'})
smach.StateMachine.add(
'MANUAL_SKIP',
rdut.ManualSkip(),
transitions = {'succeeded':'START_BAG_CAPTURE', # We already manually positioned the robot
'aborted':'CAPTURE_MONITOR'}) # skip this position and go to next
smach.StateMachine.add(
'START_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request_slots = ['topics','dest'] ),
remapping = {'topics':'bagfile_topics',
'dest':'bagfile_name'},
transitions = {'succeeded':'SERVO'})
# Servoing is a basic state machine. Success means servoing finished @ obs.
smach.StateMachine.add(
'SERVO',
SimpleActionState( '/rfid_servo/servo_act',
ServoAction,
goal_slots = ['tagid']), #goal = ServoGoal( 'person ' ),
transitions = { 'succeeded': 'STOP_BAG_CAPTURE' },
remapping = {'tagid':'tagid'}) # input
smach.StateMachine.add(
'STOP_BAG_CAPTURE',
ServiceState( '/bag_cap/capture',
BagCapture,
request = BagCaptureRequest('','') ),
transitions = {'succeeded':'TUCK_LEFT'})
# Tuck Left (non-blocking)
smach.StateMachine.add(
'TUCK_LEFT',
ServiceState( 'robotis/servo_left_pan_moveangle',
MoveAng,
request = MoveAngRequest( 1.350, 0.2, 0 )), # ang (float), angvel (float), blocking (bool)
transitions = {'succeeded':'TUCK_RIGHT'})
# Tuck Right (non-blocking)
smach.StateMachine.add(
'TUCK_RIGHT',
ServiceState( 'robotis/servo_right_pan_moveangle',
MoveAng,
request = MoveAngRequest( -1.350, 0.2, 0 )), # ang (float), angvel (float), blocking (bool)
transitions = {'succeeded':'CAPTURE_MONITOR'})
return sm
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--yaml', action='store', type='string', dest='yaml',
help='Capture description yaml file', default='')
opt, args = p.parse_args()
if opt.yaml == '':
print 'ERROR: Must specify YAML file.'
exit()
rospy.init_node('rfid_servo_capture')
sm = sm_rfid_servo_approach( opt.yaml )
sis = IntrospectionServer('RFID_servo_approach', sm, '/SM_RFID_SERVO_APPROACH')
sis.start()
outcome = sm.execute()
sis.stop()
# python sm_servo_capture_simple.py --yaml datacap_vert.yaml
| ajibawa-2023/Python-Code-Large/train/row_99428 | 44 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0154, 0.0077, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0077, 0, 0.66, 0.05, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0308, 0.0077, 0, 0.66, 0.1, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('robotis')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0385, 0.0077, 0, 0.66, 0.15, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('geometry_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0462, 0.0077, 0, 0.66, 0.2, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('move_base_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0538, 0.0077, 0, 0.66, 0.25, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('std_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0615, 0.0077, 0, 0.66, 0.3, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Import_L9_C0", "label": "rospy import rospy", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0692, 0.0077, 0, 0.66, 0.35, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Import_L11_C0", "label": "smach import smach", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0846, 0.0077, 0, 0.66, 0.4, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:ImportFrom_L12_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0923, 0.0077, 0, 0.66, 0.45, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Import_L13_C0", "label": "actionlib import actionlib", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.0077, 0, 0.66, 0.5, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:ImportFrom_L15_C0", "label": "from rfid_servoing.msg import ServoAction, ServoGoal", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1154, 0.0077, 0, 0.66, 0.55, 317, 0, 2, 0, 0, 317, 0, 0], "semantic": {"name": "rfid_servoing.msg", "arg_names": [], "import_names": ["ServoAction", "ServoGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_servoing.msg import ServoAction, ServoGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:ImportFrom_L16_C0", "label": "from robotis.srv import MoveAng, MoveAngRequest", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1231, 0.0077, 0, 0.66, 0.6, 727, 0, 2, 0, 0, 727, 0, 0], "semantic": {"name": "robotis.srv", "arg_names": [], "import_names": ["MoveAng", "MoveAngRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from robotis.srv import MoveAng, MoveAngRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:ImportFrom_L17_C0", "label": "from geometry_msgs.msg import PoseStamped, Quaternion", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1308, 0.0077, 0, 0.66, 0.65, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped", "Quaternion"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped, Quaternion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:ImportFrom_L18_C0", "label": "from move_base_msgs.msg import MoveBaseAction", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1385, 0.0077, 0, 0.66, 0.7, 440, 0, 1, 0, 0, 440, 0, 0], "semantic": {"name": "move_base_msgs.msg", "arg_names": [], "import_names": ["MoveBaseAction"], "rhs_call_name": "", "annotation": ""}, "snippet": "from move_base_msgs.msg import MoveBaseAction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:ImportFrom_L19_C0", "label": "from std_msgs.msg import String", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1462, 0.0077, 0, 0.66, 0.75, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["String"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import String"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:ImportFrom_L20_C0", "label": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0077, 0, 0.66, 0.8, 252, 0, 2, 0, 0, 252, 0, 0], "semantic": {"name": "rfid_datacapture.srv", "arg_names": [], "import_names": ["BagCapture", "BagCaptureRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_datacapture.srv import BagCapture, BagCaptureRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Import_L22_C0", "label": "rfid_datacapture.utils import rdut", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1692, 0.0077, 0, 0.66, 0.85, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "rfid_datacapture.utils", "arg_names": [], "import_names": ["rdut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_datacapture.utils as rdut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Import_L24_C0", "label": "numpy import np, math", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1846, 0.0077, 0, 0.66, 0.9, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "label": "sm_rfid_servo_approach", "type": "function", "loc": [27, 103], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.5923, 0, 0.66, 0.95, 183, 0, 1, 1, 0, 0, 0, 20], "semantic": {"name": "sm_rfid_servo_approach", "arg_names": ["yaml_fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sm_rfid_servo_approach( yaml_fname ):\n # Create a SMACH state machine\n sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'])\n\n # Open the container\n with sm:\n\n smach.StateMachine.add("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L29_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [14, 1, 0.2231, 0.0077, 1, 0.23, 0.0, 21, 3, 1, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine( outcomes = ['succeeded','aborted','preempted'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L34_C8", "label": "add()", "type": "expression", "loc": [34, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [8, 1, 0.2923, 0.0692, 1, 0.23, 0.0, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'CAPTURE_MONITOR',\n rdut.YAMLproc( yaml_fname ),\n remapping = {'next_move_pose':'next_move_pose', # output\n 'bagfile_name':'bagfile_name', # output\n 'bagfile_topics':'bagfile_topics', # output\n 'tagid':'tagid'}, # output\n transitions = {'aborted':'succeeded',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L45_C8", "label": "add()", "type": "expression", "loc": [45, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [8, 1, 0.3769, 0.0692, 1, 0.23, 0.1429, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'MOVE_POSITION',\n SimpleActionState( '/move_base',\n MoveBaseAction,\n goal_slots = [ 'target_pose' ]),\n remapping = { 'target_pose' : 'next_move_pose' }, # input\n transitions = {'aborted':'MANUAL_SKIP',\n 'preempted':'aborted',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L55_C8", "label": "add()", "type": "expression", "loc": [55, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [8, 1, 0.4385, 0.0385, 1, 0.23, 0.2857, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'MANUAL_SKIP',\n rdut.ManualSkip(),\n transitions = {'succeeded':'START_BAG_CAPTURE', # We already manually positioned the robot\n 'aborted':'CAPTURE_MONITOR'}) # skip this position and go to next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L61_C8", "label": "add()", "type": "expression", "loc": [61, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [8, 1, 0.4962, 0.0615, 1, 0.23, 0.4286, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'START_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request_slots = ['topics','dest'] ),\n remapping = {'topics':'bagfile_topics',\n 'dest':'bagfile_name'},\n transitions = {'succeeded':'SERVO'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L72_C8", "label": "add()", "type": "expression", "loc": [72, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [8, 1, 0.5769, 0.0538, 1, 0.23, 0.5714, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'SERVO',\n SimpleActionState( '/rfid_servo/servo_act',\n ServoAction,\n goal_slots = ['tagid']), #goal = ServoGoal( 'person ' ),\n transitions = { 'succeeded': 'STOP_BAG_CAPTURE' },\n remapping = {'tagid':'tagid'}) # input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L80_C8", "label": "add()", "type": "expression", "loc": [80, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [8, 1, 0.6346, 0.0462, 1, 0.23, 0.7143, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'STOP_BAG_CAPTURE',\n ServiceState( '/bag_cap/capture',\n BagCapture,\n request = BagCaptureRequest('','') ),\n transitions = {'succeeded':'TUCK_LEFT'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L88_C8", "label": "add()", "type": "expression", "loc": [88, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [8, 1, 0.6962, 0.0462, 1, 0.23, 0.8571, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'TUCK_LEFT',\n ServiceState( 'robotis/servo_left_pan_moveangle',\n MoveAng,\n request = MoveAngRequest( 1.350, 0.2, 0 )), # ang (float), angvel (float), blocking (bool)\n transitions = {'succeeded':'TUCK_RIGHT'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L96_C8", "label": "add()", "type": "expression", "loc": [96, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [8, 1, 0.7577, 0.0462, 1, 0.23, 1.0, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'TUCK_RIGHT',\n ServiceState( 'robotis/servo_right_pan_moveangle',\n MoveAng,\n request = MoveAngRequest( -1.350, 0.2, 0 )), # ang (float), angvel (float), blocking (bool)\n transitions = {'succeeded':'CAPTURE_MONITOR'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Return_L103_C4", "label": "return", "type": "return", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "vector": [13, 1, 0.7923, 0.0077, 1, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "label": "if", "type": "if", "loc": [106, 126], "level": 0, "parent": null, "vector": [4, 0, 0.8923, 0.1615, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--yaml', action='store', type='string', dest='yaml',\n help='Capture description yaml file', default='')\n opt, args = p.parse_args()\n\n if opt.yaml == '':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Import_L107_C4", "label": "optparse import optparse", "type": "import", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [1, 1, 0.8231, 0.0077, 1, 0.44, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L108_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [14, 1, 0.8308, 0.0077, 1, 0.44, 0.1, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L109_C4", "label": "add_option()", "type": "expression", "loc": [109, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [8, 1, 0.8423, 0.0154, 1, 0.44, 0.2, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--yaml', action='store', type='string', dest='yaml',\n help='Capture description yaml file', default='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L111_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [14, 1, 0.8538, 0.0077, 1, 0.44, 0.3, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L113_C4", "label": "if", "type": "if", "loc": [113, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [4, 1, 0.8769, 0.0231, 1, 0.44, 0.4, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.yaml == '':\n print('ERROR: Must specify YAML file.')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L114_C8", "label": "print()", "type": "expression", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L113_C4", "vector": [8, 2, 0.8769, 0.0077, 2, 0.68, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('ERROR: Must specify YAML file.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L115_C8", "label": "exit()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L113_C4", "vector": [8, 2, 0.8846, 0.0077, 2, 0.68, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L117_C4", "label": "init_node()", "type": "expression", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [8, 1, 0.9, 0.0077, 1, 0.44, 0.5, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('rfid_servo_capture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L119_C4", "label": "sm = sm_rfid_servo_approach()", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [14, 1, 0.9154, 0.0077, 1, 0.44, 0.6, 21, 3, 1, 0, 0, 183, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "sm_rfid_servo_approach", "annotation": ""}, "snippet": " sm = sm_rfid_servo_approach( opt.yaml )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L121_C4", "label": "sis = IntrospectionServer()", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [14, 1, 0.9308, 0.0077, 1, 0.44, 0.7, 608, 3, 3, 0, 0, 702, 10, 1], "semantic": {"name": "sis", "arg_names": [], "import_names": [], "rhs_call_name": "IntrospectionServer", "annotation": ""}, "snippet": " sis = IntrospectionServer('RFID_servo_approach', sm, '/SM_RFID_SERVO_APPROACH')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L122_C4", "label": "start()", "type": "expression", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [8, 1, 0.9385, 0.0077, 1, 0.44, 0.8, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " sis.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L124_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [14, 1, 0.9538, 0.0077, 1, 0.44, 0.9, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L126_C4", "label": "stop()", "type": "expression", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "vector": [8, 1, 0.9692, 0.0077, 1, 0.44, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " sis.stop()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Return_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Import_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99428:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99428:Expr_L126_C4"}] |
import numpy as np, math
import pylab as pl
ar = [[ 0, 104 ],
[ 1, 104 ],
[ 2, 104 ],
[ 3, 104 ],
[ 4, 104 ],
[ 8, 100 ],
[ 9, 97 ],
[ 10, 96 ],
[ 11, 95 ],
[ 12, 93 ],
[ 13, 91 ],
[ 14, 90 ],
[ 15, 89 ],
[ 16, 87 ],
[ 17, 85 ],
[ 18, 84 ],
[ 19, 83 ],
[ 20, 81 ],
[ 21, 80 ],
[ 22, 78 ],
[ 23, 77 ],
[ 24, 74 ],
[ 25, 73 ],
[ 26, 71 ]]
ar = np.array( ar ).T
ar[0] *= -1.0 # Change attenuation to be negative.
# Linear least squares
a = ar[0,4:] # Start at attn = -4 to avoid including saturation region.
a = np.column_stack([ a, np.ones(len(a)) ])
b = ar[1,4:]
m,b = np.linalg.lstsq( a, b )[0]
xs = np.linspace( -27, -3, 100 )
ys = xs * m + b
if __name__ == '__main__':
pl.plot( ar[0], ar[1], 'bo', linewidth=2.0 )
pl.hold( True )
pl.plot( xs, ys, 'g-', linewidth = 2.0 )
pl.xlabel( 'Attenuator Setting (dB)')
pl.ylabel( 'RSSI' )
pl.legend([ 'Measurements', 'Linear Fit' ], loc='upper left')
pl.savefig( 'Attenuator_RSSI_measurements.png' )
pl.show()
| ajibawa-2023/Python-Code-Large/train/row_99429 | 19 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Import_L1_C0", "label": "numpy import np, math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0185, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Import_L2_C0", "label": "pylab import pl", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0185, 0, 0.66, 0.1, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Assign_L4_C0", "label": "ar =", "type": "assigned_variable", "loc": [4, 27], "level": 0, "parent": null, "vector": [14, 0, 0.287, 0.4444, 0, 0.66, 0.2, 940, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ar = [[ 0, 104 ],\n [ 1, 104 ],\n [ 2, 104 ],\n [ 3, 104 ],\n [ 4, 104 ],\n [ 8, 100 ],\n [ 9, 97 ],\n [ 10, 96 ],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Assign_L29_C0", "label": "ar =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.537, 0.0185, 0, 0.66, 0.3, 940, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ar = np.array( ar ).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Assign_L33_C0", "label": "a =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.6111, 0.0185, 0, 0.66, 0.5, 475, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "a = ar[0,4:] # Start at attn = -4 to avoid including saturation region."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Assign_L34_C0", "label": "a = column_stack()", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.6296, 0.0185, 0, 0.66, 0.6, 475, 3, 1, 0, 0, 724, 10, 3], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": "a = np.column_stack([ a, np.ones(len(a)) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Assign_L35_C0", "label": "b =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.6481, 0.0185, 0, 0.66, 0.7, 756, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "b = ar[1,4:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Assign_L36_C0", "label": "m, b =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0185, 0, 0.66, 0.8, 678, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "m, b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "m,b = np.linalg.lstsq( a, b )[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Assign_L38_C0", "label": "xs = linspace()", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.7037, 0.0185, 0, 0.66, 0.9, 928, 3, 3, 0, 0, 119, 10, 1], "semantic": {"name": "xs", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": "xs = np.linspace( -27, -3, 100 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Assign_L39_C0", "label": "ys =", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.7222, 0.0185, 0, 0.66, 1.0, 578, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ys = xs * m + b"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "label": "if", "type": "if", "loc": [41, 53], "level": 0, "parent": null, "vector": [4, 0, 0.8704, 0.2407, 0, 0.66, 1.1, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n \n pl.plot( ar[0], ar[1], 'bo', linewidth=2.0 )\n pl.hold( True )\n\n pl.plot( xs, ys, 'g-', linewidth = 2.0 )\n\n pl.xlabel( 'Attenuator Setting (dB)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L43_C4", "label": "plot()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "vector": [8, 1, 0.7963, 0.0185, 1, 0.14, 0.0, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot( ar[0], ar[1], 'bo', linewidth=2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L44_C4", "label": "hold()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "vector": [8, 1, 0.8148, 0.0185, 1, 0.14, 0.1429, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": " pl.hold( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L46_C4", "label": "plot()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "vector": [8, 1, 0.8519, 0.0185, 1, 0.14, 0.2857, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot( xs, ys, 'g-', linewidth = 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L48_C4", "label": "xlabel()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "vector": [8, 1, 0.8889, 0.0185, 1, 0.14, 0.4286, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": " pl.xlabel( 'Attenuator Setting (dB)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L49_C4", "label": "ylabel()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "vector": [8, 1, 0.9074, 0.0185, 1, 0.14, 0.5714, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": " pl.ylabel( 'RSSI' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L50_C4", "label": "legend()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "vector": [8, 1, 0.9259, 0.0185, 1, 0.14, 0.7143, 880, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pl.legend([ 'Measurements', 'Linear Fit' ], loc='upper left')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L52_C4", "label": "savefig()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "vector": [8, 1, 0.963, 0.0185, 1, 0.14, 0.8571, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " pl.savefig( 'Attenuator_RSSI_measurements.png' ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L53_C4", "label": "show()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "vector": [8, 1, 0.9815, 0.0185, 1, 0.14, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " pl.show()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99429:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99429:Expr_L53_C4"}] |
import numpy as np, math
import pylab as pl
SENSITIVITY = -80 # dBm
THRESHOLD = -18 # dBm
# P^inc_rdr = P_rdr + 2*alpha > SENSITIVITY (1)
# P^inc_tag = P_rdr + alpha > THRESHOLD (2)
# crossover = (1) - (2)
crossover_alpha = SENSITIVITY - THRESHOLD
crossover_Prdr = THRESHOLD - crossover_alpha
# alpha > 0.5 * (SENSITIVITY - Prdr) (3)
# alpha > THRESHOLD - Prdr (4)
print 'Crossover Point:\n\talpha: %2.2f\n\tPrdr: %2.2f' % (crossover_alpha, crossover_Prdr)
prdr = np.linspace( 0, 50 )
# alpha = np.linspace( -47, -30 )
alpha_3 = 0.5 * ( SENSITIVITY - prdr )
alpha_4 = THRESHOLD - prdr
f = pl.figure( figsize=(12,6) )
pl.axes([0.1,0.1,0.65,0.8])
f3 = pl.plot( prdr, alpha_3, 'g', linewidth = 3.0 )
pl.hold( True )
f4 = pl.plot( prdr, alpha_4, 'r', linewidth = 3.0 )
# x_min, x_max, y_min, y_max = pl.axis()
# pl.axis([-47,-30,y_min,y_max])
pl.legend((f3,f4),
('$P^{inc}_{rdr}$ > %d dBm' % (SENSITIVITY), '$P^{inc}_{tag}$ > %d dBm' % (THRESHOLD)),
loc=(1.03,0.2))
pl.xlabel( '$P_{rdr}$ (dBm)' )
pl.ylabel( '$\\alpha$ (dBm)' )
pl.savefig('forward_link_limit.png')
pl.show()
| ajibawa-2023/Python-Code-Large/train/row_99430 | 20 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Import_L1_C0", "label": "numpy import np, math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Import_L2_C0", "label": "pylab import pl", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0465, 0.0233, 0, 0.66, 0.0526, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L4_C0", "label": "SENSITIVITY =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.093, 0.0233, 0, 0.66, 0.1053, 867, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SENSITIVITY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SENSITIVITY = -80 # dBm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L5_C0", "label": "THRESHOLD =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.1163, 0.0233, 0, 0.66, 0.1579, 340, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "THRESHOLD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "THRESHOLD = -18 # dBm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L12_C0", "label": "crossover_alpha =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.2791, 0.0233, 0, 0.66, 0.2105, 915, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "crossover_alpha", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "crossover_alpha = SENSITIVITY - THRESHOLD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L13_C0", "label": "crossover_Prdr =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.3023, 0.0233, 0, 0.66, 0.2632, 84, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "crossover_Prdr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "crossover_Prdr = THRESHOLD - crossover_alpha"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Expr_L18_C0", "label": "print()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4186, 0.0233, 0, 0.66, 0.3158, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Crossover Point:\\n\\talpha: %2.2f\\n\\tPrdr: %2.2f' % (crossover_alpha, crossover_Prdr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L20_C0", "label": "prdr = linspace()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.4651, 0.0233, 0, 0.66, 0.3684, 355, 3, 2, 0, 0, 119, 10, 1], "semantic": {"name": "prdr", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": "prdr = np.linspace( 0, 50 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L22_C0", "label": "alpha_3 =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.5116, 0.0233, 0, 0.66, 0.4211, 895, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alpha_3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "alpha_3 = 0.5 * ( SENSITIVITY - prdr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L23_C0", "label": "alpha_4 =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.5349, 0.0233, 0, 0.66, 0.4737, 367, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alpha_4", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "alpha_4 = THRESHOLD - prdr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L25_C0", "label": "f = figure()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.5814, 0.0233, 0, 0.66, 0.5263, 899, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": "f = pl.figure( figsize=(12,6) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Expr_L26_C0", "label": "axes()", "type": "expression", "loc": [26, 26], "level": 0, "parent": null, "vector": [8, 0, 0.6047, 0.0233, 0, 0.66, 0.5789, 590, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axes", "arg_names": [], "import_names": [], "rhs_call_name": "axes", "annotation": ""}, "snippet": "pl.axes([0.1,0.1,0.65,0.8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L28_C0", "label": "f3 = plot()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.6512, 0.0233, 0, 0.66, 0.6316, 313, 3, 4, 0, 0, 929, 10, 1], "semantic": {"name": "f3", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": "f3 = pl.plot( prdr, alpha_3, 'g', linewidth = 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Expr_L29_C0", "label": "hold()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.6744, 0.0233, 0, 0.66, 0.6842, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hold", "arg_names": [], "import_names": [], "rhs_call_name": "hold", "annotation": ""}, "snippet": "pl.hold( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Assign_L30_C0", "label": "f4 = plot()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.6977, 0.0233, 0, 0.66, 0.7368, 137, 3, 4, 0, 0, 929, 10, 1], "semantic": {"name": "f4", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": "f4 = pl.plot( prdr, alpha_4, 'r', linewidth = 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Expr_L34_C0", "label": "legend()", "type": "expression", "loc": [34, 36], "level": 0, "parent": null, "vector": [8, 0, 0.814, 0.0698, 0, 0.66, 0.7895, 880, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": "pl.legend((f3,f4),\n ('$P^{inc}_{rdr}$ > %d dBm' % (SENSITIVITY), '$P^{inc}_{tag}$ > %d dBm' % (THRESHOLD)),\n loc=(1.03,0.2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Expr_L37_C0", "label": "xlabel()", "type": "expression", "loc": [37, 37], "level": 0, "parent": null, "vector": [8, 0, 0.8605, 0.0233, 0, 0.66, 0.8421, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel( '$P_{rdr}$ (dBm)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Expr_L38_C0", "label": "ylabel()", "type": "expression", "loc": [38, 38], "level": 0, "parent": null, "vector": [8, 0, 0.8837, 0.0233, 0, 0.66, 0.8947, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel( '$\\\\alpha$ (dBm)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Expr_L39_C0", "label": "savefig()", "type": "expression", "loc": [39, 39], "level": 0, "parent": null, "vector": [8, 0, 0.907, 0.0233, 0, 0.66, 0.9474, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": "pl.savefig('forward_link_limit.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99430:Expr_L40_C0", "label": "show()", "type": "expression", "loc": [40, 40], "level": 0, "parent": null, "vector": [8, 0, 0.9302, 0.0233, 0, 0.66, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": "pl.show()"}] | [] |
#! /usr/bin/python
import time
import roslib
roslib.load_manifest('rospy')
roslib.load_manifest('tf')
roslib.load_manifest('geometry_msgs')
roslib.load_manifest('std_msgs')
roslib.load_manifest('hrl_rfid')
roslib.load_manifest('robotis')
roslib.load_manifest('rfid_behaviors')
import rospy
import tf
import tf.transformations as tft
from geometry_msgs.msg import Twist
from geometry_msgs.msg import PointStamped
from geometry_msgs.msg import Point
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import Quaternion
from geometry_msgs.msg import PoseWithCovarianceStamped
from std_msgs.msg import Float64
import hrl_rfid.ros_M5e_client as rmc
import robotis.ros_robotis as rr
from hrl_rfid.msg import RFIDreadArr
import rfid_behaviors.rotate_backup_node as rb
from rfid_behaviors.cmd_process import CmdProcess
from rfid_behaviors.srv import String_Int32
from rfid_behaviors.srv import String_Int32Response
from rfid_behaviors.srv import FlapEarsSrv
from rfid_behaviors.srv import StringArr_Int32
import numpy as np, math
import time
from threading import Thread
from collections import deque
from functools import reduce
#PAN_RATE = 30.0
PAN_RATE = 10.0 # Used for datacapture.
#PAN_RATE = 3.0
def calculate_angle( pt1 ):
return np.arctan2( pt1.point.y, pt1.point.x )
def standard_rad(t):
if t > 0:
return ((t + np.pi) % (np.pi * 2)) - np.pi
else:
return ((t - np.pi) % (np.pi * -2)) + np.pi
class OrientNode( ):
def __init__( self ):
rospy.logout('orient_node: Initializing')
rospy.init_node('orient_node')
# After calling "flap ears", data will look something like this:
# { 'TagID1': [[ang,rssi], [ang,rssi], ...]
# 'TagID2': ... }
# * All angles are in /base_link and rssi's from both antennas
self.data = {}
# Will be transformed into base frame to determine best turn angle -- results in approximately 5-degrees (max) error for small angle assumption
self.tag_gt = { 'EleLeftEar': PointStamped(), 'EleRightEar': PointStamped() }
self.tag_gt[ 'EleLeftEar' ].header.frame_id = '/ear_antenna_left'
self.tag_gt[ 'EleLeftEar' ].header.stamp = rospy.Time.now()
self.tag_gt[ 'EleLeftEar' ].point.x = 10.0
self.tag_gt[ 'EleRightEar' ].header.frame_id = '/ear_antenna_right'
self.tag_gt[ 'EleRightEar' ].header.stamp = rospy.Time.now()
self.tag_gt[ 'EleRightEar' ].point.x = 10.0
self.listener = tf.TransformListener()
self.listener.waitForTransform('/base_link', '/ear_antenna_left',
rospy.Time(0), timeout = rospy.Duration(100) )
self.listener.waitForTransform('/base_link', '/ear_antenna_right',
rospy.Time(0), timeout = rospy.Duration(100) )
rospy.logout('orient_node: Transforms ready')
# For movement...
self.rotate_backup_client = rb.RotateBackupClient()
# "Ears" Setup
self.p_left = rr.ROS_Robotis_Client( 'left_pan' )
self.t_left = rr.ROS_Robotis_Client( 'left_tilt' )
self.p_right = rr.ROS_Robotis_Client( 'right_pan' )
self.t_right = rr.ROS_Robotis_Client( 'right_tilt' )
self.EX_1 = 1.350
self.EX_2 = 0.920
self.p_left.move_angle( self.EX_1, math.radians(10), blocking = False )
self.p_right.move_angle( -1.0 * self.EX_1, math.radians(10), blocking = True )
self.t_left.move_angle( 0.0, math.radians(10), blocking = False )
self.t_right.move_angle( 0.0, math.radians(10), blocking = True )
while self.p_left.is_moving() or self.p_right.is_moving():
time.sleep( 0.01 )
self.bag_pid = None
self.r = rmc.ROS_M5e_Client('ears')
self.__service_flap = rospy.Service( '/rfid_orient/flap',
FlapEarsSrv,
self.flap_ears )
self.__service_bag = rospy.Service( '/rfid_orient/bag',
StringArr_Int32,
self.bag_cap )
self.__service_orient = rospy.Service( '/rfid_orient/orient',
String_Int32,
self.orient )
self.tag_arr_sub = rospy.Subscriber( '/rfid/ears_reader_arr',
RFIDreadArr,
self.add_tags )
rospy.logout( 'orient_node: Waiting for service calls.' )
def bag_cap( self, request ):
# request.data => String array
# sample args: ['rosbag', 'record', '/tf', '/rfid/ears_reader_arr', '-o', 'data/data']
if (request.data == [] or request.data[0] == 'kill'):
if self.bag_pid == None:
rospy.logout( 'orient_node: No open bag to kill.' )
else:
rospy.logout( 'orient_node: Killing open bag.' )
self.bag_pid.kill()
self.bag_pid = None
return int( True )
s = reduce( lambda x,y: x+' '+y, request.data )
rospy.logout( 'orient_node: Calling CmdProcess with args: %s' % s )
self.bag_pid = CmdProcess( request.data )
self.bag_pid.run()
return int( True )
def orient( self, request ):
tagid = request.data
if not self.data.has_key( tagid ):
rospy.logout( 'Tag id \'%s\' not found during last scan.' % tagid )
return String_Int32Response( int( False ))
arr = np.array( self.data[ tagid ]).T
arr = arr[:,np.argsort( arr[0] )]
h, bins = np.histogram( arr[0], 36, ( -np.pi, np.pi ))
ind = np.sum(arr[0][:, np.newaxis] > bins, axis = 1) - 1 # Gives indices for data into bins
bin_centers = (bins[:-1] + bins[1:]) / 2.0
best_dir = 0.0
best_rssi = 0.0
for i in np.unique( ind ):
avg_rssi = np.mean(arr[1,np.argwhere( ind == i )])
if avg_rssi > best_rssi:
best_rssi = avg_rssi
best_dir = bin_centers[i]
rospy.logout( 'orient_node: Best dir (deg): %2.2f with avg rssi: %2.1f' %
( math.degrees(best_dir), best_rssi ))
self.rotate_backup_client.rotate_backup( best_dir, 0.0 )
return String_Int32Response( int( True ))
def add_tags( self, msg ):
for read in msg.arr:
if read.rssi == -1:
return False
self.tag_gt[ read.antenna_name ].header.stamp = rospy.Time(0)
try:
pt = self.listener.transformPoint( '/base_link',
self.tag_gt[ read.antenna_name ])
except:
rospy.logout( 'orient_node: Transform failed' )
return False
if not self.data.has_key( read.tagID ):
self.data[ read.tagID ] = []
self.data[ read.tagID ].append([ calculate_angle( pt ), 1.0 * read.rssi ])
return True
def flap_ears( self, request ):
if request.panrate == 0.0:
rpan_rate = 30.0
else:
rpan_rate = request.panrate
self.data = {}
tagid = request.data
if tagid == '':
rospy.logout( 'orient_node: capture for tagid: \'\' requested. Using QueryEnv.' )
self.r.query_mode( )
else:
rospy.logout( 'orient_node: capture for tagid: \'%s\' requested' % tagid )
self.r.track_mode( tagid )
forward = False
tilt_angs = [ math.radians( 0.0 ),
math.radians( 0.0 ) ]
for ta in tilt_angs:
# Tilt
self.t_left.move_angle( ta, math.radians( 30.0 ), blocking = False )
self.t_right.move_angle( -1.0 * ta, math.radians( 30.0 ), blocking = False )
while self.t_left.is_moving() or self.t_right.is_moving():
time.sleep(0.01)
# Pan
if forward:
self.p_left.move_angle( self.EX_1, math.radians( rpan_rate ), blocking = False )
self.p_right.move_angle( -1.0 * self.EX_1, math.radians( rpan_rate ), blocking = True )
forward = False
else:
self.p_left.move_angle( -1.0 * self.EX_2, math.radians( rpan_rate ), blocking = False )
self.p_right.move_angle( self.EX_2, math.radians( rpan_rate ), blocking = True )
forward = True
while self.p_left.is_moving() or self.p_right.is_moving():
time.sleep(0.01)
time.sleep(0.1)
self.r.stop()
print self.data.keys()
# Reset / Stow
self.p_left.move_angle( self.EX_1, math.radians(10), blocking = False )
self.t_left.move_angle( 0.0, math.radians(10), blocking = False )
self.p_right.move_angle( -1.0 * self.EX_1, math.radians(10), blocking = False )
self.t_right.move_angle( 0.0, math.radians(10), blocking = False )
rospy.logout( 'orient_node: capture completed' )
# print self.data
return [self.data.keys()]
if __name__ == '__main__':
on = OrientNode()
rospy.spin()
| ajibawa-2023/Python-Code-Large/train/row_99431 | 161 | 237 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L2_C0", "label": "time import time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0084, 0.0042, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0127, 0.0042, 0, 0.66, 0.027, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0169, 0.0042, 0, 0.66, 0.0541, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rospy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0042, 0, 0.66, 0.0811, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0253, 0.0042, 0, 0.66, 0.1081, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('geometry_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0295, 0.0042, 0, 0.66, 0.1351, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('std_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0338, 0.0042, 0, 0.66, 0.1622, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_rfid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.038, 0.0042, 0, 0.66, 0.1892, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('robotis')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0422, 0.0042, 0, 0.66, 0.2162, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L11_C0", "label": "rospy import rospy", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0464, 0.0042, 0, 0.66, 0.2432, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L13_C0", "label": "tf import tf", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0549, 0.0042, 0, 0.66, 0.2703, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L14_C0", "label": "tf.transformations import tft", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0591, 0.0042, 0, 0.66, 0.2973, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tft"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tft"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L15_C0", "label": "from geometry_msgs.msg import Twist", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0633, 0.0042, 0, 0.66, 0.3243, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Twist"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Twist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L16_C0", "label": "from geometry_msgs.msg import PointStamped", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0675, 0.0042, 0, 0.66, 0.3514, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PointStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PointStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L17_C0", "label": "from geometry_msgs.msg import Point", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0717, 0.0042, 0, 0.66, 0.3784, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Point"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L18_C0", "label": "from geometry_msgs.msg import PoseStamped", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0759, 0.0042, 0, 0.66, 0.4054, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L19_C0", "label": "from geometry_msgs.msg import Quaternion", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0802, 0.0042, 0, 0.66, 0.4324, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Quaternion"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Quaternion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L20_C0", "label": "from geometry_msgs.msg import PoseWithCovarianceStamped", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0844, 0.0042, 0, 0.66, 0.4595, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseWithCovarianceStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseWithCovarianceStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L21_C0", "label": "from std_msgs.msg import Float64", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0886, 0.0042, 0, 0.66, 0.4865, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Float64"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Float64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L23_C0", "label": "hrl_rfid.ros_M5e_client import rmc", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.097, 0.0042, 0, 0.66, 0.5135, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "hrl_rfid.ros_M5e_client", "arg_names": [], "import_names": ["rmc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_rfid.ros_M5e_client as rmc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L24_C0", "label": "robotis.ros_robotis import rr", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1013, 0.0042, 0, 0.66, 0.5405, 570, 0, 1, 0, 0, 570, 0, 0], "semantic": {"name": "robotis.ros_robotis", "arg_names": [], "import_names": ["rr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import robotis.ros_robotis as rr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L25_C0", "label": "from hrl_rfid.msg import RFIDreadArr", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1055, 0.0042, 0, 0.66, 0.5676, 328, 0, 1, 0, 0, 328, 0, 0], "semantic": {"name": "hrl_rfid.msg", "arg_names": [], "import_names": ["RFIDreadArr"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.msg import RFIDreadArr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L26_C0", "label": "rfid_behaviors.rotate_backup_node import rb", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.1097, 0.0042, 0, 0.66, 0.5946, 667, 0, 1, 0, 0, 667, 0, 0], "semantic": {"name": "rfid_behaviors.rotate_backup_node", "arg_names": [], "import_names": ["rb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_behaviors.rotate_backup_node as rb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L27_C0", "label": "from rfid_behaviors.cmd_process import CmdProcess", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1139, 0.0042, 0, 0.66, 0.6216, 741, 0, 1, 0, 0, 741, 0, 0], "semantic": {"name": "rfid_behaviors.cmd_process", "arg_names": [], "import_names": ["CmdProcess"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.cmd_process import CmdProcess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L28_C0", "label": "from rfid_behaviors.srv import String_Int32", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.1181, 0.0042, 0, 0.66, 0.6486, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["String_Int32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import String_Int32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L29_C0", "label": "from rfid_behaviors.srv import String_Int32Response", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.1224, 0.0042, 0, 0.66, 0.6757, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["String_Int32Response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import String_Int32Response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L30_C0", "label": "from rfid_behaviors.srv import FlapEarsSrv", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.1266, 0.0042, 0, 0.66, 0.7027, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["FlapEarsSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import FlapEarsSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L31_C0", "label": "from rfid_behaviors.srv import StringArr_Int32", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.1308, 0.0042, 0, 0.66, 0.7297, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["StringArr_Int32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import StringArr_Int32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L33_C0", "label": "numpy import np, math", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.1392, 0.0042, 0, 0.66, 0.7568, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Import_L34_C0", "label": "time import time", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.1435, 0.0042, 0, 0.66, 0.7838, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L35_C0", "label": "from threading import Thread", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.1477, 0.0042, 0, 0.66, 0.8108, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L36_C0", "label": "from collections import deque", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.1519, 0.0042, 0, 0.66, 0.8378, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "collections", "arg_names": [], "import_names": ["deque"], "rhs_call_name": "", "annotation": ""}, "snippet": "from collections import deque"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ImportFrom_L37_C0", "label": "from functools import reduce", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.1561, 0.0042, 0, 0.66, 0.8649, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": ["reduce"], "rhs_call_name": "", "annotation": ""}, "snippet": "from functools import reduce"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L40_C0", "label": "PAN_RATE =", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.1688, 0.0042, 0, 0.66, 0.8919, 499, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "PAN_RATE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PAN_RATE = 10.0 # Used for datacapture."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L43_C0", "label": "calculate_angle", "type": "function", "loc": [43, 44], "level": 0, "parent": null, "vector": [2, 0, 0.1835, 0.0084, 0, 0.66, 0.9189, 793, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "calculate_angle", "arg_names": ["pt1"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def calculate_angle( pt1 ):\n return np.arctan2( pt1.point.y, pt1.point.x )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L44_C4", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L43_C0", "vector": [13, 1, 0.1857, 0.0042, 1, 0.6, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.arctan2( pt1.point.y, pt1.point.x )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L46_C0", "label": "standard_rad", "type": "function", "loc": [46, 50], "level": 0, "parent": null, "vector": [2, 0, 0.2025, 0.0211, 0, 0.66, 0.9459, 54, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "standard_rad", "arg_names": ["t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def standard_rad(t):\n if t > 0:\n return ((t + np.pi) % (np.pi * 2)) - np.pi\n else:\n return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L47_C4", "label": "if", "type": "if", "loc": [47, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L46_C0", "vector": [4, 1, 0.2046, 0.0169, 1, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t > 0:\n return ((t + np.pi) % (np.pi * 2)) - np.pi\n else:\n return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L47_C4", "vector": [13, 2, 0.2025, 0.0042, 2, 0.35, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t + np.pi) % (np.pi * 2)) - np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L50_C8", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L47_C4", "vector": [13, 2, 0.211, 0.0042, 2, 0.35, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "label": "OrientNode", "type": "class", "loc": [53, 231], "level": 0, "parent": null, "vector": [3, 0, 0.5992, 0.7553, 0, 0.66, 0.973, 913, 0, 5, 0, 0, 0, 0, 99], "semantic": {"name": "OrientNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OrientNode( ):\n def __init__( self ):\n rospy.logout('orient_node: Initializing')\n rospy.init_node('orient_node')\n\n # After calling \"flap ears\", data will look something like this:\n # { 'TagID1': [[ang,rssi], [ang,rssi], ...]\n # 'TagID2': ... }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "label": "__init__", "type": "function", "loc": [54, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "vector": [2, 1, 0.3544, 0.2574, 1, 0.83, 0.0, 555, 0, 1, 0, 0, 0, 0, 36], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self ):\n rospy.logout('orient_node: Initializing')\n rospy.init_node('orient_node')\n\n # After calling \"flap ears\", data will look something like this:\n # { 'TagID1': [[ang,rssi], [ang,rssi], ...]\n # 'TagID2': ... }\n # * All angles are in /base_link and rssi's from both antennas"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L55_C8", "label": "logout()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.2321, 0.0042, 2, 0.47, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout('orient_node: Initializing')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L56_C8", "label": "init_node()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.2363, 0.0042, 2, 0.47, 0.0312, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('orient_node')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L62_C8", "label": "self.data =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.2616, 0.0042, 2, 0.47, 0.0625, 838, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L65_C8", "label": "self.tag_gt =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.2743, 0.0042, 2, 0.47, 0.0938, 443, 0, 0, 0, 0, 0, 6, 2], "semantic": {"name": "self.tag_gt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tag_gt = { 'EleLeftEar': PointStamped(), 'EleRightEar': PointStamped() }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L66_C8", "label": "self.tag_gt['EleLeftEar'].header.frame_id =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.2785, 0.0042, 2, 0.47, 0.125, 141, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.tag_gt['EleLeftEar'].header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tag_gt[ 'EleLeftEar' ].header.frame_id = '/ear_antenna_left'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L67_C8", "label": "self.tag_gt['EleLeftEar'].header.stamp = now()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.2827, 0.0042, 2, 0.47, 0.1562, 727, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "self.tag_gt['EleLeftEar'].header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " self.tag_gt[ 'EleLeftEar' ].header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L68_C8", "label": "self.tag_gt['EleLeftEar'].point.x =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.2869, 0.0042, 2, 0.47, 0.1875, 906, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.tag_gt['EleLeftEar'].point.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tag_gt[ 'EleLeftEar' ].point.x = 10.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L69_C8", "label": "self.tag_gt['EleRightEar'].header.frame_id =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.2911, 0.0042, 2, 0.47, 0.2188, 530, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.tag_gt['EleRightEar'].header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tag_gt[ 'EleRightEar' ].header.frame_id = '/ear_antenna_right'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L70_C8", "label": "self.tag_gt['EleRightEar'].header.stamp = now()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.2954, 0.0042, 2, 0.47, 0.25, 58, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "self.tag_gt['EleRightEar'].header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " self.tag_gt[ 'EleRightEar' ].header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L71_C8", "label": "self.tag_gt['EleRightEar'].point.x =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.2996, 0.0042, 2, 0.47, 0.2812, 614, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.tag_gt['EleRightEar'].point.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tag_gt[ 'EleRightEar' ].point.x = 10.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L73_C8", "label": "self.listener = TransformListener()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.308, 0.0042, 2, 0.47, 0.3125, 686, 3, 0, 0, 0, 108, 10, 1], "semantic": {"name": "self.listener", "arg_names": [], "import_names": [], "rhs_call_name": "TransformListener", "annotation": ""}, "snippet": " self.listener = tf.TransformListener()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L74_C8", "label": "waitForTransform()", "type": "expression", "loc": [74, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.3143, 0.0084, 2, 0.47, 0.3438, 900, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "waitForTransform", "arg_names": [], "import_names": [], "rhs_call_name": "waitForTransform", "annotation": ""}, "snippet": " self.listener.waitForTransform('/base_link', '/ear_antenna_left',\n rospy.Time(0), timeout = rospy.Duration(100) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L76_C8", "label": "waitForTransform()", "type": "expression", "loc": [76, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.3228, 0.0084, 2, 0.47, 0.375, 900, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "waitForTransform", "arg_names": [], "import_names": [], "rhs_call_name": "waitForTransform", "annotation": ""}, "snippet": " self.listener.waitForTransform('/base_link', '/ear_antenna_right',\n rospy.Time(0), timeout = rospy.Duration(100) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L78_C8", "label": "logout()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.3291, 0.0042, 2, 0.47, 0.4062, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout('orient_node: Transforms ready')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L81_C8", "label": "self.rotate_backup_client = RotateBackupClient()", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.3418, 0.0042, 2, 0.47, 0.4375, 812, 3, 0, 0, 0, 481, 10, 1], "semantic": {"name": "self.rotate_backup_client", "arg_names": [], "import_names": [], "rhs_call_name": "RotateBackupClient", "annotation": ""}, "snippet": " self.rotate_backup_client = rb.RotateBackupClient()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L84_C8", "label": "self.p_left = ROS_Robotis_Client()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.3544, 0.0042, 2, 0.47, 0.4688, 577, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "self.p_left", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Client", "annotation": ""}, "snippet": " self.p_left = rr.ROS_Robotis_Client( 'left_pan' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L85_C8", "label": "self.t_left = ROS_Robotis_Client()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.3586, 0.0042, 2, 0.47, 0.5, 624, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "self.t_left", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Client", "annotation": ""}, "snippet": " self.t_left = rr.ROS_Robotis_Client( 'left_tilt' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L86_C8", "label": "self.p_right = ROS_Robotis_Client()", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.3629, 0.0042, 2, 0.47, 0.5312, 972, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "self.p_right", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Client", "annotation": ""}, "snippet": " self.p_right = rr.ROS_Robotis_Client( 'right_pan' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L87_C8", "label": "self.t_right = ROS_Robotis_Client()", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.3671, 0.0042, 2, 0.47, 0.5625, 359, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "self.t_right", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Client", "annotation": ""}, "snippet": " self.t_right = rr.ROS_Robotis_Client( 'right_tilt' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L89_C8", "label": "self.EX_1 =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.3755, 0.0042, 2, 0.47, 0.5938, 791, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.EX_1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.EX_1 = 1.350"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L90_C8", "label": "self.EX_2 =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.3797, 0.0042, 2, 0.47, 0.625, 851, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.EX_2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.EX_2 = 0.920 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L92_C8", "label": "move_angle()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.3882, 0.0042, 2, 0.47, 0.6562, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.p_left.move_angle( self.EX_1, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L93_C8", "label": "move_angle()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.3924, 0.0042, 2, 0.47, 0.6875, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.p_right.move_angle( -1.0 * self.EX_1, math.radians(10), blocking = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L94_C8", "label": "move_angle()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.3966, 0.0042, 2, 0.47, 0.7188, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.t_left.move_angle( 0.0, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L95_C8", "label": "move_angle()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.4008, 0.0042, 2, 0.47, 0.75, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.t_right.move_angle( 0.0, math.radians(10), blocking = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L96_C8", "label": "while", "type": "while", "loc": [96, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [5, 2, 0.4072, 0.0084, 2, 0.47, 0.7812, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.p_left.is_moving() or self.p_right.is_moving():\n time.sleep( 0.01 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L97_C12", "label": "sleep()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L96_C8", "vector": [8, 3, 0.4093, 0.0042, 3, 0.73, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 0.01 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L99_C8", "label": "self.bag_pid =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.4177, 0.0042, 2, 0.47, 0.8125, 386, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.bag_pid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.bag_pid = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L101_C8", "label": "self.r = ROS_M5e_Client()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.4262, 0.0042, 2, 0.47, 0.8438, 173, 3, 1, 0, 0, 479, 10, 1], "semantic": {"name": "self.r", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_M5e_Client", "annotation": ""}, "snippet": " self.r = rmc.ROS_M5e_Client('ears')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L102_C8", "label": "self.__service_flap = Service()", "type": "assigned_variable", "loc": [102, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.4346, 0.0127, 2, 0.47, 0.875, 183, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self.__service_flap", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self.__service_flap = rospy.Service( '/rfid_orient/flap',\n FlapEarsSrv,\n self.flap_ears )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L105_C8", "label": "self.__service_bag = Service()", "type": "assigned_variable", "loc": [105, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.4473, 0.0127, 2, 0.47, 0.9062, 630, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self.__service_bag", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self.__service_bag = rospy.Service( '/rfid_orient/bag',\n StringArr_Int32,\n self.bag_cap )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L108_C8", "label": "self.__service_orient = Service()", "type": "assigned_variable", "loc": [108, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.4599, 0.0127, 2, 0.47, 0.9375, 945, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self.__service_orient", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self.__service_orient = rospy.Service( '/rfid_orient/orient',\n String_Int32,\n self.orient )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L111_C8", "label": "self.tag_arr_sub = Subscriber()", "type": "assigned_variable", "loc": [111, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [14, 2, 0.4726, 0.0127, 2, 0.47, 0.9688, 505, 3, 3, 0, 0, 455, 10, 1], "semantic": {"name": "self.tag_arr_sub", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " self.tag_arr_sub = rospy.Subscriber( '/rfid/ears_reader_arr', \n RFIDreadArr, \n self.add_tags )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L114_C8", "label": "logout()", "type": "expression", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "vector": [8, 2, 0.481, 0.0042, 2, 0.47, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: Waiting for service calls.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "label": "bag_cap", "type": "function", "loc": [116, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "vector": [2, 1, 0.5232, 0.0717, 1, 0.83, 0.25, 137, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "bag_cap", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def bag_cap( self, request ):\n # request.data => String array\n # sample args: ['rosbag', 'record', '/tf', '/rfid/ears_reader_arr', '-o', 'data/data']\n if (request.data == [] or request.data[0] == 'kill'):\n if self.bag_pid == None:\n rospy.logout( 'orient_node: No open bag to kill.' )\n else:\n rospy.logout( 'orient_node: Killing open bag.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L119_C8", "label": "if", "type": "if", "loc": [119, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "vector": [4, 2, 0.5169, 0.0338, 2, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (request.data == [] or request.data[0] == 'kill'):\n if self.bag_pid == None:\n rospy.logout( 'orient_node: No open bag to kill.' )\n else:\n rospy.logout( 'orient_node: Killing open bag.' )\n self.bag_pid.kill()\n self.bag_pid = None\n return int( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "label": "if", "type": "if", "loc": [120, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L119_C8", "vector": [4, 3, 0.5169, 0.0253, 3, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.bag_pid == None:\n rospy.logout( 'orient_node: No open bag to kill.' )\n else:\n rospy.logout( 'orient_node: Killing open bag.' )\n self.bag_pid.kill()\n self.bag_pid = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L121_C16", "label": "logout()", "type": "expression", "loc": [121, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "vector": [8, 4, 0.5105, 0.0042, 4, 0.99, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: No open bag to kill.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L123_C16", "label": "logout()", "type": "expression", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "vector": [8, 4, 0.519, 0.0042, 4, 0.99, 0.3333, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: Killing open bag.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L124_C16", "label": "kill()", "type": "expression", "loc": [124, 124], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "vector": [8, 4, 0.5232, 0.0042, 4, 0.99, 0.6667, 173, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "kill", "arg_names": [], "import_names": [], "rhs_call_name": "kill", "annotation": ""}, "snippet": " self.bag_pid.kill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L125_C16", "label": "self.bag_pid =", "type": "assigned_variable", "loc": [125, 125], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "vector": [14, 4, 0.5274, 0.0042, 4, 0.99, 1.0, 386, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.bag_pid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.bag_pid = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L126_C12", "label": "return", "type": "return", "loc": [126, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L119_C8", "vector": [13, 3, 0.5316, 0.0042, 3, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L128_C8", "label": "s = reduce()", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "vector": [14, 2, 0.5401, 0.0042, 2, 0.96, 0.2, 553, 3, 2, 0, 0, 622, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " s = reduce( lambda x,y: x+' '+y, request.data )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L129_C8", "label": "logout()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "vector": [8, 2, 0.5443, 0.0042, 2, 0.96, 0.4, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: Calling CmdProcess with args: %s' % s )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L130_C8", "label": "self.bag_pid = CmdProcess()", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "vector": [14, 2, 0.5485, 0.0042, 2, 0.96, 0.6, 386, 3, 1, 0, 0, 248, 10, 1], "semantic": {"name": "self.bag_pid", "arg_names": [], "import_names": [], "rhs_call_name": "CmdProcess", "annotation": ""}, "snippet": " self.bag_pid = CmdProcess( request.data )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L131_C8", "label": "run()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "vector": [8, 2, 0.5527, 0.0042, 2, 0.96, 0.8, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " self.bag_pid.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L132_C8", "label": "return", "type": "return", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "vector": [13, 2, 0.557, 0.0042, 2, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "label": "orient", "type": "function", "loc": [134, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "vector": [2, 1, 0.6139, 0.1013, 1, 0.83, 0.5, 295, 0, 2, 1, 0, 0, 0, 16], "semantic": {"name": "orient", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def orient( self, request ):\n tagid = request.data\n if not self.data.has_key( tagid ):\n rospy.logout( 'Tag id \\'%s\\' not found during last scan.' % tagid )\n return String_Int32Response( int( False ))\n arr = np.array( self.data[ tagid ]).T\n arr = arr[:,np.argsort( arr[0] )]\n h, bins = np.histogram( arr[0], 36, ( -np.pi, np.pi ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L135_C8", "label": "tagid =", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [14, 2, 0.5696, 0.0042, 2, 0.49, 0.0, 538, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tagid = request.data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L136_C8", "label": "if", "type": "if", "loc": [136, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [4, 2, 0.5781, 0.0127, 2, 0.49, 0.0833, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.data.has_key( tagid ):\n rospy.logout( 'Tag id \\'%s\\' not found during last scan.' % tagid )\n return String_Int32Response( int( False ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L137_C12", "label": "logout()", "type": "expression", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L136_C8", "vector": [8, 3, 0.5781, 0.0042, 3, 0.34, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Tag id \\'%s\\' not found during last scan.' % tagid )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L138_C12", "label": "return", "type": "return", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L136_C8", "vector": [13, 3, 0.5823, 0.0042, 3, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return String_Int32Response( int( False ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L139_C8", "label": "arr =", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [14, 2, 0.5865, 0.0042, 2, 0.49, 0.1667, 395, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arr = np.array( self.data[ tagid ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L140_C8", "label": "arr =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [14, 2, 0.5907, 0.0042, 2, 0.49, 0.25, 395, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arr = arr[:,np.argsort( arr[0] )]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L141_C8", "label": "h, bins = histogram()", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [14, 2, 0.5949, 0.0042, 2, 0.49, 0.3333, 474, 3, 3, 0, 0, 428, 10, 1], "semantic": {"name": "h, bins", "arg_names": [], "import_names": [], "rhs_call_name": "histogram", "annotation": ""}, "snippet": " h, bins = np.histogram( arr[0], 36, ( -np.pi, np.pi ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L142_C8", "label": "ind =", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [14, 2, 0.5992, 0.0042, 2, 0.49, 0.4167, 680, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind = np.sum(arr[0][:, np.newaxis] > bins, axis = 1) - 1 # Gives indices for data into bins"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L143_C8", "label": "bin_centers =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [14, 2, 0.6034, 0.0042, 2, 0.49, 0.5, 545, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bin_centers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bin_centers = (bins[:-1] + bins[1:]) / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L145_C8", "label": "best_dir =", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [14, 2, 0.6118, 0.0042, 2, 0.49, 0.5833, 541, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "best_dir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_dir = 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L146_C8", "label": "best_rssi =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [14, 2, 0.616, 0.0042, 2, 0.49, 0.6667, 643, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "best_rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_rssi = 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L147_C8", "label": "for i", "type": "for", "loc": [147, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [6, 2, 0.6287, 0.0211, 2, 0.49, 0.75, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in np.unique( ind ):\n avg_rssi = np.mean(arr[1,np.argwhere( ind == i )])\n if avg_rssi > best_rssi:\n best_rssi = avg_rssi\n best_dir = bin_centers[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L148_C12", "label": "avg_rssi = mean()", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L147_C8", "vector": [14, 3, 0.6245, 0.0042, 3, 0.48, 0.0, 605, 3, 1, 0, 0, 856, 10, 2], "semantic": {"name": "avg_rssi", "arg_names": [], "import_names": [], "rhs_call_name": "mean", "annotation": ""}, "snippet": " avg_rssi = np.mean(arr[1,np.argwhere( ind == i )])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L149_C12", "label": "if", "type": "if", "loc": [149, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L147_C8", "vector": [4, 3, 0.6329, 0.0127, 3, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if avg_rssi > best_rssi:\n best_rssi = avg_rssi\n best_dir = bin_centers[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L150_C16", "label": "best_rssi =", "type": "assigned_variable", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L149_C12", "vector": [14, 4, 0.6329, 0.0042, 4, 0.48, 0.0, 643, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "best_rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_rssi = avg_rssi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L151_C16", "label": "best_dir =", "type": "assigned_variable", "loc": [151, 151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L149_C12", "vector": [14, 4, 0.6371, 0.0042, 4, 0.48, 1.0, 541, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "best_dir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_dir = bin_centers[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L153_C8", "label": "logout()", "type": "expression", "loc": [153, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [8, 2, 0.6477, 0.0084, 2, 0.49, 0.8333, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: Best dir (deg): %2.2f with avg rssi: %2.1f' %\n ( math.degrees(best_dir), best_rssi ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L156_C8", "label": "rotate_backup()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [8, 2, 0.6582, 0.0042, 2, 0.49, 0.9167, 878, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "rotate_backup", "arg_names": [], "import_names": [], "rhs_call_name": "rotate_backup", "annotation": ""}, "snippet": " self.rotate_backup_client.rotate_backup( best_dir, 0.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L157_C8", "label": "return", "type": "return", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "vector": [13, 2, 0.6624, 0.0042, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return String_Int32Response( int( True ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L160_C4", "label": "add_tags", "type": "function", "loc": [160, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "vector": [2, 1, 0.7089, 0.0717, 1, 0.83, 0.75, 806, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "add_tags", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_tags( self, msg ):\n for read in msg.arr:\n if read.rssi == -1:\n return False\n\n self.tag_gt[ read.antenna_name ].header.stamp = rospy.Time(0)\n try:\n pt = self.listener.transformPoint( '/base_link', "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "label": "for read", "type": "for", "loc": [161, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L160_C4", "vector": [6, 2, 0.7089, 0.0633, 2, 0.58, 0.0, 453, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for read in msg.arr:\n if read.rssi == -1:\n return False\n\n self.tag_gt[ read.antenna_name ].header.stamp = rospy.Time(0)\n try:\n pt = self.listener.transformPoint( '/base_link', \n self.tag_gt[ read.antenna_name ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L162_C12", "label": "if", "type": "if", "loc": [162, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "vector": [4, 3, 0.6857, 0.0084, 3, 0.34, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if read.rssi == -1:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L163_C16", "label": "return", "type": "return", "loc": [163, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L162_C12", "vector": [13, 4, 0.6878, 0.0042, 4, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L165_C12", "label": "self.tag_gt[read.antenna_name].header.stamp = Time()", "type": "assigned_variable", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "vector": [14, 3, 0.6962, 0.0042, 3, 0.34, 0.25, 355, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "self.tag_gt[read.antenna_name].header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " self.tag_gt[ read.antenna_name ].header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Try_L166_C12", "label": "try", "type": "try", "loc": [166, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "vector": [7, 3, 0.711, 0.0253, 3, 0.34, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n pt = self.listener.transformPoint( '/base_link', \n self.tag_gt[ read.antenna_name ])\n except:\n rospy.logout( 'orient_node: Transform failed' )\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L167_C16", "label": "pt = transformPoint()", "type": "assigned_variable", "loc": [167, 168], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:Try_L166_C12", "vector": [14, 4, 0.7068, 0.0084, 4, 0.66, 0.0, 989, 3, 2, 0, 0, 987, 10, 1], "semantic": {"name": "pt", "arg_names": [], "import_names": [], "rhs_call_name": "transformPoint", "annotation": ""}, "snippet": " pt = self.listener.transformPoint( '/base_link', \n self.tag_gt[ read.antenna_name ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L170_C16", "label": "logout()", "type": "expression", "loc": [170, 170], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:Try_L166_C12", "vector": [8, 4, 0.7173, 0.0042, 4, 0.66, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: Transform failed' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L171_C16", "label": "return", "type": "return", "loc": [171, 171], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:Try_L166_C12", "vector": [13, 4, 0.7215, 0.0042, 4, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L173_C12", "label": "if", "type": "if", "loc": [173, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "vector": [4, 3, 0.7321, 0.0084, 3, 0.34, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.data.has_key( read.tagID ):\n self.data[ read.tagID ] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L174_C16", "label": "assign", "type": "assigned_variable", "loc": [174, 174], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L173_C12", "vector": [14, 4, 0.7342, 0.0042, 4, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data[ read.tagID ] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L175_C12", "label": "append()", "type": "expression", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "vector": [8, 3, 0.7384, 0.0042, 3, 0.34, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.data[ read.tagID ].append([ calculate_angle( pt ), 1.0 * read.rssi ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L176_C8", "label": "return", "type": "return", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L160_C4", "vector": [13, 2, 0.7426, 0.0042, 2, 0.58, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "label": "flap_ears", "type": "function", "loc": [178, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "vector": [2, 1, 0.8629, 0.2278, 1, 0.83, 1.0, 590, 0, 2, 1, 0, 0, 0, 38], "semantic": {"name": "flap_ears", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flap_ears( self, request ):\n if request.panrate == 0.0:\n rpan_rate = 30.0\n else:\n rpan_rate = request.panrate\n self.data = {}\n tagid = request.data\n if tagid == '':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L179_C8", "label": "if", "type": "if", "loc": [179, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [4, 2, 0.7616, 0.0169, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.panrate == 0.0:\n rpan_rate = 30.0\n else:\n rpan_rate = request.panrate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L180_C12", "label": "rpan_rate =", "type": "assigned_variable", "loc": [180, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L179_C8", "vector": [14, 3, 0.7595, 0.0042, 3, 0.86, 0.0, 253, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "rpan_rate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rpan_rate = 30.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L182_C12", "label": "rpan_rate =", "type": "assigned_variable", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L179_C8", "vector": [14, 3, 0.7679, 0.0042, 3, 0.86, 1.0, 253, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rpan_rate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rpan_rate = request.panrate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L183_C8", "label": "self.data =", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [14, 2, 0.7722, 0.0042, 2, 0.46, 0.0667, 838, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L184_C8", "label": "tagid =", "type": "assigned_variable", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [14, 2, 0.7764, 0.0042, 2, 0.46, 0.1333, 538, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tagid = request.data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "label": "if", "type": "if", "loc": [185, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [4, 2, 0.7911, 0.0253, 2, 0.46, 0.2, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tagid == '':\n rospy.logout( 'orient_node: capture for tagid: \\'\\' requested. Using QueryEnv.' )\n self.r.query_mode( )\n else:\n rospy.logout( 'orient_node: capture for tagid: \\'%s\\' requested' % tagid )\n self.r.track_mode( tagid )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L186_C12", "label": "logout()", "type": "expression", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "vector": [8, 3, 0.7848, 0.0042, 3, 0.73, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: capture for tagid: \\'\\' requested. Using QueryEnv.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L187_C12", "label": "query_mode()", "type": "expression", "loc": [187, 187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "vector": [8, 3, 0.789, 0.0042, 3, 0.73, 0.3333, 130, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "query_mode", "arg_names": [], "import_names": [], "rhs_call_name": "query_mode", "annotation": ""}, "snippet": " self.r.query_mode( )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L189_C12", "label": "logout()", "type": "expression", "loc": [189, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "vector": [8, 3, 0.7975, 0.0042, 3, 0.73, 0.6667, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: capture for tagid: \\'%s\\' requested' % tagid )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L190_C12", "label": "track_mode()", "type": "expression", "loc": [190, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "vector": [8, 3, 0.8017, 0.0042, 3, 0.73, 1.0, 884, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "track_mode", "arg_names": [], "import_names": [], "rhs_call_name": "track_mode", "annotation": ""}, "snippet": " self.r.track_mode( tagid )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L192_C8", "label": "forward =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [14, 2, 0.8101, 0.0042, 2, 0.46, 0.2667, 194, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "forward", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forward = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L193_C8", "label": "tilt_angs =", "type": "assigned_variable", "loc": [193, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [14, 2, 0.8165, 0.0084, 2, 0.46, 0.3333, 405, 0, 0, 0, 0, 0, 5, 2], "semantic": {"name": "tilt_angs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tilt_angs = [ math.radians( 0.0 ),\n math.radians( 0.0 ) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "label": "for ta", "type": "for", "loc": [196, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [6, 2, 0.865, 0.0802, 2, 0.46, 0.4, 280, 2, 0, 0, 0, 0, 0, 18], "semantic": {"name": "ta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ta in tilt_angs:\n # Tilt\n self.t_left.move_angle( ta, math.radians( 30.0 ), blocking = False )\n self.t_right.move_angle( -1.0 * ta, math.radians( 30.0 ), blocking = False )\n while self.t_left.is_moving() or self.t_right.is_moving():\n time.sleep(0.01)\n\n # Pan"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L198_C12", "label": "move_angle()", "type": "expression", "loc": [198, 198], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "vector": [8, 3, 0.8354, 0.0042, 3, 0.52, 0.0, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.t_left.move_angle( ta, math.radians( 30.0 ), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L199_C12", "label": "move_angle()", "type": "expression", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "vector": [8, 3, 0.8397, 0.0042, 3, 0.52, 0.25, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.t_right.move_angle( -1.0 * ta, math.radians( 30.0 ), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L200_C12", "label": "while", "type": "while", "loc": [200, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "vector": [5, 3, 0.846, 0.0084, 3, 0.52, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.t_left.is_moving() or self.t_right.is_moving():\n time.sleep(0.01)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L201_C16", "label": "sleep()", "type": "expression", "loc": [201, 201], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L200_C12", "vector": [8, 4, 0.8481, 0.0042, 4, 0.0, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.01)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "label": "if", "type": "if", "loc": [204, 211], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "vector": [4, 3, 0.8755, 0.0338, 3, 0.52, 0.75, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if forward:\n self.p_left.move_angle( self.EX_1, math.radians( rpan_rate ), blocking = False )\n self.p_right.move_angle( -1.0 * self.EX_1, math.radians( rpan_rate ), blocking = True )\n forward = False\n else:\n self.p_left.move_angle( -1.0 * self.EX_2, math.radians( rpan_rate ), blocking = False )\n self.p_right.move_angle( self.EX_2, math.radians( rpan_rate ), blocking = True )\n forward = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L205_C16", "label": "move_angle()", "type": "expression", "loc": [205, 205], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "vector": [8, 4, 0.865, 0.0042, 4, 0.21, 0.0, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.p_left.move_angle( self.EX_1, math.radians( rpan_rate ), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L206_C16", "label": "move_angle()", "type": "expression", "loc": [206, 206], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "vector": [8, 4, 0.8692, 0.0042, 4, 0.21, 0.2, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.p_right.move_angle( -1.0 * self.EX_1, math.radians( rpan_rate ), blocking = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L207_C16", "label": "forward =", "type": "assigned_variable", "loc": [207, 207], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "vector": [14, 4, 0.8734, 0.0042, 4, 0.21, 0.4, 194, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "forward", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forward = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L209_C16", "label": "move_angle()", "type": "expression", "loc": [209, 209], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "vector": [8, 4, 0.8819, 0.0042, 4, 0.21, 0.6, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.p_left.move_angle( -1.0 * self.EX_2, math.radians( rpan_rate ), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L210_C16", "label": "move_angle()", "type": "expression", "loc": [210, 210], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "vector": [8, 4, 0.8861, 0.0042, 4, 0.21, 0.8, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.p_right.move_angle( self.EX_2, math.radians( rpan_rate ), blocking = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L211_C16", "label": "forward =", "type": "assigned_variable", "loc": [211, 211], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "vector": [14, 4, 0.8903, 0.0042, 4, 0.21, 1.0, 194, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "forward", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forward = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L213_C12", "label": "while", "type": "while", "loc": [213, 214], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "vector": [5, 3, 0.9008, 0.0084, 3, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.p_left.is_moving() or self.p_right.is_moving():\n time.sleep(0.01)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L214_C16", "label": "sleep()", "type": "expression", "loc": [214, 214], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L213_C12", "vector": [8, 4, 0.903, 0.0042, 4, 0.34, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.01)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L216_C8", "label": "sleep()", "type": "expression", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [8, 2, 0.9114, 0.0042, 2, 0.46, 0.4667, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L218_C8", "label": "stop()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [8, 2, 0.9198, 0.0042, 2, 0.46, 0.5333, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " self.r.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L219_C8", "label": "print()", "type": "expression", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [8, 2, 0.9241, 0.0042, 2, 0.46, 0.6, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(self.data.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L222_C8", "label": "move_angle()", "type": "expression", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [8, 2, 0.9367, 0.0042, 2, 0.46, 0.6667, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.p_left.move_angle( self.EX_1, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L223_C8", "label": "move_angle()", "type": "expression", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [8, 2, 0.9409, 0.0042, 2, 0.46, 0.7333, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.t_left.move_angle( 0.0, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L225_C8", "label": "move_angle()", "type": "expression", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [8, 2, 0.9494, 0.0042, 2, 0.46, 0.8, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.p_right.move_angle( -1.0 * self.EX_1, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L226_C8", "label": "move_angle()", "type": "expression", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [8, 2, 0.9536, 0.0042, 2, 0.46, 0.8667, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " self.t_right.move_angle( 0.0, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L228_C8", "label": "logout()", "type": "expression", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [8, 2, 0.962, 0.0042, 2, 0.46, 0.9333, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'orient_node: capture completed' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L231_C8", "label": "return", "type": "return", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "vector": [13, 2, 0.9747, 0.0042, 2, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [self.data.keys()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L235_C0", "label": "if", "type": "if", "loc": [235, 237], "level": 0, "parent": null, "vector": [4, 0, 0.9958, 0.0127, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n on = OrientNode()\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L236_C4", "label": "on = OrientNode()", "type": "assigned_variable", "loc": [236, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L235_C0", "vector": [14, 1, 0.9958, 0.0042, 1, 0.16, 0.0, 876, 3, 0, 0, 0, 913, 10, 1], "semantic": {"name": "on", "arg_names": [], "import_names": [], "rhs_call_name": "OrientNode", "annotation": ""}, "snippet": " on = OrientNode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L237_C4", "label": "spin()", "type": "expression", "loc": [237, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L235_C0", "vector": [8, 1, 1.0, 0.0042, 1, 0.16, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L121_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L123_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L124_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L125_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L136_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L136_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L147_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L147_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L149_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L150_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L149_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L151_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L162_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L163_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Try_L166_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:Try_L166_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L167_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:Try_L166_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L170_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:Try_L166_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L171_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L173_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L174_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L179_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L180_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L179_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L189_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L198_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L200_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L201_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L205_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L206_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L207_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L209_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L210_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L204_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L211_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:While_L213_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L214_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Return_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Assign_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99431:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99431:Expr_L237_C4"}] |
#! /usr/bin/python
import time
import roslib
roslib.load_manifest('rospy')
roslib.load_manifest('actionlib')
roslib.load_manifest( 'move_base_msgs' )
roslib.load_manifest('tf')
roslib.load_manifest('geometry_msgs')
roslib.load_manifest('std_msgs')
roslib.load_manifest('hrl_rfid')
roslib.load_manifest('robotis')
roslib.load_manifest('rfid_behaviors')
import rospy
import tf
import tf.transformations as tft
import actionlib
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from geometry_msgs.msg import Twist
from geometry_msgs.msg import PointStamped
from geometry_msgs.msg import Point
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import Quaternion
from geometry_msgs.msg import PoseWithCovarianceStamped
from std_msgs.msg import Float64
from rfid_behaviors.srv import FloatFloat_Int32
from rfid_behaviors.srv import FloatFloat_Int32Response
from rfid_behaviors.srv import FloatFloatFloatFloat_Int32
import numpy as np, math
import time
from threading import Thread
from collections import deque
def standard_rad(t):
if t > 0:
return ((t + np.pi) % (np.pi * 2)) - np.pi
else:
return ((t - np.pi) % (np.pi * -2)) + np.pi
class RotateBackup():
def __init__( self, service_name = '/rotate_backup' ):
try:
rospy.init_node( 'rotater' )
except:
pass
rospy.logout( 'rotate_backup: Initializing service: \'%s\'' % service_name )
self.pub = rospy.Publisher( '/move_base_simple/goal', PoseStamped )
self.pub_direct = rospy.Publisher( '/navigation/cmd_vel', Twist )
self.listener = tf.TransformListener()
self.listener.waitForTransform('/odom_combined', '/base_link',
rospy.Time(0), timeout = rospy.Duration(100) )
self._service_rb = rospy.Service( service_name, FloatFloat_Int32, self.move)
self._service_rb_navstack = rospy.Service( service_name+'/navstack', FloatFloatFloatFloat_Int32, self.navstack)
rospy.logout( 'rotate_backup: Service ready' )
def non_nav_rotate( self, r ):
success, pose, orient = self.get_pose() # orient = rx, ry, rz
if not success:
rospy.logout( 'rotate_backup: Rotate transform fail. Exiting.' )
return
t_rz = standard_rad( orient[-1] + r )
mov = Twist()
mov.linear.x = 0.05
mov.angular.z = 0.6 * np.sign( r )
rate = rospy.Rate( 10 )
while not np.allclose( [t_rz], [orient[-1]], atol=[0.08] ): # Not within 5deg of target
success, pose, orient = self.get_pose() # orient = rx, ry, rz
orient[-1] = standard_rad( orient[-1] )
if not success:
rospy.logout( 'rotate_backup: Rotate transform fail. Exiting.' )
return
self.pub_direct.publish( mov )
rate.sleep()
def non_nav_backup( self, d ):
# Hacky way to backup without relying on nav_stack's bizarre circling.
mov = Twist()
mov.linear.x = 0.1 * np.sign( d )
t0 = time.time()
rate = rospy.Rate( 10.0 )
while time.time() - t0 < np.abs(d) / 0.1:
self.pub_direct.publish( mov )
rate.sleep()
def get_pose( self ):
ps = PoseStamped()
ps.header.stamp = rospy.Time(0)
ps.header.frame_id = '/base_link'
#ps.pose.position.x = d
try:
ps_odom = self.listener.transformPose( '/odom_combined', ps )
except:
rospy.logout( 'rotate_backup: Failed transform #1.' )
time.sleep( 2.0 )
return False, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]
orient = ps_odom.pose.orientation
rx, ry, rz = tft.euler_from_quaternion([ orient.x, orient.y, orient.z, orient.w ])
pose = [ ps_odom.pose.position.x, ps_odom.pose.position.y, ps_odom.pose.position.z ]
return True, pose, [rx, ry, rz]
# Hacky version not using actionlib
# def wait_for_stop( self, duration = 0.5 ):
# rospy.logout( 'rotate_backup: Waiting for movement to stop.' )
# t0 = time.time()
# rate = rospy.Rate( 10 )
# success, pose, orient = self.get_pose()
# if not success:
# rospy.logout( 'rotate_backup: Waiting 2 sec.' )
# time.sleep( 2.0 )
# return
# sp = np.array([ pose[0], pose[1], pose[2], orient[-1] ])
# while time.time() - t0 < duration:
# success, pose, orient = self.get_pose()
# if not success:
# rospy.logout( 'rotate_backup: Waiting 2 sec.' )
# time.sleep( 2.0 )
# return
# qp = np.array([ pose[0], pose[1], pose[2], orient[-1] ])
# if not np.allclose( sp, qp, atol=[0.01, 0.01, 0.01, 0.005] ):
# t0 = time.time()
# sp = qp
# rate.sleep()
# return
def move( self, request ):
r = request.rotate
d = request.displace
rospy.logout( 'rotate_backup: Asked to rotate: %3.2f (deg)' % math.degrees(r))
rospy.logout( 'rotate_backup: Asked to translate (forward-backward): %3.2f (m)' % d)
self.non_nav_backup( d )
self.non_nav_rotate( r )
# success, pose, orient = self.get_pose()
# if not success:
# return FloatFloat_Int32Response( int(False) )
# new_point = Point( pose[0], pose[1], pose[2] )
# old_rx, old_ry, old_rz = orient
# new_orient = tft.quaternion_from_euler( old_rx, old_ry, old_rz + r )
# new_quat = Quaternion( *new_orient )
# new_ps = PoseStamped()
# new_ps.header.stamp = rospy.Time(0)
# new_ps.header.frame_id = '/odom_combined'
# new_ps.pose.position = new_point
# new_ps.pose.orientation = new_quat
# self.pub.publish( new_ps )
# self.wait_for_stop()
# rospy.logout( 'rotate_backup: Done with call.' )
return FloatFloat_Int32Response( int(True) )
# Hacky version not using actionlib
# def navstack( self, request ):
# new_orient = tft.quaternion_from_euler( 0.0, 0.0, request.ang ) # rx, ry, rz
# new_quat = Quaternion( *new_orient )
# new_ps = PoseStamped()
# new_ps.header.stamp = rospy.Time(0)
# new_ps.header.frame_id = '/map'
# new_ps.pose.position.x = request.x
# new_ps.pose.position.y = request.y
# new_ps.pose.orientation = new_quat
# rospy.logout( 'rotate_backup: Requesting navstack move to <x,y,ang-deg> %3.3f %3.3f %3.3f.' % (request.x, request.y, math.degrees(request.ang)) )
# self.pub.publish( new_ps )
# rospy.logout( 'rotate_backup: Waiting for base to stop moving.' )
# self.wait_for_stop( 7.0 )
# return int( True )
def navstack( self, request ):
rospy.logout( 'rotate_backup: Requesting navstack move to <x,y,ang-deg> %3.3f %3.3f %3.3f.' % (request.x, request.y, math.degrees(request.ang)) )
client = actionlib.SimpleActionClient( 'move_base', MoveBaseAction )
client.wait_for_server()
ps = PoseStamped()
ps.header.frame_id = '/map'
ps.header.stamp = rospy.Time(0)
ps.pose.position.x = request.x
ps.pose.position.y = request.y
ps.pose.orientation = Quaternion( *tft.quaternion_from_euler( 0.0, 0.0, request.ang ))
goal = MoveBaseGoal( ps )
client.send_goal( goal )
rospy.logout( 'rotate_backup: Waiting for base to stop moving.' )
client.wait_for_result()
return int( True )
class RotateBackupClient():
def __init__( self, service_name = '/rotate_backup' ):
rospy.logout( 'rotate_backup_client: Waiting for service: \'%s\'' % service_name )
rospy.wait_for_service( service_name )
rospy.logout( 'rotate_backup_client: Service ready.' )
self._rb_service = rospy.ServiceProxy( service_name, FloatFloat_Int32 )
def rotate_backup( self, rotate, displace ):
return self._rb_service( rotate, displace )
if __name__ == '__main__':
rb = RotateBackup()
rospy.spin()
| ajibawa-2023/Python-Code-Large/train/row_99432 | 119 | 217 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Import_L2_C0", "label": "time import time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0046, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0138, 0.0046, 0, 0.66, 0.0303, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0184, 0.0046, 0, 0.66, 0.0606, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rospy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.023, 0.0046, 0, 0.66, 0.0909, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0276, 0.0046, 0, 0.66, 0.1212, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'move_base_msgs' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0323, 0.0046, 0, 0.66, 0.1515, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0369, 0.0046, 0, 0.66, 0.1818, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('geometry_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0415, 0.0046, 0, 0.66, 0.2121, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('std_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0461, 0.0046, 0, 0.66, 0.2424, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_rfid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L11_C0", "label": "load_manifest()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0507, 0.0046, 0, 0.66, 0.2727, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('robotis')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L12_C0", "label": "load_manifest()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0553, 0.0046, 0, 0.66, 0.303, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Import_L13_C0", "label": "rospy import rospy", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0599, 0.0046, 0, 0.66, 0.3333, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Import_L15_C0", "label": "tf import tf", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0691, 0.0046, 0, 0.66, 0.3636, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Import_L16_C0", "label": "tf.transformations import tft", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0737, 0.0046, 0, 0.66, 0.3939, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tft"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tft"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Import_L17_C0", "label": "actionlib import actionlib", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0783, 0.0046, 0, 0.66, 0.4242, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L18_C0", "label": "from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0829, 0.0046, 0, 0.66, 0.4545, 440, 0, 2, 0, 0, 440, 0, 0], "semantic": {"name": "move_base_msgs.msg", "arg_names": [], "import_names": ["MoveBaseAction", "MoveBaseGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L19_C0", "label": "from geometry_msgs.msg import Twist", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0876, 0.0046, 0, 0.66, 0.4848, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Twist"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Twist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L20_C0", "label": "from geometry_msgs.msg import PointStamped", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0922, 0.0046, 0, 0.66, 0.5152, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PointStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PointStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L21_C0", "label": "from geometry_msgs.msg import Point", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0968, 0.0046, 0, 0.66, 0.5455, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Point"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L22_C0", "label": "from geometry_msgs.msg import PoseStamped", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1014, 0.0046, 0, 0.66, 0.5758, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L23_C0", "label": "from geometry_msgs.msg import Quaternion", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.106, 0.0046, 0, 0.66, 0.6061, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Quaternion"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Quaternion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L24_C0", "label": "from geometry_msgs.msg import PoseWithCovarianceStamped", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1106, 0.0046, 0, 0.66, 0.6364, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseWithCovarianceStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseWithCovarianceStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L25_C0", "label": "from std_msgs.msg import Float64", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1152, 0.0046, 0, 0.66, 0.6667, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Float64"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Float64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L27_C0", "label": "from rfid_behaviors.srv import FloatFloat_Int32", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1244, 0.0046, 0, 0.66, 0.697, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["FloatFloat_Int32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import FloatFloat_Int32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L28_C0", "label": "from rfid_behaviors.srv import FloatFloat_Int32Response", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.129, 0.0046, 0, 0.66, 0.7273, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["FloatFloat_Int32Response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import FloatFloat_Int32Response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L29_C0", "label": "from rfid_behaviors.srv import FloatFloatFloatFloat_Int32", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.1336, 0.0046, 0, 0.66, 0.7576, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["FloatFloatFloatFloat_Int32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import FloatFloatFloatFloat_Int32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Import_L31_C0", "label": "numpy import np, math", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0046, 0, 0.66, 0.7879, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Import_L32_C0", "label": "time import time", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.1475, 0.0046, 0, 0.66, 0.8182, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L33_C0", "label": "from threading import Thread", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.1521, 0.0046, 0, 0.66, 0.8485, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ImportFrom_L34_C0", "label": "from collections import deque", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.1567, 0.0046, 0, 0.66, 0.8788, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "collections", "arg_names": [], "import_names": ["deque"], "rhs_call_name": "", "annotation": ""}, "snippet": "from collections import deque"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L36_C0", "label": "standard_rad", "type": "function", "loc": [36, 40], "level": 0, "parent": null, "vector": [2, 0, 0.1751, 0.023, 0, 0.66, 0.9091, 54, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "standard_rad", "arg_names": ["t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def standard_rad(t):\n if t > 0:\n return ((t + np.pi) % (np.pi * 2)) - np.pi\n else:\n return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L37_C4", "label": "if", "type": "if", "loc": [37, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L36_C0", "vector": [4, 1, 0.1774, 0.0184, 1, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t > 0:\n return ((t + np.pi) % (np.pi * 2)) - np.pi\n else:\n return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L37_C4", "vector": [13, 2, 0.1751, 0.0046, 2, 0.5, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t + np.pi) % (np.pi * 2)) - np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L40_C8", "label": "return", "type": "return", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L37_C4", "vector": [13, 2, 0.1843, 0.0046, 2, 0.5, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "label": "RotateBackup", "type": "class", "loc": [43, 201], "level": 0, "parent": null, "vector": [3, 0, 0.5622, 0.7327, 0, 0.66, 0.9394, 827, 0, 6, 0, 0, 0, 0, 57], "semantic": {"name": "RotateBackup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RotateBackup():\n def __init__( self, service_name = '/rotate_backup' ):\n try:\n rospy.init_node( 'rotater' )\n except:\n pass\n rospy.logout( 'rotate_backup: Initializing service: \\'%s\\'' % service_name )\n self.pub = rospy.Publisher( '/move_base_simple/goal', PoseStamped )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "label": "__init__", "type": "function", "loc": [44, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "vector": [2, 1, 0.2327, 0.0645, 1, 0.6, 0.0, 555, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "__init__", "arg_names": ["self", "service_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, service_name = '/rotate_backup' ):\n try:\n rospy.init_node( 'rotater' )\n except:\n pass\n rospy.logout( 'rotate_backup: Initializing service: \\'%s\\'' % service_name )\n self.pub = rospy.Publisher( '/move_base_simple/goal', PoseStamped )\n self.pub_direct = rospy.Publisher( '/navigation/cmd_vel', Twist )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L45_C8", "label": "try", "type": "try", "loc": [45, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [7, 2, 0.2143, 0.0184, 2, 0.79, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node( 'rotater' )\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L46_C12", "label": "init_node()", "type": "expression", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L45_C8", "vector": [8, 3, 0.212, 0.0046, 3, 0.1, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'rotater' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L49_C8", "label": "logout()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [8, 2, 0.2258, 0.0046, 2, 0.79, 0.125, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Initializing service: \\'%s\\'' % service_name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L50_C8", "label": "self.pub = Publisher()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [14, 2, 0.2304, 0.0046, 2, 0.79, 0.25, 86, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.pub", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.pub = rospy.Publisher( '/move_base_simple/goal', PoseStamped )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L51_C8", "label": "self.pub_direct = Publisher()", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [14, 2, 0.235, 0.0046, 2, 0.79, 0.375, 432, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.pub_direct", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.pub_direct = rospy.Publisher( '/navigation/cmd_vel', Twist )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L52_C8", "label": "self.listener = TransformListener()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [14, 2, 0.2396, 0.0046, 2, 0.79, 0.5, 686, 3, 0, 0, 0, 108, 10, 1], "semantic": {"name": "self.listener", "arg_names": [], "import_names": [], "rhs_call_name": "TransformListener", "annotation": ""}, "snippet": " self.listener = tf.TransformListener()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L53_C8", "label": "waitForTransform()", "type": "expression", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [8, 2, 0.2465, 0.0092, 2, 0.79, 0.625, 900, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "waitForTransform", "arg_names": [], "import_names": [], "rhs_call_name": "waitForTransform", "annotation": ""}, "snippet": " self.listener.waitForTransform('/odom_combined', '/base_link',\n rospy.Time(0), timeout = rospy.Duration(100) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L55_C8", "label": "self._service_rb = Service()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [14, 2, 0.2535, 0.0046, 2, 0.79, 0.75, 456, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._service_rb", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._service_rb = rospy.Service( service_name, FloatFloat_Int32, self.move)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L56_C8", "label": "self._service_rb_navstack = Service()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [14, 2, 0.2581, 0.0046, 2, 0.79, 0.875, 229, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._service_rb_navstack", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._service_rb_navstack = rospy.Service( service_name+'/navstack', FloatFloatFloatFloat_Int32, self.navstack)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L57_C8", "label": "logout()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "vector": [8, 2, 0.2627, 0.0046, 2, 0.79, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Service ready' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "label": "non_nav_rotate", "type": "function", "loc": [59, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "vector": [2, 1, 0.3157, 0.0922, 1, 0.6, 0.2, 213, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "non_nav_rotate", "arg_names": ["self", "r"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def non_nav_rotate( self, r ):\n success, pose, orient = self.get_pose() # orient = rx, ry, rz\n if not success:\n rospy.logout( 'rotate_backup: Rotate transform fail. Exiting.' )\n return\n \n t_rz = standard_rad( orient[-1] + r )\n mov = Twist()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L60_C8", "label": "success, pose, orient = get_pose()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "vector": [14, 2, 0.2765, 0.0046, 2, 0.87, 0.0, 507, 3, 0, 0, 0, 876, 10, 1], "semantic": {"name": "success, pose, orient", "arg_names": [], "import_names": [], "rhs_call_name": "get_pose", "annotation": ""}, "snippet": " success, pose, orient = self.get_pose() # orient = rx, ry, rz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L61_C8", "label": "if", "type": "if", "loc": [61, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "vector": [4, 2, 0.2857, 0.0138, 2, 0.87, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not success:\n rospy.logout( 'rotate_backup: Rotate transform fail. Exiting.' )\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L62_C12", "label": "logout()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L61_C8", "vector": [8, 3, 0.2857, 0.0046, 3, 0.63, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Rotate transform fail. Exiting.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L63_C12", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L61_C8", "vector": [13, 3, 0.2903, 0.0046, 3, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L65_C8", "label": "t_rz = standard_rad()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "vector": [14, 2, 0.2995, 0.0046, 2, 0.87, 0.2857, 81, 3, 1, 0, 0, 54, 10, 1], "semantic": {"name": "t_rz", "arg_names": [], "import_names": [], "rhs_call_name": "standard_rad", "annotation": ""}, "snippet": " t_rz = standard_rad( orient[-1] + r )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L66_C8", "label": "mov = Twist()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "vector": [14, 2, 0.3041, 0.0046, 2, 0.87, 0.4286, 202, 3, 0, 0, 0, 9, 10, 1], "semantic": {"name": "mov", "arg_names": [], "import_names": [], "rhs_call_name": "Twist", "annotation": ""}, "snippet": " mov = Twist()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L67_C8", "label": "mov.linear.x =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "vector": [14, 2, 0.3088, 0.0046, 2, 0.87, 0.5714, 583, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "mov.linear.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mov.linear.x = 0.05"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L68_C8", "label": "mov.angular.z =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "vector": [14, 2, 0.3134, 0.0046, 2, 0.87, 0.7143, 177, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "mov.angular.z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mov.angular.z = 0.6 * np.sign( r )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L70_C8", "label": "rate = Rate()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "vector": [14, 2, 0.3226, 0.0046, 2, 0.87, 0.8571, 477, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "rate", "arg_names": [], "import_names": [], "rhs_call_name": "Rate", "annotation": ""}, "snippet": " rate = rospy.Rate( 10 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "label": "while", "type": "while", "loc": [71, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "vector": [5, 2, 0.3433, 0.0369, 2, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not np.allclose( [t_rz], [orient[-1]], atol=[0.08] ): # Not within 5deg of target\n success, pose, orient = self.get_pose() # orient = rx, ry, rz\n orient[-1] = standard_rad( orient[-1] )\n if not success:\n rospy.logout( 'rotate_backup: Rotate transform fail. Exiting.' )\n return\n self.pub_direct.publish( mov )\n rate.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L72_C12", "label": "success, pose, orient = get_pose()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "vector": [14, 3, 0.3318, 0.0046, 3, 0.65, 0.0, 507, 3, 0, 0, 0, 876, 10, 1], "semantic": {"name": "success, pose, orient", "arg_names": [], "import_names": [], "rhs_call_name": "get_pose", "annotation": ""}, "snippet": " success, pose, orient = self.get_pose() # orient = rx, ry, rz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L73_C12", "label": " = standard_rad()", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "vector": [14, 3, 0.3364, 0.0046, 3, 0.65, 0.25, 0, 3, 1, 0, 0, 54, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "standard_rad", "annotation": ""}, "snippet": " orient[-1] = standard_rad( orient[-1] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L74_C12", "label": "if", "type": "if", "loc": [74, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "vector": [4, 3, 0.3456, 0.0138, 3, 0.65, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not success:\n rospy.logout( 'rotate_backup: Rotate transform fail. Exiting.' )\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L75_C16", "label": "logout()", "type": "expression", "loc": [75, 75], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L74_C12", "vector": [8, 4, 0.3456, 0.0046, 4, 0.17, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Rotate transform fail. Exiting.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L76_C16", "label": "return", "type": "return", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L74_C12", "vector": [13, 4, 0.3502, 0.0046, 4, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L77_C12", "label": "publish()", "type": "expression", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "vector": [8, 3, 0.3548, 0.0046, 3, 0.65, 0.75, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub_direct.publish( mov )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L78_C12", "label": "sleep()", "type": "expression", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "vector": [8, 3, 0.3594, 0.0046, 3, 0.65, 1.0, 476, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rate.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "label": "non_nav_backup", "type": "function", "loc": [81, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "vector": [2, 1, 0.3917, 0.0415, 1, 0.6, 0.4, 607, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "non_nav_backup", "arg_names": ["self", "d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def non_nav_backup( self, d ):\n # Hacky way to backup without relying on nav_stack's bizarre circling.\n mov = Twist()\n mov.linear.x = 0.1 * np.sign( d )\n t0 = time.time()\n rate = rospy.Rate( 10.0 )\n while time.time() - t0 < np.abs(d) / 0.1:\n self.pub_direct.publish( mov )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L83_C8", "label": "mov = Twist()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "vector": [14, 2, 0.3825, 0.0046, 2, 0.34, 0.0, 202, 3, 0, 0, 0, 9, 10, 1], "semantic": {"name": "mov", "arg_names": [], "import_names": [], "rhs_call_name": "Twist", "annotation": ""}, "snippet": " mov = Twist()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L84_C8", "label": "mov.linear.x =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "vector": [14, 2, 0.3871, 0.0046, 2, 0.34, 0.25, 583, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "mov.linear.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mov.linear.x = 0.1 * np.sign( d )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L85_C8", "label": "t0 = time()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "vector": [14, 2, 0.3917, 0.0046, 2, 0.34, 0.5, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L86_C8", "label": "rate = Rate()", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "vector": [14, 2, 0.3963, 0.0046, 2, 0.34, 0.75, 477, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "rate", "arg_names": [], "import_names": [], "rhs_call_name": "Rate", "annotation": ""}, "snippet": " rate = rospy.Rate( 10.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L87_C8", "label": "while", "type": "while", "loc": [87, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "vector": [5, 2, 0.4055, 0.0138, 2, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while time.time() - t0 < np.abs(d) / 0.1:\n self.pub_direct.publish( mov )\n rate.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L88_C12", "label": "publish()", "type": "expression", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L87_C8", "vector": [8, 3, 0.4055, 0.0046, 3, 0.99, 0.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub_direct.publish( mov )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L89_C12", "label": "sleep()", "type": "expression", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L87_C8", "vector": [8, 3, 0.4101, 0.0046, 3, 0.99, 1.0, 476, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rate.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "label": "get_pose", "type": "function", "loc": [91, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "vector": [2, 1, 0.4562, 0.0783, 1, 0.6, 0.6, 876, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "get_pose", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_pose( self ):\n ps = PoseStamped()\n ps.header.stamp = rospy.Time(0)\n ps.header.frame_id = '/base_link'\n #ps.pose.position.x = d\n \n try:\n ps_odom = self.listener.transformPose( '/odom_combined', ps )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L92_C8", "label": "ps = PoseStamped()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "vector": [14, 2, 0.424, 0.0046, 2, 0.5, 0.0, 232, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " ps = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L93_C8", "label": "ps.header.stamp = Time()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "vector": [14, 2, 0.4286, 0.0046, 2, 0.5, 0.1429, 161, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "ps.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " ps.header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L94_C8", "label": "ps.header.frame_id =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "vector": [14, 2, 0.4332, 0.0046, 2, 0.5, 0.2857, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ps.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.header.frame_id = '/base_link'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "label": "try", "type": "try", "loc": [97, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "vector": [7, 2, 0.4585, 0.0276, 2, 0.5, 0.4286, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n ps_odom = self.listener.transformPose( '/odom_combined', ps )\n except:\n rospy.logout( 'rotate_backup: Failed transform #1.' )\n time.sleep( 2.0 )\n return False, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L98_C12", "label": "ps_odom = transformPose()", "type": "assigned_variable", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "vector": [14, 3, 0.4516, 0.0046, 3, 0.62, 0.0, 871, 3, 2, 0, 0, 654, 10, 1], "semantic": {"name": "ps_odom", "arg_names": [], "import_names": [], "rhs_call_name": "transformPose", "annotation": ""}, "snippet": " ps_odom = self.listener.transformPose( '/odom_combined', ps )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L100_C12", "label": "logout()", "type": "expression", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "vector": [8, 3, 0.4608, 0.0046, 3, 0.62, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Failed transform #1.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L101_C12", "label": "sleep()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "vector": [8, 3, 0.4654, 0.0046, 3, 0.62, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L102_C12", "label": "return", "type": "return", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "vector": [13, 3, 0.47, 0.0046, 3, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L104_C8", "label": "orient =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "vector": [14, 2, 0.4793, 0.0046, 2, 0.5, 0.5714, 295, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "orient", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " orient = ps_odom.pose.orientation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L105_C8", "label": "rx, ry, rz = euler_from_quaternion()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "vector": [14, 2, 0.4839, 0.0046, 2, 0.5, 0.7143, 603, 3, 1, 0, 0, 409, 10, 1], "semantic": {"name": "rx, ry, rz", "arg_names": [], "import_names": [], "rhs_call_name": "euler_from_quaternion", "annotation": ""}, "snippet": " rx, ry, rz = tft.euler_from_quaternion([ orient.x, orient.y, orient.z, orient.w ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L106_C8", "label": "pose =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "vector": [14, 2, 0.4885, 0.0046, 2, 0.5, 0.8571, 767, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pose = [ ps_odom.pose.position.x, ps_odom.pose.position.y, ps_odom.pose.position.z ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "vector": [13, 2, 0.4931, 0.0046, 2, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, pose, [rx, ry, rz]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "label": "move", "type": "function", "loc": [135, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "vector": [2, 1, 0.6843, 0.129, 1, 0.6, 0.8, 856, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "move", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def move( self, request ):\n r = request.rotate\n d = request.displace\n rospy.logout( 'rotate_backup: Asked to rotate: %3.2f (deg)' % math.degrees(r))\n rospy.logout( 'rotate_backup: Asked to translate (forward-backward): %3.2f (m)' % d)\n\n self.non_nav_backup( d )\n self.non_nav_rotate( r )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L136_C8", "label": "r =", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "vector": [14, 2, 0.6267, 0.0046, 2, 0.96, 0.0, 436, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = request.rotate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L137_C8", "label": "d =", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "vector": [14, 2, 0.6313, 0.0046, 2, 0.96, 0.1667, 355, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = request.displace"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L138_C8", "label": "logout()", "type": "expression", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "vector": [8, 2, 0.6359, 0.0046, 2, 0.96, 0.3333, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Asked to rotate: %3.2f (deg)' % math.degrees(r))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L139_C8", "label": "logout()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "vector": [8, 2, 0.6406, 0.0046, 2, 0.96, 0.5, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Asked to translate (forward-backward): %3.2f (m)' % d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L141_C8", "label": "non_nav_backup()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "vector": [8, 2, 0.6498, 0.0046, 2, 0.96, 0.6667, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "non_nav_backup", "arg_names": [], "import_names": [], "rhs_call_name": "non_nav_backup", "annotation": ""}, "snippet": " self.non_nav_backup( d )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L142_C8", "label": "non_nav_rotate()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "vector": [8, 2, 0.6544, 0.0046, 2, 0.96, 0.8333, 213, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "non_nav_rotate", "arg_names": [], "import_names": [], "rhs_call_name": "non_nav_rotate", "annotation": ""}, "snippet": " self.non_nav_rotate( r )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L162_C8", "label": "return", "type": "return", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "vector": [13, 2, 0.7465, 0.0046, 2, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return FloatFloat_Int32Response( int(True) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "label": "navstack", "type": "function", "loc": [184, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "vector": [2, 1, 0.8871, 0.0829, 1, 0.6, 1.0, 791, 0, 2, 1, 0, 0, 0, 13], "semantic": {"name": "navstack", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def navstack( self, request ):\n rospy.logout( 'rotate_backup: Requesting navstack move to <x,y,ang-deg> %3.3f %3.3f %3.3f.' % (request.x, request.y, math.degrees(request.ang)) )\n\n client = actionlib.SimpleActionClient( 'move_base', MoveBaseAction )\n client.wait_for_server()\n\n ps = PoseStamped()\n ps.header.frame_id = '/map'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L185_C8", "label": "logout()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [8, 2, 0.8525, 0.0046, 2, 0.14, 0.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Requesting navstack move to <x,y,ang-deg> %3.3f %3.3f %3.3f.' % (request.x, request.y, math.degrees(request.ang)) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L187_C8", "label": "client = SimpleActionClient()", "type": "assigned_variable", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [14, 2, 0.8618, 0.0046, 2, 0.14, 0.0769, 608, 3, 2, 0, 0, 230, 10, 1], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "SimpleActionClient", "annotation": ""}, "snippet": " client = actionlib.SimpleActionClient( 'move_base', MoveBaseAction )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L188_C8", "label": "wait_for_server()", "type": "expression", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [8, 2, 0.8664, 0.0046, 2, 0.14, 0.1538, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_server", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_server", "annotation": ""}, "snippet": " client.wait_for_server()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L190_C8", "label": "ps = PoseStamped()", "type": "assigned_variable", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [14, 2, 0.8756, 0.0046, 2, 0.14, 0.2308, 232, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "ps", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " ps = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L191_C8", "label": "ps.header.frame_id =", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [14, 2, 0.8802, 0.0046, 2, 0.14, 0.3077, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ps.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.header.frame_id = '/map'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L192_C8", "label": "ps.header.stamp = Time()", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [14, 2, 0.8848, 0.0046, 2, 0.14, 0.3846, 161, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "ps.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " ps.header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L193_C8", "label": "ps.pose.position.x =", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [14, 2, 0.8894, 0.0046, 2, 0.14, 0.4615, 782, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps.pose.position.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.pose.position.x = request.x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L194_C8", "label": "ps.pose.position.y =", "type": "assigned_variable", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [14, 2, 0.894, 0.0046, 2, 0.14, 0.5385, 661, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps.pose.position.y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps.pose.position.y = request.y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L195_C8", "label": "ps.pose.orientation = Quaternion()", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [14, 2, 0.8986, 0.0046, 2, 0.14, 0.6154, 670, 3, 1, 0, 0, 747, 10, 2], "semantic": {"name": "ps.pose.orientation", "arg_names": [], "import_names": [], "rhs_call_name": "Quaternion", "annotation": ""}, "snippet": " ps.pose.orientation = Quaternion( *tft.quaternion_from_euler( 0.0, 0.0, request.ang ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L197_C8", "label": "goal = MoveBaseGoal()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [14, 2, 0.9078, 0.0046, 2, 0.14, 0.6923, 914, 3, 1, 0, 0, 968, 10, 1], "semantic": {"name": "goal", "arg_names": [], "import_names": [], "rhs_call_name": "MoveBaseGoal", "annotation": ""}, "snippet": " goal = MoveBaseGoal( ps )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L198_C8", "label": "send_goal()", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [8, 2, 0.9124, 0.0046, 2, 0.14, 0.7692, 184, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_goal", "arg_names": [], "import_names": [], "rhs_call_name": "send_goal", "annotation": ""}, "snippet": " client.send_goal( goal )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L199_C8", "label": "logout()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [8, 2, 0.9171, 0.0046, 2, 0.14, 0.8462, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup: Waiting for base to stop moving.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L200_C8", "label": "wait_for_result()", "type": "expression", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [8, 2, 0.9217, 0.0046, 2, 0.14, 0.9231, 328, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_result", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_result", "annotation": ""}, "snippet": " client.wait_for_result()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L201_C8", "label": "return", "type": "return", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "vector": [13, 2, 0.9263, 0.0046, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L204_C0", "label": "RotateBackupClient", "type": "class", "loc": [204, 213], "level": 0, "parent": null, "vector": [3, 0, 0.9608, 0.0461, 0, 0.66, 0.9697, 481, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "RotateBackupClient", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RotateBackupClient():\n def __init__( self, service_name = '/rotate_backup' ):\n rospy.logout( 'rotate_backup_client: Waiting for service: \\'%s\\'' % service_name )\n rospy.wait_for_service( service_name )\n rospy.logout( 'rotate_backup_client: Service ready.' )\n \n self._rb_service = rospy.ServiceProxy( service_name, FloatFloat_Int32 )\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "label": "__init__", "type": "function", "loc": [205, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L204_C0", "vector": [2, 1, 0.9562, 0.0276, 1, 0.32, 0.0, 555, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "service_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, service_name = '/rotate_backup' ):\n rospy.logout( 'rotate_backup_client: Waiting for service: \\'%s\\'' % service_name )\n rospy.wait_for_service( service_name )\n rospy.logout( 'rotate_backup_client: Service ready.' )\n \n self._rb_service = rospy.ServiceProxy( service_name, FloatFloat_Int32 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L206_C8", "label": "logout()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "vector": [8, 2, 0.9493, 0.0046, 2, 0.69, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup_client: Waiting for service: \\'%s\\'' % service_name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L207_C8", "label": "wait_for_service()", "type": "expression", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "vector": [8, 2, 0.9539, 0.0046, 2, 0.69, 0.3333, 617, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service( service_name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L208_C8", "label": "logout()", "type": "expression", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "vector": [8, 2, 0.9585, 0.0046, 2, 0.69, 0.6667, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rotate_backup_client: Service ready.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L210_C8", "label": "self._rb_service = ServiceProxy()", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "vector": [14, 2, 0.9677, 0.0046, 2, 0.69, 1.0, 700, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self._rb_service", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self._rb_service = rospy.ServiceProxy( service_name, FloatFloat_Int32 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L212_C4", "label": "rotate_backup", "type": "function", "loc": [212, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L204_C0", "vector": [2, 1, 0.9793, 0.0092, 1, 0.32, 1.0, 878, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "rotate_backup", "arg_names": ["self", "rotate", "displace"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rotate_backup( self, rotate, displace ):\n return self._rb_service( rotate, displace )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L213_C8", "label": "return", "type": "return", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L212_C4", "vector": [13, 2, 0.9816, 0.0046, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._rb_service( rotate, displace )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L215_C0", "label": "if", "type": "if", "loc": [215, 217], "level": 0, "parent": null, "vector": [4, 0, 0.9954, 0.0138, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n rb = RotateBackup()\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L216_C4", "label": "rb = RotateBackup()", "type": "assigned_variable", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L215_C0", "vector": [14, 1, 0.9954, 0.0046, 1, 0.06, 0.0, 815, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "rb", "arg_names": [], "import_names": [], "rhs_call_name": "RotateBackup", "annotation": ""}, "snippet": " rb = RotateBackup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L217_C4", "label": "spin()", "type": "expression", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L215_C0", "vector": [8, 1, 1.0, 0.0046, 1, 0.06, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L74_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L75_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L74_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L76_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:While_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:Try_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:FunctionDef_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Return_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L215_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Assign_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99432:If_L215_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99432:Expr_L217_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('pr2_msgs')
roslib.load_manifest('std_msgs')
import rospy
from pr2_msgs.msg import PressureState
from std_msgs.msg import Float64
from rfid_behaviors.srv import FloatFloat_Int32
import numpy as np, math
import time, string
def default_mag_func( x ):
return np.sum( np.abs( x ))
class TactileSensor( ):
def __init__( self, topic = '/pressure/r_gripper_motor',
mag_func = default_mag_func ):
rospy.logout( 'tactile_sensor: Initializing' )
try:
rospy.init_node( 'tactile_sensor' )
except:
pass
self.mag_func = mag_func
self.left = None
self.right = None
self.l_bias = None
self.r_bias = None
self.topic = topic
self.pub = rospy.Publisher( '/readings/' + string.replace(topic,'/','_') + '_mag', Float64 )
self.service = rospy.Service( '/readings/' + string.replace(topic,'/','_') + '_serv',
FloatFloat_Int32,
self.thresh_service )
self.reg_sensor( )
while self.left == None or self.right == None:
time.sleep( 0.1 )
self.unreg_sensor()
rospy.logout( 'tactile_sensor: Ready' )
def reg_sensor( self ):
self.sub = rospy.Subscriber( self.topic, PressureState, self.cb )
time.sleep( 0.3 )
def unreg_sensor( self ):
self.sub.unregister()
def cb( self, msg ):
self.left = np.array( list( msg.l_finger_tip ), dtype=float )
self.right = np.array( list( msg.r_finger_tip ), dtype=float )
if self.l_bias == None or self.r_bias == None:
self.l_bias = np.zeros( len( self.left ))
self.r_bias = np.zeros( len( self.right ))
self.l_read = np.copy( self.left - self.l_bias )
self.r_read = np.copy( self.right - self.r_bias )
self.mag = self.mag_func( np.append( self.l_read, self.r_read ))
#print np.append( self.l_read, self.r_read )
self.pub.publish( self.mag )
def bias( self ):
self.reg_sensor()
rospy.logout( 'tactile_sensor: Biasing' )
self.l_bias = np.copy( self.left )
self.r_bias = np.copy( self.right )
self.unreg_sensor()
return True
def read( self ):
return np.copy( self.l_read ), np.copy( self.r_read )
def thresh_service( self, request ):
self.thresh_detect( request.rotate, request.displace ) # yeah, jacked up names
return int( True )
def thresh_detect( self, threshold, timeout = 100.0 ):
rospy.logout( 'tactile_sensor: Threshold detector activated: %3.2f, timeout: %d' % (threshold, timeout))
self.bias()
self.reg_sensor()
t0 = time.time()
t_diff = time.time() - t0
lp = t0 # Printing status messages
while self.mag < threshold and t_diff < timeout:
if time.time() - lp > 1.0:
lp = time.time()
rospy.logout( 'tactile_sensor: Threshold still undetected' )
time.sleep( 0.05 )
t_diff = time.time() - t0
self.unreg_sensor()
rospy.logout( 'tactile_sensor: Detected (or timeout)' )
return self.mag
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('-r', '--right', action='store_true', dest='right', default=False,
help='Right finger')
p.add_option('-l', '--left', action='store_true', dest='left', default=False,
help='left finger')
opt, args = p.parse_args()
if opt.right:
r_tact = TactileSensor('/pressure/r_gripper_motor')
if opt.left:
l_tact = TactileSensor('/pressure/l_gripper_motor')
rospy.spin()
# print 'Reading: ', r_tact.read()
# raw_input('Hit [ENTER]')
# r_tact.bias()
# time.sleep(3.0)
# print 'Reading: ', r_tact.read()
# raw_input('Hit [ENTER]')
# print 'COMBINED:', np.append( *r_tact.read() )
# print 'ERR:', np.sum(np.abs( np.append( *r_tact.read() )))
# print 'Waiting for thresh'
# r_tact.thresh_detect( 5000 )
| ajibawa-2023/Python-Code-Large/train/row_99433 | 84 | 136 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0147, 0.0074, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0221, 0.0074, 0, 0.66, 0.0833, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0294, 0.0074, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('pr2_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0368, 0.0074, 0, 0.66, 0.25, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('std_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Import_L6_C0", "label": "rospy import rospy", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0441, 0.0074, 0, 0.66, 0.3333, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:ImportFrom_L8_C0", "label": "from pr2_msgs.msg import PressureState", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0074, 0, 0.66, 0.4167, 797, 0, 1, 0, 0, 797, 0, 0], "semantic": {"name": "pr2_msgs.msg", "arg_names": [], "import_names": ["PressureState"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pr2_msgs.msg import PressureState"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:ImportFrom_L9_C0", "label": "from std_msgs.msg import Float64", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0662, 0.0074, 0, 0.66, 0.5, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Float64"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Float64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:ImportFrom_L10_C0", "label": "from rfid_behaviors.srv import FloatFloat_Int32", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0735, 0.0074, 0, 0.66, 0.5833, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["FloatFloat_Int32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import FloatFloat_Int32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Import_L12_C0", "label": "numpy import np, math", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0882, 0.0074, 0, 0.66, 0.6667, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Import_L13_C0", "label": "time import time, string", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0956, 0.0074, 0, 0.66, 0.75, 654, 0, 2, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time", "string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time, string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L15_C0", "label": "default_mag_func", "type": "function", "loc": [15, 16], "level": 0, "parent": null, "vector": [2, 0, 0.114, 0.0147, 0, 0.66, 0.8333, 9, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "default_mag_func", "arg_names": ["x"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def default_mag_func( x ):\n return np.sum( np.abs( x ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L16_C4", "label": "return", "type": "return", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L15_C0", "vector": [13, 1, 0.1176, 0.0074, 1, 0.45, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.sum( np.abs( x ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "label": "TactileSensor", "type": "class", "loc": [18, 102], "level": 0, "parent": null, "vector": [3, 0, 0.4412, 0.625, 0, 0.66, 0.9167, 495, 0, 8, 0, 0, 0, 0, 47], "semantic": {"name": "TactileSensor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TactileSensor( ):\n def __init__( self, topic = '/pressure/r_gripper_motor', \n mag_func = default_mag_func ):\n rospy.logout( 'tactile_sensor: Initializing' )\n try:\n rospy.init_node( 'tactile_sensor' )\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "label": "__init__", "type": "function", "loc": [19, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "vector": [2, 1, 0.2353, 0.1985, 1, 0.09, 0.0, 555, 0, 3, 0, 0, 0, 0, 10], "semantic": {"name": "__init__", "arg_names": ["self", "topic", "mag_func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, topic = '/pressure/r_gripper_motor', \n mag_func = default_mag_func ):\n rospy.logout( 'tactile_sensor: Initializing' )\n try:\n rospy.init_node( 'tactile_sensor' )\n except:\n pass\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L21_C8", "label": "logout()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [8, 2, 0.1544, 0.0074, 2, 0.24, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'tactile_sensor: Initializing' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Try_L22_C8", "label": "try", "type": "try", "loc": [22, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [7, 2, 0.1728, 0.0294, 2, 0.24, 0.0769, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node( 'tactile_sensor' )\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L23_C12", "label": "init_node()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:Try_L22_C8", "vector": [8, 3, 0.1691, 0.0074, 3, 0.13, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'tactile_sensor' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L27_C8", "label": "self.mag_func =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [14, 2, 0.1985, 0.0074, 2, 0.24, 0.1538, 803, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mag_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mag_func = mag_func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L28_C8", "label": "self.left =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [14, 2, 0.2059, 0.0074, 2, 0.24, 0.2308, 643, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.left", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.left = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L29_C8", "label": "self.right =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [14, 2, 0.2132, 0.0074, 2, 0.24, 0.3077, 683, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.right", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.right = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L30_C8", "label": "self.l_bias =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [14, 2, 0.2206, 0.0074, 2, 0.24, 0.3846, 421, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.l_bias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.l_bias = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L31_C8", "label": "self.r_bias =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [14, 2, 0.2279, 0.0074, 2, 0.24, 0.4615, 343, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.r_bias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.r_bias = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L32_C8", "label": "self.topic =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [14, 2, 0.2353, 0.0074, 2, 0.24, 0.5385, 928, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.topic", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.topic = topic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L34_C8", "label": "self.pub = Publisher()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [14, 2, 0.25, 0.0074, 2, 0.24, 0.6154, 86, 3, 2, 0, 0, 45, 10, 2], "semantic": {"name": "self.pub", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.pub = rospy.Publisher( '/readings/' + string.replace(topic,'/','_') + '_mag', Float64 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L35_C8", "label": "self.service = Service()", "type": "assigned_variable", "loc": [35, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [14, 2, 0.2647, 0.0221, 2, 0.24, 0.6923, 457, 3, 3, 0, 0, 451, 10, 2], "semantic": {"name": "self.service", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self.service = rospy.Service( '/readings/' + string.replace(topic,'/','_') + '_serv', \n FloatFloat_Int32, \n self.thresh_service )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L38_C8", "label": "reg_sensor()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [8, 2, 0.2794, 0.0074, 2, 0.24, 0.7692, 443, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reg_sensor", "arg_names": [], "import_names": [], "rhs_call_name": "reg_sensor", "annotation": ""}, "snippet": " self.reg_sensor( )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L40_C8", "label": "while", "type": "while", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [5, 2, 0.2978, 0.0147, 2, 0.24, 0.8462, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.left == None or self.right == None:\n time.sleep( 0.1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L41_C12", "label": "sleep()", "type": "expression", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L40_C8", "vector": [8, 3, 0.3015, 0.0074, 3, 0.72, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 0.1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L43_C8", "label": "unreg_sensor()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [8, 2, 0.3162, 0.0074, 2, 0.24, 0.9231, 809, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unreg_sensor", "arg_names": [], "import_names": [], "rhs_call_name": "unreg_sensor", "annotation": ""}, "snippet": " self.unreg_sensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L45_C8", "label": "logout()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "vector": [8, 2, 0.3309, 0.0074, 2, 0.24, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'tactile_sensor: Ready' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L48_C4", "label": "reg_sensor", "type": "function", "loc": [48, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "vector": [2, 1, 0.3603, 0.0221, 1, 0.09, 0.1429, 443, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "reg_sensor", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reg_sensor( self ):\n self.sub = rospy.Subscriber( self.topic, PressureState, self.cb )\n time.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L49_C8", "label": "self.sub = Subscriber()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L48_C4", "vector": [14, 2, 0.3603, 0.0074, 2, 0.07, 0.0, 88, 3, 3, 0, 0, 455, 10, 1], "semantic": {"name": "self.sub", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " self.sub = rospy.Subscriber( self.topic, PressureState, self.cb )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L50_C8", "label": "sleep()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L48_C4", "vector": [8, 2, 0.3676, 0.0074, 2, 0.07, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L52_C4", "label": "unreg_sensor", "type": "function", "loc": [52, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "vector": [2, 1, 0.386, 0.0147, 1, 0.09, 0.2857, 809, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unreg_sensor", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unreg_sensor( self ):\n self.sub.unregister()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L53_C8", "label": "unregister()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L52_C4", "vector": [8, 2, 0.3897, 0.0074, 2, 0.61, 0.0, 614, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unregister", "arg_names": [], "import_names": [], "rhs_call_name": "unregister", "annotation": ""}, "snippet": " self.sub.unregister()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "label": "cb", "type": "function", "loc": [56, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "vector": [2, 1, 0.4596, 0.1029, 1, 0.09, 0.4286, 540, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "cb", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cb( self, msg ):\n self.left = np.array( list( msg.l_finger_tip ), dtype=float )\n self.right = np.array( list( msg.r_finger_tip ), dtype=float )\n\n if self.l_bias == None or self.r_bias == None:\n self.l_bias = np.zeros( len( self.left ))\n self.r_bias = np.zeros( len( self.right ))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L57_C8", "label": "self.left = array()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "vector": [14, 2, 0.4191, 0.0074, 2, 0.75, 0.0, 643, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "self.left", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " self.left = np.array( list( msg.l_finger_tip ), dtype=float )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L58_C8", "label": "self.right = array()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "vector": [14, 2, 0.4265, 0.0074, 2, 0.75, 0.1667, 683, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "self.right", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " self.right = np.array( list( msg.r_finger_tip ), dtype=float )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L60_C8", "label": "if", "type": "if", "loc": [60, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "vector": [4, 2, 0.4485, 0.0221, 2, 0.75, 0.3333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.l_bias == None or self.r_bias == None:\n self.l_bias = np.zeros( len( self.left ))\n self.r_bias = np.zeros( len( self.right ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L61_C12", "label": "self.l_bias = zeros()", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L60_C8", "vector": [14, 3, 0.4485, 0.0074, 3, 0.89, 0.0, 421, 3, 1, 0, 0, 213, 10, 2], "semantic": {"name": "self.l_bias", "arg_names": [], "import_names": [], "rhs_call_name": "zeros", "annotation": ""}, "snippet": " self.l_bias = np.zeros( len( self.left ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L62_C12", "label": "self.r_bias = zeros()", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L60_C8", "vector": [14, 3, 0.4559, 0.0074, 3, 0.89, 1.0, 343, 3, 1, 0, 0, 213, 10, 2], "semantic": {"name": "self.r_bias", "arg_names": [], "import_names": [], "rhs_call_name": "zeros", "annotation": ""}, "snippet": " self.r_bias = np.zeros( len( self.right ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L64_C8", "label": "self.l_read = copy()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "vector": [14, 2, 0.4706, 0.0074, 2, 0.75, 0.5, 993, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "self.l_read", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self.l_read = np.copy( self.left - self.l_bias )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L65_C8", "label": "self.r_read = copy()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "vector": [14, 2, 0.4779, 0.0074, 2, 0.75, 0.6667, 617, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "self.r_read", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self.r_read = np.copy( self.right - self.r_bias )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L67_C8", "label": "self.mag = mag_func()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "vector": [14, 2, 0.4926, 0.0074, 2, 0.75, 0.8333, 477, 3, 1, 0, 0, 22, 10, 2], "semantic": {"name": "self.mag", "arg_names": [], "import_names": [], "rhs_call_name": "mag_func", "annotation": ""}, "snippet": " self.mag = self.mag_func( np.append( self.l_read, self.r_read ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L69_C8", "label": "publish()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "vector": [8, 2, 0.5074, 0.0074, 2, 0.75, 1.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub.publish( self.mag )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "label": "bias", "type": "function", "loc": [72, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "vector": [2, 1, 0.5515, 0.0515, 1, 0.09, 0.5714, 354, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "bias", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def bias( self ):\n self.reg_sensor()\n rospy.logout( 'tactile_sensor: Biasing' )\n self.l_bias = np.copy( self.left )\n self.r_bias = np.copy( self.right )\n self.unreg_sensor()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L73_C8", "label": "reg_sensor()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "vector": [8, 2, 0.5368, 0.0074, 2, 0.63, 0.0, 443, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reg_sensor", "arg_names": [], "import_names": [], "rhs_call_name": "reg_sensor", "annotation": ""}, "snippet": " self.reg_sensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L74_C8", "label": "logout()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "vector": [8, 2, 0.5441, 0.0074, 2, 0.63, 0.2, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'tactile_sensor: Biasing' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L75_C8", "label": "self.l_bias = copy()", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "vector": [14, 2, 0.5515, 0.0074, 2, 0.63, 0.4, 421, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "self.l_bias", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self.l_bias = np.copy( self.left )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L76_C8", "label": "self.r_bias = copy()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "vector": [14, 2, 0.5588, 0.0074, 2, 0.63, 0.6, 343, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "self.r_bias", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self.r_bias = np.copy( self.right )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L77_C8", "label": "unreg_sensor()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "vector": [8, 2, 0.5662, 0.0074, 2, 0.63, 0.8, 809, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unreg_sensor", "arg_names": [], "import_names": [], "rhs_call_name": "unreg_sensor", "annotation": ""}, "snippet": " self.unreg_sensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L78_C8", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "vector": [13, 2, 0.5735, 0.0074, 2, 0.63, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L80_C4", "label": "read", "type": "function", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "vector": [2, 1, 0.5919, 0.0147, 1, 0.09, 0.7143, 453, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read( self ):\n return np.copy( self.l_read ), np.copy( self.r_read )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L81_C8", "label": "return", "type": "return", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L80_C4", "vector": [13, 2, 0.5956, 0.0074, 2, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.copy( self.l_read ), np.copy( self.r_read )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L83_C4", "label": "thresh_service", "type": "function", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "vector": [2, 1, 0.6176, 0.0221, 1, 0.09, 0.8571, 84, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "thresh_service", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def thresh_service( self, request ):\n self.thresh_detect( request.rotate, request.displace ) # yeah, jacked up names\n return int( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L84_C8", "label": "thresh_detect()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L83_C4", "vector": [8, 2, 0.6176, 0.0074, 2, 0.61, 0.0, 233, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "thresh_detect", "arg_names": [], "import_names": [], "rhs_call_name": "thresh_detect", "annotation": ""}, "snippet": " self.thresh_detect( request.rotate, request.displace ) # yeah, jacked up names"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L83_C4", "vector": [13, 2, 0.625, 0.0074, 2, 0.61, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int( True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "label": "thresh_detect", "type": "function", "loc": [87, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "vector": [2, 1, 0.6949, 0.1176, 1, 0.09, 1.0, 233, 0, 3, 1, 0, 0, 0, 12], "semantic": {"name": "thresh_detect", "arg_names": ["self", "threshold", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def thresh_detect( self, threshold, timeout = 100.0 ):\n rospy.logout( 'tactile_sensor: Threshold detector activated: %3.2f, timeout: %d' % (threshold, timeout))\n self.bias()\n self.reg_sensor()\n t0 = time.time()\n t_diff = time.time() - t0\n lp = t0 # Printing status messages\n while self.mag < threshold and t_diff < timeout:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L88_C8", "label": "logout()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [8, 2, 0.6471, 0.0074, 2, 0.93, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'tactile_sensor: Threshold detector activated: %3.2f, timeout: %d' % (threshold, timeout))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L89_C8", "label": "bias()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [8, 2, 0.6544, 0.0074, 2, 0.93, 0.1111, 354, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bias", "arg_names": [], "import_names": [], "rhs_call_name": "bias", "annotation": ""}, "snippet": " self.bias()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L90_C8", "label": "reg_sensor()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [8, 2, 0.6618, 0.0074, 2, 0.93, 0.2222, 443, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reg_sensor", "arg_names": [], "import_names": [], "rhs_call_name": "reg_sensor", "annotation": ""}, "snippet": " self.reg_sensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L91_C8", "label": "t0 = time()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [14, 2, 0.6691, 0.0074, 2, 0.93, 0.3333, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L92_C8", "label": "t_diff =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [14, 2, 0.6765, 0.0074, 2, 0.93, 0.4444, 435, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t_diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_diff = time.time() - t0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L93_C8", "label": "lp =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [14, 2, 0.6838, 0.0074, 2, 0.93, 0.5556, 721, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lp = t0 # Printing status messages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L94_C8", "label": "while", "type": "while", "loc": [94, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [5, 2, 0.7096, 0.0441, 2, 0.93, 0.6667, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.mag < threshold and t_diff < timeout:\n if time.time() - lp > 1.0:\n lp = time.time()\n rospy.logout( 'tactile_sensor: Threshold still undetected' )\n time.sleep( 0.05 )\n t_diff = time.time() - t0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L95_C12", "label": "if", "type": "if", "loc": [95, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L94_C8", "vector": [4, 3, 0.7059, 0.0221, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if time.time() - lp > 1.0:\n lp = time.time()\n rospy.logout( 'tactile_sensor: Threshold still undetected' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L96_C16", "label": "lp = time()", "type": "assigned_variable", "loc": [96, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L95_C12", "vector": [14, 4, 0.7059, 0.0074, 4, 0.99, 0.0, 721, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "lp", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " lp = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L97_C16", "label": "logout()", "type": "expression", "loc": [97, 97], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L95_C12", "vector": [8, 4, 0.7132, 0.0074, 4, 0.99, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'tactile_sensor: Threshold still undetected' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L98_C12", "label": "sleep()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L94_C8", "vector": [8, 3, 0.7206, 0.0074, 3, 0.6, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 0.05 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L99_C12", "label": "t_diff =", "type": "assigned_variable", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L94_C8", "vector": [14, 3, 0.7279, 0.0074, 3, 0.6, 1.0, 435, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t_diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_diff = time.time() - t0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L100_C8", "label": "unreg_sensor()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [8, 2, 0.7353, 0.0074, 2, 0.93, 0.7778, 809, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unreg_sensor", "arg_names": [], "import_names": [], "rhs_call_name": "unreg_sensor", "annotation": ""}, "snippet": " self.unreg_sensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L101_C8", "label": "logout()", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [8, 2, 0.7426, 0.0074, 2, 0.93, 0.8889, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'tactile_sensor: Detected (or timeout)' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L102_C8", "label": "return", "type": "return", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "vector": [13, 2, 0.75, 0.0074, 2, 0.93, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.mag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "label": "if", "type": "if", "loc": [104, 118], "level": 0, "parent": null, "vector": [4, 0, 0.8162, 0.1103, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('-r', '--right', action='store_true', dest='right', default=False,\n help='Right finger')\n p.add_option('-l', '--left', action='store_true', dest='left', default=False,\n help='left finger')\n opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Import_L105_C4", "label": "optparse import optparse", "type": "import", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "vector": [1, 1, 0.7721, 0.0074, 1, 0.53, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L106_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "vector": [14, 1, 0.7794, 0.0074, 1, 0.53, 0.1429, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L107_C4", "label": "add_option()", "type": "expression", "loc": [107, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "vector": [8, 1, 0.7904, 0.0147, 1, 0.53, 0.2857, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-r', '--right', action='store_true', dest='right', default=False,\n help='Right finger')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L109_C4", "label": "add_option()", "type": "expression", "loc": [109, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "vector": [8, 1, 0.8051, 0.0147, 1, 0.53, 0.4286, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-l', '--left', action='store_true', dest='left', default=False,\n help='left finger')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L111_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "vector": [14, 1, 0.8162, 0.0074, 1, 0.53, 0.5714, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L113_C4", "label": "if", "type": "if", "loc": [113, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "vector": [4, 1, 0.8346, 0.0147, 1, 0.53, 0.7143, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.right:\n r_tact = TactileSensor('/pressure/r_gripper_motor')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L114_C8", "label": "r_tact = TactileSensor()", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L113_C4", "vector": [14, 2, 0.8382, 0.0074, 2, 0.74, 0.0, 353, 3, 1, 0, 0, 495, 10, 1], "semantic": {"name": "r_tact", "arg_names": [], "import_names": [], "rhs_call_name": "TactileSensor", "annotation": ""}, "snippet": " r_tact = TactileSensor('/pressure/r_gripper_motor')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L115_C4", "label": "if", "type": "if", "loc": [115, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "vector": [4, 1, 0.8493, 0.0147, 1, 0.53, 0.8571, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.left:\n l_tact = TactileSensor('/pressure/l_gripper_motor')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L116_C8", "label": "l_tact = TactileSensor()", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L115_C4", "vector": [14, 2, 0.8529, 0.0074, 2, 0.13, 0.0, 215, 3, 1, 0, 0, 495, 10, 1], "semantic": {"name": "l_tact", "arg_names": [], "import_names": [], "rhs_call_name": "TactileSensor", "annotation": ""}, "snippet": " l_tact = TactileSensor('/pressure/l_gripper_motor')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L118_C4", "label": "spin()", "type": "expression", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "vector": [8, 1, 0.8676, 0.0074, 1, 0.53, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Try_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:Try_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L40_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L96_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L97_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:While_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Return_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Import_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99433:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99433:Expr_L118_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('rfid_behaviors')
import rospy
from rfid_behaviors.srv import FlapEarsSrv, FlapperSrv
from threading import Thread
# All this guy does is call flap repeatedly until receiving a stop signal.
class Flapper( Thread ):
def __init__( self, serv_name = 'rfid_orient/flap' ):
Thread.__init__( self )
self.should_run = True
self.should_flap = False
self.tagid = ''
rospy.logout( 'flapper: initializing' )
try:
rospy.init_node('flapper_py')
except:
pass
rospy.wait_for_service( serv_name )
self.flap = rospy.ServiceProxy( '/rfid_orient/flap', FlapEarsSrv )
self._service = rospy.Service( '/flapper/flap',
FlapperSrv,
self.process_service )
rospy.logout( 'flapper: ready' )
self.start()
def run( self ):
rospy.logout( 'flapper: running' )
r = rospy.Rate( 10 )
while self.should_run and not rospy.is_shutdown():
if self.should_flap:
self.flap( self.tagid, 0.0 )
r.sleep()
rospy.logout( 'flapper: exiting' )
def stop( self ):
self.should_run = False
self.join(3)
if (self.isAlive()):
raise RuntimeError("ROS_M5e: unable to stop thread")
def process_service( self, req ):
self.tagid = req.tagid
self.should_flap = not self.should_flap
return True
if __name__ == '__main__':
fl = Flapper()
rospy.spin()
| ajibawa-2023/Python-Code-Large/train/row_99434 | 38 | 59 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0339, 0.0169, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0508, 0.0169, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Import_L4_C0", "label": "rospy import rospy", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0678, 0.0169, 0, 0.66, 0.3333, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:ImportFrom_L6_C0", "label": "from rfid_behaviors.srv import FlapEarsSrv, FlapperSrv", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1017, 0.0169, 0, 0.66, 0.5, 647, 0, 2, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["FlapEarsSrv", "FlapperSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import FlapEarsSrv, FlapperSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:ImportFrom_L8_C0", "label": "from threading import Thread", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1356, 0.0169, 0, 0.66, 0.6667, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "label": "Flapper", "type": "class", "loc": [12, 55], "level": 0, "parent": null, "vector": [3, 0, 0.5678, 0.7458, 0, 0.66, 0.8333, 540, 0, 4, 0, 0, 134, 0, 17], "semantic": {"name": "Flapper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Flapper( Thread ):\n def __init__( self, serv_name = 'rfid_orient/flap' ):\n Thread.__init__( self )\n self.should_run = True\n\n self.should_flap = False\n self.tagid = ''\n rospy.logout( 'flapper: initializing' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "label": "__init__", "type": "function", "loc": [13, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "vector": [2, 1, 0.3983, 0.3729, 1, 0.02, 0.0, 555, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "__init__", "arg_names": ["self", "serv_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, serv_name = 'rfid_orient/flap' ):\n Thread.__init__( self )\n self.should_run = True\n\n self.should_flap = False\n self.tagid = ''\n rospy.logout( 'flapper: initializing' )\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L14_C8", "label": "__init__()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [8, 2, 0.2373, 0.0169, 2, 0.84, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Thread.__init__( self )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L15_C8", "label": "self.should_run =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [14, 2, 0.2542, 0.0169, 2, 0.84, 0.1, 736, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_run", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_run = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L17_C8", "label": "self.should_flap =", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [14, 2, 0.2881, 0.0169, 2, 0.84, 0.2, 547, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_flap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_flap = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L18_C8", "label": "self.tagid =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [14, 2, 0.3051, 0.0169, 2, 0.84, 0.3, 251, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tagid = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L19_C8", "label": "logout()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [8, 2, 0.322, 0.0169, 2, 0.84, 0.4, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'flapper: initializing' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Try_L20_C8", "label": "try", "type": "try", "loc": [20, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [7, 2, 0.3644, 0.0678, 2, 0.84, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node('flapper_py')\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L21_C12", "label": "init_node()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:Try_L20_C8", "vector": [8, 3, 0.3559, 0.0169, 3, 0.87, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('flapper_py')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L25_C8", "label": "wait_for_service()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [8, 2, 0.4237, 0.0169, 2, 0.84, 0.6, 617, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service( serv_name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L27_C8", "label": "self.flap = ServiceProxy()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [14, 2, 0.4576, 0.0169, 2, 0.84, 0.7, 124, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self.flap", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self.flap = rospy.ServiceProxy( '/rfid_orient/flap', FlapEarsSrv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L29_C8", "label": "self._service = Service()", "type": "assigned_variable", "loc": [29, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [14, 2, 0.5085, 0.0508, 2, 0.84, 0.8, 143, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._service", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._service = rospy.Service( '/flapper/flap',\n FlapperSrv,\n self.process_service )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L33_C8", "label": "logout()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [8, 2, 0.5593, 0.0169, 2, 0.84, 0.9, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'flapper: ready' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L34_C8", "label": "start()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "vector": [8, 2, 0.5763, 0.0169, 2, 0.84, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "label": "run", "type": "function", "loc": [36, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "vector": [2, 1, 0.6695, 0.1356, 1, 0.02, 0.3333, 679, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run( self ):\n rospy.logout( 'flapper: running' )\n r = rospy.Rate( 10 )\n while self.should_run and not rospy.is_shutdown():\n if self.should_flap:\n self.flap( self.tagid, 0.0 )\n r.sleep()\n rospy.logout( 'flapper: exiting' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L37_C8", "label": "logout()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "vector": [8, 2, 0.6271, 0.0169, 2, 0.33, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'flapper: running' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L38_C8", "label": "r = Rate()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "vector": [14, 2, 0.6441, 0.0169, 2, 0.33, 0.3333, 436, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "Rate", "annotation": ""}, "snippet": " r = rospy.Rate( 10 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:While_L39_C8", "label": "while", "type": "while", "loc": [39, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "vector": [5, 2, 0.6864, 0.0678, 2, 0.33, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.should_run and not rospy.is_shutdown():\n if self.should_flap:\n self.flap( self.tagid, 0.0 )\n r.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L40_C12", "label": "if", "type": "if", "loc": [40, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:While_L39_C8", "vector": [4, 3, 0.6864, 0.0339, 3, 0.19, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.should_flap:\n self.flap( self.tagid, 0.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L41_C16", "label": "flap()", "type": "expression", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L40_C12", "vector": [8, 4, 0.6949, 0.0169, 4, 0.43, 0.0, 845, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "flap", "arg_names": [], "import_names": [], "rhs_call_name": "flap", "annotation": ""}, "snippet": " self.flap( self.tagid, 0.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L42_C12", "label": "sleep()", "type": "expression", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:While_L39_C8", "vector": [8, 3, 0.7119, 0.0169, 3, 0.19, 1.0, 476, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " r.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L43_C8", "label": "logout()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "vector": [8, 2, 0.7288, 0.0169, 2, 0.33, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'flapper: exiting' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L45_C4", "label": "stop", "type": "function", "loc": [45, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "vector": [2, 1, 0.7966, 0.0847, 1, 0.02, 0.6667, 343, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop( self ):\n self.should_run = False\n self.join(3)\n if (self.isAlive()):\n raise RuntimeError(\"ROS_M5e: unable to stop thread\") "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L46_C8", "label": "self.should_run =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L45_C4", "vector": [14, 2, 0.7797, 0.0169, 2, 0.75, 0.0, 736, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_run", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_run = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L47_C8", "label": "join()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L45_C4", "vector": [8, 2, 0.7966, 0.0169, 2, 0.75, 0.5, 933, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " self.join(3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L48_C8", "label": "if", "type": "if", "loc": [48, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L45_C4", "vector": [4, 2, 0.822, 0.0339, 2, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.isAlive()):\n raise RuntimeError(\"ROS_M5e: unable to stop thread\") "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L52_C4", "label": "process_service", "type": "function", "loc": [52, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "vector": [2, 1, 0.9068, 0.0678, 1, 0.02, 1.0, 430, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "process_service", "arg_names": ["self", "req"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_service( self, req ):\n self.tagid = req.tagid\n self.should_flap = not self.should_flap\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L53_C8", "label": "self.tagid =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L52_C4", "vector": [14, 2, 0.8983, 0.0169, 2, 0.45, 0.0, 251, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tagid = req.tagid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L54_C8", "label": "self.should_flap =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L52_C4", "vector": [14, 2, 0.9153, 0.0169, 2, 0.45, 0.5, 547, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.should_flap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_flap = not self.should_flap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L52_C4", "vector": [13, 2, 0.9322, 0.0169, 2, 0.45, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L57_C0", "label": "if", "type": "if", "loc": [57, 59], "level": 0, "parent": null, "vector": [4, 0, 0.9831, 0.0508, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n fl = Flapper()\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L58_C4", "label": "fl = Flapper()", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L57_C0", "vector": [14, 1, 0.9831, 0.0169, 1, 0.36, 0.0, 44, 3, 0, 0, 0, 540, 10, 1], "semantic": {"name": "fl", "arg_names": [], "import_names": [], "rhs_call_name": "Flapper", "annotation": ""}, "snippet": " fl = Flapper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L59_C4", "label": "spin()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L57_C0", "vector": [8, 1, 1.0, 0.0169, 1, 0.36, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Try_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:While_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:While_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:While_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99434:If_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99434:Expr_L59_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('rfid_behaviors')
import rospy
import tf
from rfid_behaviors.srv import RecorderSrv, RecorderSrvResponse
from rfid_behaviors.srv import NextBestVantage
from rfid_behaviors.msg import RecorderReads
import hrl_rfid.ros_M5e_client as rmc
from geometry_msgs.msg import PoseStamped
import numpy as np, math
class Recorder( ):
def __init__( self, serv_name = 'rfid_recorder', node_name = 'rfid_recorder_py' ):
rospy.logout( 'rfid_recorder: initializing' )
try:
rospy.init_node(node_name)
except:
pass
self.should_rec = False
self._servrec = rospy.Service( serv_name + '/record',
RecorderSrv,
self.process_service )
self._servbest = rospy.Service( serv_name + '/best_vantage',
NextBestVantage,
self.bestvantage )
self.listener = tf.TransformListener()
rospy.logout( 'RFID Recorder: Waiting on transforms' )
self.listener.waitForTransform('/ear_antenna_left', '/map',
rospy.Time(0), timeout = rospy.Duration(100) )
self.listener.waitForTransform('/ear_antenna_right', '/map',
rospy.Time(0), timeout = rospy.Duration(100) )
rospy.logout( 'rfid_recorder: ready' )
def process_service( self, req ):
self.should_rec = not self.should_rec # toggle state. (bad way to do this...)
if self.should_rec == True:
self.data = []
self.rec = rmc.ROS_M5e_Client('ears', callbacks = [self.add_datum])
rospy.logout( 'RFID Recorder: Logging Reads.' )
rv = RecorderSrvResponse()
rv.rfid_reads = []
else:
rospy.logout( 'RFID Recorder: Halting recorder.' )
self.rec.unregister() # Stop processing new reads
rospy.sleep( 0.5 ) # Give it some time to settle
rv = RecorderSrvResponse()
rv.rfid_reads = list(self.data) # Save the data.
self.recorder_data = list( self.data )
return rv
def process_datum( self, datum ):
# Hooray for lexical scope (listener)!
ant_lookup = { 'EleLeftEar': '/ear_antenna_left',
'EleRightEar': '/ear_antenna_right' }
ps_ant = PoseStamped()
ps_ant.header.stamp = rospy.Time( 0 )
ps_ant.header.frame_id = ant_lookup[ datum.antenna_name ]
ps_base = PoseStamped()
ps_base.header.stamp = rospy.Time( 0 )
ps_base.header.frame_id = '/base_link'
try:
ps_ant_map = self.listener.transformPose( '/map', ps_ant )
ps_base_map = self.listener.transformPose( '/map', ps_base )
rv = RecorderReads()
rv.read = datum
rv.ps_ant_map = ps_ant_map
rv.ps_base_map = ps_base_map
except:
rospy.logout( 'RFID Recorder: TF failed. Ignoring read.' )
rv = None
return rv
def add_datum( self, datum ):
# Hooray for lexical scope (data)!
pd = self.process_datum( datum )
if pd != None:
self.data.append( pd )
def bestvantage(self, req):
rospy.logout('Recorder: Calculating best vantage for tag \'%s\'' % req.tagid)
d = {}
for rr in self.recorder_data: # rr is RecorderRead
if not d.has_key( rr.read.tagID ):
d[rr.read.tagID] = []
d[rr.read.tagID].append( rr )
pos_reads = []
if d.has_key( req.tagid ):
pos_reads = [ q for q in d[ req.tagid ] if q.read.rssi != -1 ] # list of RecorderReads
if not pos_reads: # check at least one positive reading
rospy.warn( 'Recorder: Desired tag had no readings.' )
rv = PoseStamped()
rv.header.frame_id = 'base_link'
rv.header.stamp = rospy.Time.now()
rv.pose.orientation.w = 1.0
return rv
# Select the RecorderRead with greatest RSSI
rssi = [ r.read.rssi for r in pos_reads ]
ind = np.argmax( rssi )
best = pos_reads[ ind ] # RecorderRead
best_read = best.read
best_ant = best.ps_ant_map
best_base = best.ps_base_map
#print best_read, best_ant, best_base
# We're going to keep the <x,y> location from the baselink (mapframe),
# but keep <ang> (mapframe) from the antenna.
rv = PoseStamped()
rv.header.stamp = rospy.Time.now()
rv.header.frame_id = best_base.header.frame_id
rv.pose.position = best_base.pose.position
rv.pose.orientation = best_ant.pose.orientation
return rv
if __name__ == '__main__':
rec = Recorder()
rospy.spin()
| ajibawa-2023/Python-Code-Large/train/row_99435 | 92 | 141 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0142, 0.0071, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0213, 0.0071, 0, 0.66, 0.0909, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Import_L4_C0", "label": "rospy import rospy", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0284, 0.0071, 0, 0.66, 0.1818, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Import_L6_C0", "label": "tf import tf", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0426, 0.0071, 0, 0.66, 0.2727, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:ImportFrom_L8_C0", "label": "from rfid_behaviors.srv import RecorderSrv, RecorderSrvResponse", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0567, 0.0071, 0, 0.66, 0.3636, 647, 0, 2, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["RecorderSrv", "RecorderSrvResponse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import RecorderSrv, RecorderSrvResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:ImportFrom_L9_C0", "label": "from rfid_behaviors.srv import NextBestVantage", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0638, 0.0071, 0, 0.66, 0.4545, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["NextBestVantage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import NextBestVantage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:ImportFrom_L10_C0", "label": "from rfid_behaviors.msg import RecorderReads", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0709, 0.0071, 0, 0.66, 0.5455, 903, 0, 1, 0, 0, 903, 0, 0], "semantic": {"name": "rfid_behaviors.msg", "arg_names": [], "import_names": ["RecorderReads"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.msg import RecorderReads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Import_L11_C0", "label": "hrl_rfid.ros_M5e_client import rmc", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.078, 0.0071, 0, 0.66, 0.6364, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "hrl_rfid.ros_M5e_client", "arg_names": [], "import_names": ["rmc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_rfid.ros_M5e_client as rmc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:ImportFrom_L12_C0", "label": "from geometry_msgs.msg import PoseStamped", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0851, 0.0071, 0, 0.66, 0.7273, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Import_L14_C0", "label": "numpy import np, math", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0993, 0.0071, 0, 0.66, 0.8182, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "label": "Recorder", "type": "class", "loc": [16, 135], "level": 0, "parent": null, "vector": [3, 0, 0.5355, 0.8511, 0, 0.66, 0.9091, 495, 0, 5, 0, 0, 0, 0, 42], "semantic": {"name": "Recorder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Recorder( ):\n def __init__( self, serv_name = 'rfid_recorder', node_name = 'rfid_recorder_py' ):\n rospy.logout( 'rfid_recorder: initializing' )\n try:\n rospy.init_node(node_name)\n except:\n pass\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "label": "__init__", "type": "function", "loc": [17, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "vector": [2, 1, 0.2092, 0.1844, 1, 0.53, 0.0, 555, 0, 3, 0, 0, 0, 0, 13], "semantic": {"name": "__init__", "arg_names": ["self", "serv_name", "node_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, serv_name = 'rfid_recorder', node_name = 'rfid_recorder_py' ):\n rospy.logout( 'rfid_recorder: initializing' )\n try:\n rospy.init_node(node_name)\n except:\n pass\n\n self.should_rec = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L18_C8", "label": "logout()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [8, 2, 0.1277, 0.0071, 2, 0.59, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rfid_recorder: initializing' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L19_C8", "label": "try", "type": "try", "loc": [19, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [7, 2, 0.1454, 0.0284, 2, 0.59, 0.1111, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node(node_name)\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L20_C12", "label": "init_node()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L19_C8", "vector": [8, 3, 0.1418, 0.0071, 3, 0.79, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node(node_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L24_C8", "label": "self.should_rec =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [14, 2, 0.1702, 0.0071, 2, 0.59, 0.2222, 911, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_rec", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_rec = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L26_C8", "label": "self._servrec = Service()", "type": "assigned_variable", "loc": [26, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [14, 2, 0.1915, 0.0213, 2, 0.59, 0.3333, 345, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._servrec", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._servrec = rospy.Service( serv_name + '/record',\n RecorderSrv,\n self.process_service )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L30_C8", "label": "self._servbest = Service()", "type": "assigned_variable", "loc": [30, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [14, 2, 0.2199, 0.0213, 2, 0.59, 0.4444, 74, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._servbest", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._servbest = rospy.Service( serv_name + '/best_vantage',\n NextBestVantage,\n self.bestvantage )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L34_C8", "label": "self.listener = TransformListener()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [14, 2, 0.2411, 0.0071, 2, 0.59, 0.5556, 686, 3, 0, 0, 0, 108, 10, 1], "semantic": {"name": "self.listener", "arg_names": [], "import_names": [], "rhs_call_name": "TransformListener", "annotation": ""}, "snippet": " self.listener = tf.TransformListener()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L35_C8", "label": "logout()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [8, 2, 0.2482, 0.0071, 2, 0.59, 0.6667, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'RFID Recorder: Waiting on transforms' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L36_C8", "label": "waitForTransform()", "type": "expression", "loc": [36, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [8, 2, 0.2589, 0.0142, 2, 0.59, 0.7778, 900, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "waitForTransform", "arg_names": [], "import_names": [], "rhs_call_name": "waitForTransform", "annotation": ""}, "snippet": " self.listener.waitForTransform('/ear_antenna_left', '/map',\n rospy.Time(0), timeout = rospy.Duration(100) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L38_C8", "label": "waitForTransform()", "type": "expression", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [8, 2, 0.273, 0.0142, 2, 0.59, 0.8889, 900, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "waitForTransform", "arg_names": [], "import_names": [], "rhs_call_name": "waitForTransform", "annotation": ""}, "snippet": " self.listener.waitForTransform('/ear_antenna_right', '/map',\n rospy.Time(0), timeout = rospy.Duration(100) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L42_C8", "label": "logout()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "vector": [8, 2, 0.2979, 0.0071, 2, 0.59, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'rfid_recorder: ready' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "label": "process_service", "type": "function", "loc": [44, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "vector": [2, 1, 0.3723, 0.1277, 1, 0.53, 0.25, 430, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "process_service", "arg_names": ["self", "req"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_service( self, req ):\n self.should_rec = not self.should_rec # toggle state. (bad way to do this...)\n\n if self.should_rec == True:\n self.data = []\n self.rec = rmc.ROS_M5e_Client('ears', callbacks = [self.add_datum])\n rospy.logout( 'RFID Recorder: Logging Reads.' )\n rv = RecorderSrvResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L45_C8", "label": "self.should_rec =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "vector": [14, 2, 0.3191, 0.0071, 2, 0.37, 0.0, 911, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.should_rec", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_rec = not self.should_rec # toggle state. (bad way to do this...)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "label": "if", "type": "if", "loc": [47, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "vector": [4, 2, 0.3723, 0.0851, 2, 0.37, 0.3333, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.should_rec == True:\n self.data = []\n self.rec = rmc.ROS_M5e_Client('ears', callbacks = [self.add_datum])\n rospy.logout( 'RFID Recorder: Logging Reads.' )\n rv = RecorderSrvResponse()\n rv.rfid_reads = []\n else:\n rospy.logout( 'RFID Recorder: Halting recorder.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L48_C12", "label": "self.data =", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [14, 3, 0.3404, 0.0071, 3, 0.7, 0.0, 838, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L49_C12", "label": "self.rec = ROS_M5e_Client()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [14, 3, 0.3475, 0.0071, 3, 0.7, 0.1111, 814, 3, 2, 0, 0, 479, 10, 1], "semantic": {"name": "self.rec", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_M5e_Client", "annotation": ""}, "snippet": " self.rec = rmc.ROS_M5e_Client('ears', callbacks = [self.add_datum])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L50_C12", "label": "logout()", "type": "expression", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [8, 3, 0.3546, 0.0071, 3, 0.7, 0.2222, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'RFID Recorder: Logging Reads.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L51_C12", "label": "rv = RecorderSrvResponse()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [14, 3, 0.3617, 0.0071, 3, 0.7, 0.3333, 222, 3, 0, 0, 0, 238, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "RecorderSrvResponse", "annotation": ""}, "snippet": " rv = RecorderSrvResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L52_C12", "label": "rv.rfid_reads =", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [14, 3, 0.3688, 0.0071, 3, 0.7, 0.4444, 905, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rv.rfid_reads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.rfid_reads = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L54_C12", "label": "logout()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [8, 3, 0.383, 0.0071, 3, 0.7, 0.5556, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'RFID Recorder: Halting recorder.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L55_C12", "label": "unregister()", "type": "expression", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [8, 3, 0.3901, 0.0071, 3, 0.7, 0.6667, 614, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unregister", "arg_names": [], "import_names": [], "rhs_call_name": "unregister", "annotation": ""}, "snippet": " self.rec.unregister() # Stop processing new reads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L56_C12", "label": "sleep()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [8, 3, 0.3972, 0.0071, 3, 0.7, 0.7778, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.5 ) # Give it some time to settle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L57_C12", "label": "rv = RecorderSrvResponse()", "type": "assigned_variable", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [14, 3, 0.4043, 0.0071, 3, 0.7, 0.8889, 222, 3, 0, 0, 0, 238, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "RecorderSrvResponse", "annotation": ""}, "snippet": " rv = RecorderSrvResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L58_C12", "label": "rv.rfid_reads = list()", "type": "assigned_variable", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "vector": [14, 3, 0.4113, 0.0071, 3, 0.7, 1.0, 905, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "rv.rfid_reads", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " rv.rfid_reads = list(self.data) # Save the data."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L60_C8", "label": "self.recorder_data = list()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "vector": [14, 2, 0.4255, 0.0071, 2, 0.37, 0.6667, 547, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "self.recorder_data", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " self.recorder_data = list( self.data )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Return_L61_C8", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "vector": [13, 2, 0.4326, 0.0071, 2, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "label": "process_datum", "type": "function", "loc": [63, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "vector": [2, 1, 0.5284, 0.1702, 1, 0.53, 0.5, 595, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "process_datum", "arg_names": ["self", "datum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_datum( self, datum ):\n # Hooray for lexical scope (listener)!\n ant_lookup = { 'EleLeftEar': '/ear_antenna_left',\n 'EleRightEar': '/ear_antenna_right' }\n\n ps_ant = PoseStamped()\n ps_ant.header.stamp = rospy.Time( 0 )\n ps_ant.header.frame_id = ant_lookup[ datum.antenna_name ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L65_C8", "label": "ant_lookup =", "type": "assigned_variable", "loc": [65, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [14, 2, 0.4645, 0.0142, 2, 0.6, 0.0, 120, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ant_lookup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ant_lookup = { 'EleLeftEar': '/ear_antenna_left',\n 'EleRightEar': '/ear_antenna_right' }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L68_C8", "label": "ps_ant = PoseStamped()", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [14, 2, 0.4823, 0.0071, 2, 0.6, 0.125, 903, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "ps_ant", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " ps_ant = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L69_C8", "label": "ps_ant.header.stamp = Time()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [14, 2, 0.4894, 0.0071, 2, 0.6, 0.25, 616, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "ps_ant.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " ps_ant.header.stamp = rospy.Time( 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L70_C8", "label": "ps_ant.header.frame_id =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [14, 2, 0.4965, 0.0071, 2, 0.6, 0.375, 786, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ps_ant.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps_ant.header.frame_id = ant_lookup[ datum.antenna_name ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L72_C8", "label": "ps_base = PoseStamped()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [14, 2, 0.5106, 0.0071, 2, 0.6, 0.5, 802, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "ps_base", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " ps_base = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L73_C8", "label": "ps_base.header.stamp = Time()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [14, 2, 0.5177, 0.0071, 2, 0.6, 0.625, 800, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "ps_base.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " ps_base.header.stamp = rospy.Time( 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L74_C8", "label": "ps_base.header.frame_id =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [14, 2, 0.5248, 0.0071, 2, 0.6, 0.75, 445, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ps_base.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ps_base.header.frame_id = '/base_link'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "label": "try", "type": "try", "loc": [76, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [7, 2, 0.5709, 0.0709, 2, 0.6, 0.875, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n ps_ant_map = self.listener.transformPose( '/map', ps_ant )\n ps_base_map = self.listener.transformPose( '/map', ps_base )\n rv = RecorderReads()\n rv.read = datum\n rv.ps_ant_map = ps_ant_map\n rv.ps_base_map = ps_base_map \n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L77_C12", "label": "ps_ant_map = transformPose()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "vector": [14, 3, 0.5461, 0.0071, 3, 0.0, 0.0, 222, 3, 2, 0, 0, 654, 10, 1], "semantic": {"name": "ps_ant_map", "arg_names": [], "import_names": [], "rhs_call_name": "transformPose", "annotation": ""}, "snippet": " ps_ant_map = self.listener.transformPose( '/map', ps_ant )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L78_C12", "label": "ps_base_map = transformPose()", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "vector": [14, 3, 0.5532, 0.0071, 3, 0.0, 0.2, 679, 3, 2, 0, 0, 654, 10, 1], "semantic": {"name": "ps_base_map", "arg_names": [], "import_names": [], "rhs_call_name": "transformPose", "annotation": ""}, "snippet": " ps_base_map = self.listener.transformPose( '/map', ps_base )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L79_C12", "label": "rv = RecorderReads()", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "vector": [14, 3, 0.5603, 0.0071, 3, 0.0, 0.4, 222, 3, 0, 0, 0, 522, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "RecorderReads", "annotation": ""}, "snippet": " rv = RecorderReads()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L80_C12", "label": "rv.read =", "type": "assigned_variable", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "vector": [14, 3, 0.5674, 0.0071, 3, 0.0, 0.6, 846, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.read = datum"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L81_C12", "label": "rv.ps_ant_map =", "type": "assigned_variable", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "vector": [14, 3, 0.5745, 0.0071, 3, 0.0, 0.8, 306, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.ps_ant_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.ps_ant_map = ps_ant_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L82_C12", "label": "rv.ps_base_map =", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "vector": [14, 3, 0.5816, 0.0071, 3, 0.0, 1.0, 369, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.ps_base_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.ps_base_map = ps_base_map "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L84_C12", "label": "logout()", "type": "expression", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "vector": [8, 3, 0.5957, 0.0071, 3, 0.0, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'RFID Recorder: TF failed. Ignoring read.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L85_C12", "label": "rv =", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "vector": [14, 3, 0.6028, 0.0071, 3, 0.0, 1.0, 222, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Return_L86_C8", "label": "return", "type": "return", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "vector": [13, 2, 0.6099, 0.0071, 2, 0.6, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L88_C4", "label": "add_datum", "type": "function", "loc": [88, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "vector": [2, 1, 0.6383, 0.0355, 1, 0.53, 0.75, 258, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "add_datum", "arg_names": ["self", "datum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_datum( self, datum ):\n # Hooray for lexical scope (data)!\n pd = self.process_datum( datum )\n if pd != None:\n self.data.append( pd )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L90_C8", "label": "pd = process_datum()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L88_C4", "vector": [14, 2, 0.6383, 0.0071, 2, 0.79, 0.0, 51, 3, 1, 0, 0, 595, 10, 1], "semantic": {"name": "pd", "arg_names": [], "import_names": [], "rhs_call_name": "process_datum", "annotation": ""}, "snippet": " pd = self.process_datum( datum )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L91_C8", "label": "if", "type": "if", "loc": [91, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L88_C4", "vector": [4, 2, 0.6489, 0.0142, 2, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pd != None:\n self.data.append( pd )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L92_C12", "label": "append()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L91_C8", "vector": [8, 3, 0.6525, 0.0071, 3, 0.52, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.data.append( pd )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "label": "bestvantage", "type": "function", "loc": [94, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "vector": [2, 1, 0.8121, 0.2979, 1, 0.53, 1.0, 412, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "bestvantage", "arg_names": ["self", "req"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def bestvantage(self, req):\n rospy.logout('Recorder: Calculating best vantage for tag \\'%s\\'' % req.tagid)\n\n d = {}\n for rr in self.recorder_data: # rr is RecorderRead\n if not d.has_key( rr.read.tagID ):\n d[rr.read.tagID] = []\n d[rr.read.tagID].append( rr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L95_C8", "label": "logout()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [8, 2, 0.6738, 0.0071, 2, 0.69, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout('Recorder: Calculating best vantage for tag \\'%s\\'' % req.tagid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L97_C8", "label": "d =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.6879, 0.0071, 2, 0.69, 0.0588, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:For_L98_C8", "label": "for rr", "type": "for", "loc": [98, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [6, 2, 0.7057, 0.0284, 2, 0.69, 0.1176, 220, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "rr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for rr in self.recorder_data: # rr is RecorderRead\n if not d.has_key( rr.read.tagID ):\n d[rr.read.tagID] = []\n d[rr.read.tagID].append( rr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L99_C12", "label": "if", "type": "if", "loc": [99, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:For_L98_C8", "vector": [4, 3, 0.7057, 0.0142, 3, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not d.has_key( rr.read.tagID ):\n d[rr.read.tagID] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L100_C16", "label": "assign", "type": "assigned_variable", "loc": [100, 100], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L99_C12", "vector": [14, 4, 0.7092, 0.0071, 4, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[rr.read.tagID] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L101_C12", "label": "append()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:For_L98_C8", "vector": [8, 3, 0.7163, 0.0071, 3, 0.76, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " d[rr.read.tagID].append( rr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L103_C8", "label": "pos_reads =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.7305, 0.0071, 2, 0.69, 0.1765, 607, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pos_reads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos_reads = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L104_C8", "label": "if", "type": "if", "loc": [104, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [4, 2, 0.7411, 0.0142, 2, 0.69, 0.2353, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if d.has_key( req.tagid ):\n pos_reads = [ q for q in d[ req.tagid ] if q.read.rssi != -1 ] # list of RecorderReads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L105_C12", "label": "pos_reads =", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L104_C8", "vector": [14, 3, 0.7447, 0.0071, 3, 0.53, 0.0, 607, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos_reads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos_reads = [ q for q in d[ req.tagid ] if q.read.rssi != -1 ] # list of RecorderReads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "label": "if", "type": "if", "loc": [107, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [4, 2, 0.7801, 0.0496, 2, 0.69, 0.2941, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pos_reads: # check at least one positive reading\n rospy.warn( 'Recorder: Desired tag had no readings.' )\n rv = PoseStamped()\n rv.header.frame_id = 'base_link'\n rv.header.stamp = rospy.Time.now()\n rv.pose.orientation.w = 1.0\n return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L108_C12", "label": "warn()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "vector": [8, 3, 0.766, 0.0071, 3, 0.69, 0.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " rospy.warn( 'Recorder: Desired tag had no readings.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L109_C12", "label": "rv = PoseStamped()", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "vector": [14, 3, 0.773, 0.0071, 3, 0.69, 0.2, 222, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " rv = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L110_C12", "label": "rv.header.frame_id =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "vector": [14, 3, 0.7801, 0.0071, 3, 0.69, 0.4, 978, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "rv.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.header.frame_id = 'base_link'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L111_C12", "label": "rv.header.stamp = now()", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "vector": [14, 3, 0.7872, 0.0071, 3, 0.69, 0.6, 13, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "rv.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " rv.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L112_C12", "label": "rv.pose.orientation.w =", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "vector": [14, 3, 0.7943, 0.0071, 3, 0.69, 0.8, 103, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "rv.pose.orientation.w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.pose.orientation.w = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Return_L113_C12", "label": "return", "type": "return", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "vector": [13, 3, 0.8014, 0.0071, 3, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L116_C8", "label": "rssi =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.8227, 0.0071, 2, 0.69, 0.3529, 906, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rssi = [ r.read.rssi for r in pos_reads ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L117_C8", "label": "ind = argmax()", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.8298, 0.0071, 2, 0.69, 0.4118, 680, 3, 1, 0, 0, 593, 10, 1], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "argmax", "annotation": ""}, "snippet": " ind = np.argmax( rssi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L119_C8", "label": "best =", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.844, 0.0071, 2, 0.69, 0.4706, 676, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "best", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best = pos_reads[ ind ] # RecorderRead"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L120_C8", "label": "best_read =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.8511, 0.0071, 2, 0.69, 0.5294, 445, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "best_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_read = best.read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L121_C8", "label": "best_ant =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.8582, 0.0071, 2, 0.69, 0.5882, 343, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "best_ant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_ant = best.ps_ant_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L122_C8", "label": "best_base =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.8652, 0.0071, 2, 0.69, 0.6471, 221, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "best_base", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_base = best.ps_base_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L129_C8", "label": "rv = PoseStamped()", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.9149, 0.0071, 2, 0.69, 0.7059, 222, 3, 0, 0, 0, 226, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "PoseStamped", "annotation": ""}, "snippet": " rv = PoseStamped()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L130_C8", "label": "rv.header.stamp = now()", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.922, 0.0071, 2, 0.69, 0.7647, 13, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "rv.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " rv.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L131_C8", "label": "rv.header.frame_id =", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.9291, 0.0071, 2, 0.69, 0.8235, 978, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.header.frame_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.header.frame_id = best_base.header.frame_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L132_C8", "label": "rv.pose.position =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.9362, 0.0071, 2, 0.69, 0.8824, 532, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.pose.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.pose.position = best_base.pose.position"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L133_C8", "label": "rv.pose.orientation =", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [14, 2, 0.9433, 0.0071, 2, 0.69, 0.9412, 912, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.pose.orientation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.pose.orientation = best_ant.pose.orientation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Return_L135_C8", "label": "return", "type": "return", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "vector": [13, 2, 0.9574, 0.0071, 2, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L139_C0", "label": "if", "type": "if", "loc": [139, 141], "level": 0, "parent": null, "vector": [4, 0, 0.9929, 0.0213, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n rec = Recorder()\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L140_C4", "label": "rec = Recorder()", "type": "assigned_variable", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L139_C0", "vector": [14, 1, 0.9929, 0.0071, 1, 0.86, 0.0, 100, 3, 0, 0, 0, 495, 10, 1], "semantic": {"name": "rec", "arg_names": [], "import_names": [], "rhs_call_name": "Recorder", "annotation": ""}, "snippet": " rec = Recorder()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L141_C4", "label": "spin()", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L139_C0", "vector": [8, 1, 1.0, 0.0071, 1, 0.86, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Return_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:Try_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Return_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:For_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:For_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:For_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L104_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Return_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Return_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99435:If_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99435:Expr_L141_C4"}] |
import subprocess as sb
import os
class CmdProcess:
def __init__(self, cmd_list):
self.cmd_list= cmd_list
self.process = None
def run(self):
self.process = sb.Popen(self.cmd_list)
def kill(self):
os.system('kill -2 %d' % self.process.pid)
| ajibawa-2023/Python-Code-Large/train/row_99436 | 10 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99436:Import_L1_C0", "label": "subprocess import sb", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["sb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import subprocess as sb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.5, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:ClassDef_L4_C0", "label": "CmdProcess", "type": "class", "loc": [4, 14], "level": 0, "parent": null, "vector": [3, 0, 0.6429, 0.7857, 0, 0.66, 1.0, 248, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "CmdProcess", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CmdProcess:\n \n def __init__(self, cmd_list):\n self.cmd_list= cmd_list\n self.process = None\n\n def run(self):\n self.process = sb.Popen(self.cmd_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99436:ClassDef_L4_C0", "vector": [2, 1, 0.5, 0.2143, 1, 0.75, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "cmd_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, cmd_list):\n self.cmd_list= cmd_list\n self.process = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:Assign_L7_C8", "label": "self.cmd_list =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L6_C4", "vector": [14, 2, 0.5, 0.0714, 2, 0.92, 0.0, 760, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cmd_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cmd_list= cmd_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:Assign_L8_C8", "label": "self.process =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L6_C4", "vector": [14, 2, 0.5714, 0.0714, 2, 0.92, 1.0, 789, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.process", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.process = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L10_C4", "label": "run", "type": "function", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99436:ClassDef_L4_C0", "vector": [2, 1, 0.75, 0.1429, 1, 0.75, 0.5, 679, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self):\n self.process = sb.Popen(self.cmd_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:Assign_L11_C8", "label": "self.process = Popen()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L10_C4", "vector": [14, 2, 0.7857, 0.0714, 2, 0.15, 0.0, 789, 3, 1, 0, 0, 568, 10, 1], "semantic": {"name": "self.process", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": " self.process = sb.Popen(self.cmd_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L13_C4", "label": "kill", "type": "function", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99436:ClassDef_L4_C0", "vector": [2, 1, 0.9643, 0.1429, 1, 0.75, 1.0, 173, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "kill", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def kill(self):\n os.system('kill -2 %d' % self.process.pid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99436:Expr_L14_C8", "label": "system()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L13_C4", "vector": [8, 2, 1.0, 0.0714, 2, 0.84, 0.0, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system('kill -2 %d' % self.process.pid)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99436:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99436:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99436:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99436:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99436:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99436:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99436:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99436:Expr_L14_C8"}] |
#! /usr/bin/python
import roslib;
roslib.load_manifest('hrl_pr2_kinematics_tutorials')
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('std_srvs')
import rospy
import hrl_pr2_kinematics_tutorials.hrl_pr2 as hrl_pr2
import hrl_lib.transforms as tr
import rfid_behaviors.tactile_sensors as tsen
from rfid_behaviors.srv import ArmSrv
from rfid_behaviors.srv import HandoffSrv
import numpy as np, math
import os
import time
class HandoffNode():
def __init__( self ):
rospy.init_node( 'handoff', anonymous = True )
rospy.logout( 'handoff_node: Have run hrl_pr2_gains/change_gains.sh yet?' )
self.robot = hrl_pr2.HRL_PR2()
if not (os.environ.has_key('ROBOT') and os.environ['ROBOT'] == 'sim'):
self.ts = tsen.TactileSensor()
self.arm = 'right_arm'
self.start_ja = [0.040304940763152608, 1.2398003444166741, -1.2204088251845415, -1.9324078526157087, -31.197472992401149, -1.7430222641585842, -1.5358378047038517]
#self.target_ja = [0.35891507126604916, 0.13778228113494312, -0.01277662779292843, -1.4992538841561938, -28.605807802842136, -0.96590944225972863, -3.0950669743130161]
self.target_ja = [0.0818, 0.377, -0.860, -2.144, -3.975, -1.479, 3.907]
self.grasp_ja = [ -1.57263428749, -0.347376409246, -1.58724516843, -1.61707941489, -51.4022142048, -1.36894875484, -5.9965378332 ]
self.stowgrasp_ja = [-0.130, 1.18, -1.410, -1.638, -141.06, -1.695, 48.616 ]
self._sh = rospy.Service( '/rfid_handoff/handoff' , HandoffSrv, self.handoff )
self._si = rospy.Service( '/rfid_handoff/initialize' , HandoffSrv, self.initialize )
self._sj = rospy.Service( '/rfid_handoff/handoff_pos' , ArmSrv, self.handoff_pos )
self._ss = rospy.Service( '/rfid_handoff/stow' , HandoffSrv, self.stow )
self._sp = rospy.Service( '/rfid_handoff/pre_stow' , HandoffSrv, self.pre_stow )
self._sg = rospy.Service( '/rfid_handoff/grasp' , HandoffSrv, self.grasp )
self._senough = rospy.Service( '/rfid_handoff/stow_grasp' , HandoffSrv, self.stow_grasp )
self._swave = rospy.Service( '/rfid_handoff/wave' , HandoffSrv, self.wave )
# self.initialize() # Prefer to do this manually... (rosservice call /rfid_handoff/initialize)
rospy.logout( 'handoff_node: Waiting for service calls.' )
def initialize( self, msg = None ):
rospy.logout( 'handoff_node: Initializing. Hand me an object!' )
# Put into handoff position, ready to accept object
self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
self.robot.open_gripper( self.arm )
rospy.sleep( rospy.Duration( 2.0 ))
self.stow()
return True
def wave( self, msg = None ):
wave_a = [0.0131, 0.325, -0.832, -1.762,-6.511, -0.191, 0.162]
wave_b = [-0.180, 0.034, 0.108, -1.295, -6.224, -0.383, 0.119]
self.robot.set_jointangles( self.arm, wave_a, 2.0 )
rospy.sleep( rospy.Duration( 2.0 ))
self.robot.set_jointangles( self.arm, wave_b, 1.0 )
rospy.sleep( rospy.Duration( 1.0 ))
self.robot.set_jointangles( self.arm, wave_a, 1.0 )
rospy.sleep( rospy.Duration( 1.0 ))
self.robot.set_jointangles( self.arm, wave_b, 1.0 )
rospy.sleep( rospy.Duration( 1.0 ))
self.robot.set_jointangles( self.arm, wave_a, 1.0 )
rospy.sleep( rospy.Duration( 1.0 ))
self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
return True
def stow( self, msg=None ):
# Grab object
self.robot.close_gripper( self.arm )
rospy.sleep( rospy.Duration( 2.5 ))
# Stow
self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
return True
def pre_stow( self, msg=None ):
# Grab object
self.robot.close_gripper( self.arm )
rospy.sleep( rospy.Duration( 2.0 ))
# Stow
self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
return True
def grasp( self, msg=None ):
# Grab object
self.robot.close_gripper( self.arm )
rospy.sleep( rospy.Duration( 2.0 ))
# Stow
self.robot.set_jointangles( self.arm, self.grasp_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
return True
def stow_grasp( self, msg=None ):
# Stow
self.robot.set_jointangles( self.arm, self.stowgrasp_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
return True
def open( self ):
self.robot.open_gripper( self.arm )
rospy.sleep( rospy.Duration( 2.0 ))
def close( self ):
self.robot.close_gripper( self.arm )
rospy.sleep( rospy.Duration( 2.0 ))
def handoff( self, msg = None ):
# Put into handoff position.
self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
# Tactile Sensor detector
rospy.sleep( rospy.Duration( 0.5 ))
self.ts.thresh_detect( 3000 )
# Release object
self.robot.open_gripper( self.arm )
rospy.sleep( rospy.Duration( 2.0 ))
# Stow
self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
return True
def handoff_pos( self, msg ):
#pos = np.matrix([0.6977, -0.03622, 0.2015]).T
#ang = tr.Rx(math.radians(0.))
print msg
pos = np.matrix([ msg.x, msg.y, msg.z ]).T
ang = tr.Rx( msg.ang )
q = [0, 0, 0, 0, 0, 0, 0]
j = self.robot.IK('right_arm', pos, ang, self.target_ja)
#j = self.robot.IK('right_arm', pos, ang, q)
self.robot.set_jointangles( 'right_arm', j, 3.0 )
# Tactile Sensor detector
rospy.sleep( rospy.Duration( 0.5 ))
self.ts.thresh_detect( 3000 )
# Release object
self.robot.open_gripper( self.arm )
rospy.sleep( rospy.Duration( 2.0 ))
# Stow
self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )
rospy.sleep( rospy.Duration( 3.0 ))
return True
if __name__ == '__main__':
hon = HandoffNode()
#hon.handoff_pos()
rospy.spin()
#ho.handoff()
| ajibawa-2023/Python-Code-Large/train/row_99437 | 114 | 180 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0056, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0222, 0.0056, 0, 0.66, 0.0667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_pr2_kinematics_tutorials')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L5_C0", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0278, 0.0056, 0, 0.66, 0.1333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0333, 0.0056, 0, 0.66, 0.2, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0389, 0.0056, 0, 0.66, 0.2667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('std_srvs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Import_L8_C0", "label": "rospy import rospy", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0444, 0.0056, 0, 0.66, 0.3333, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Import_L10_C0", "label": "hrl_pr2_kinematics_tutorials.hrl_pr2 import hrl_pr2", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0056, 0, 0.66, 0.4, 197, 0, 1, 0, 0, 197, 0, 0], "semantic": {"name": "hrl_pr2_kinematics_tutorials.hrl_pr2", "arg_names": [], "import_names": ["hrl_pr2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_pr2_kinematics_tutorials.hrl_pr2 as hrl_pr2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Import_L11_C0", "label": "hrl_lib.transforms import tr", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0611, 0.0056, 0, 0.66, 0.4667, 82, 0, 1, 0, 0, 82, 0, 0], "semantic": {"name": "hrl_lib.transforms", "arg_names": [], "import_names": ["tr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.transforms as tr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Import_L12_C0", "label": "rfid_behaviors.tactile_sensors import tsen", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0056, 0, 0.66, 0.5333, 315, 0, 1, 0, 0, 315, 0, 0], "semantic": {"name": "rfid_behaviors.tactile_sensors", "arg_names": [], "import_names": ["tsen"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_behaviors.tactile_sensors as tsen"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:ImportFrom_L13_C0", "label": "from rfid_behaviors.srv import ArmSrv", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0722, 0.0056, 0, 0.66, 0.6, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["ArmSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import ArmSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:ImportFrom_L14_C0", "label": "from rfid_behaviors.srv import HandoffSrv", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0778, 0.0056, 0, 0.66, 0.6667, 647, 0, 1, 0, 0, 647, 0, 0], "semantic": {"name": "rfid_behaviors.srv", "arg_names": [], "import_names": ["HandoffSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rfid_behaviors.srv import HandoffSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Import_L16_C0", "label": "numpy import np, math", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0889, 0.0056, 0, 0.66, 0.7333, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Import_L17_C0", "label": "os import os", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0944, 0.0056, 0, 0.66, 0.8, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Import_L18_C0", "label": "time import time", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.0056, 0, 0.66, 0.8667, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "label": "HandoffNode", "type": "class", "loc": [20, 170], "level": 0, "parent": null, "vector": [3, 0, 0.5278, 0.8389, 0, 0.66, 0.9333, 436, 0, 11, 0, 0, 0, 0, 93], "semantic": {"name": "HandoffNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HandoffNode():\n def __init__( self ):\n rospy.init_node( 'handoff', anonymous = True )\n rospy.logout( 'handoff_node: Have run hrl_pr2_gains/change_gains.sh yet?' )\n\n self.robot = hrl_pr2.HRL_PR2()\n if not (os.environ.has_key('ROBOT') and os.environ['ROBOT'] == 'sim'):\n self.ts = tsen.TactileSensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "label": "__init__", "type": "function", "loc": [21, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.1917, 0.1556, 1, 0.73, 0.0, 555, 0, 1, 0, 0, 0, 0, 14], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self ):\n rospy.init_node( 'handoff', anonymous = True )\n rospy.logout( 'handoff_node: Have run hrl_pr2_gains/change_gains.sh yet?' )\n\n self.robot = hrl_pr2.HRL_PR2()\n if not (os.environ.has_key('ROBOT') and os.environ['ROBOT'] == 'sim'):\n self.ts = tsen.TactileSensor()\n self.arm = 'right_arm'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L22_C8", "label": "init_node()", "type": "expression", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [8, 2, 0.1222, 0.0056, 2, 0.35, 0.0, 463, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'handoff', anonymous = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L23_C8", "label": "logout()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [8, 2, 0.1278, 0.0056, 2, 0.35, 0.0588, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'handoff_node: Have run hrl_pr2_gains/change_gains.sh yet?' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L25_C8", "label": "self.robot = HRL_PR2()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.1389, 0.0056, 2, 0.35, 0.1176, 879, 3, 0, 0, 0, 142, 10, 1], "semantic": {"name": "self.robot", "arg_names": [], "import_names": [], "rhs_call_name": "HRL_PR2", "annotation": ""}, "snippet": " self.robot = hrl_pr2.HRL_PR2()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L26_C8", "label": "if", "type": "if", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [4, 2, 0.1472, 0.0111, 2, 0.35, 0.1765, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (os.environ.has_key('ROBOT') and os.environ['ROBOT'] == 'sim'):\n self.ts = tsen.TactileSensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L27_C12", "label": "self.ts = TactileSensor()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L26_C8", "vector": [14, 3, 0.15, 0.0056, 3, 0.04, 0.0, 134, 3, 0, 0, 0, 495, 10, 1], "semantic": {"name": "self.ts", "arg_names": [], "import_names": [], "rhs_call_name": "TactileSensor", "annotation": ""}, "snippet": " self.ts = tsen.TactileSensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L28_C8", "label": "self.arm =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.1556, 0.0056, 2, 0.35, 0.2353, 720, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.arm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.arm = 'right_arm'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L30_C8", "label": "self.start_ja =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.1667, 0.0056, 2, 0.35, 0.2941, 804, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.start_ja", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.start_ja = [0.040304940763152608, 1.2398003444166741, -1.2204088251845415, -1.9324078526157087, -31.197472992401149, -1.7430222641585842, -1.5358378047038517]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L32_C8", "label": "self.target_ja =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.1778, 0.0056, 2, 0.35, 0.3529, 276, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.target_ja", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.target_ja = [0.0818, 0.377, -0.860, -2.144, -3.975, -1.479, 3.907]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L34_C8", "label": "self.grasp_ja =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.1889, 0.0056, 2, 0.35, 0.4118, 697, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.grasp_ja", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.grasp_ja = [ -1.57263428749, -0.347376409246, -1.58724516843, -1.61707941489, -51.4022142048, -1.36894875484, -5.9965378332 ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L35_C8", "label": "self.stowgrasp_ja =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.1944, 0.0056, 2, 0.35, 0.4706, 120, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.stowgrasp_ja", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stowgrasp_ja = [-0.130, 1.18, -1.410, -1.638, -141.06, -1.695, 48.616 ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L38_C8", "label": "self._sh = Service()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.2111, 0.0056, 2, 0.35, 0.5294, 573, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._sh", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._sh = rospy.Service( '/rfid_handoff/handoff' , HandoffSrv, self.handoff )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L39_C8", "label": "self._si = Service()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.2167, 0.0056, 2, 0.35, 0.5882, 729, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._si", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._si = rospy.Service( '/rfid_handoff/initialize' , HandoffSrv, self.initialize )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L40_C8", "label": "self._sj = Service()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.2222, 0.0056, 2, 0.35, 0.6471, 928, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._sj", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._sj = rospy.Service( '/rfid_handoff/handoff_pos' , ArmSrv, self.handoff_pos )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L41_C8", "label": "self._ss = Service()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.2278, 0.0056, 2, 0.35, 0.7059, 479, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._ss", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._ss = rospy.Service( '/rfid_handoff/stow' , HandoffSrv, self.stow )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L42_C8", "label": "self._sp = Service()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.2333, 0.0056, 2, 0.35, 0.7647, 349, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._sp", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._sp = rospy.Service( '/rfid_handoff/pre_stow' , HandoffSrv, self.pre_stow )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L43_C8", "label": "self._sg = Service()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.2389, 0.0056, 2, 0.35, 0.8235, 352, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._sg", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._sg = rospy.Service( '/rfid_handoff/grasp' , HandoffSrv, self.grasp )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L44_C8", "label": "self._senough = Service()", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.2444, 0.0056, 2, 0.35, 0.8824, 41, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._senough", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._senough = rospy.Service( '/rfid_handoff/stow_grasp' , HandoffSrv, self.stow_grasp )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L45_C8", "label": "self._swave = Service()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [14, 2, 0.25, 0.0056, 2, 0.35, 0.9412, 184, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._swave", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._swave = rospy.Service( '/rfid_handoff/wave' , HandoffSrv, self.wave )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L48_C8", "label": "logout()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "vector": [8, 2, 0.2667, 0.0056, 2, 0.35, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'handoff_node: Waiting for service calls.' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "label": "initialize", "type": "function", "loc": [50, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.3056, 0.0611, 1, 0.73, 0.1, 393, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "initialize", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def initialize( self, msg = None ):\n rospy.logout( 'handoff_node: Initializing. Hand me an object!' )\n\n # Put into handoff position, ready to accept object\n self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )\n rospy.sleep( rospy.Duration( 3.0 ))\n self.robot.open_gripper( self.arm )\n rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L51_C8", "label": "logout()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "vector": [8, 2, 0.2833, 0.0056, 2, 0.26, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'handoff_node: Initializing. Hand me an object!' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L54_C8", "label": "set_jointangles()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "vector": [8, 2, 0.3, 0.0056, 2, 0.26, 0.1667, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L55_C8", "label": "sleep()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "vector": [8, 2, 0.3056, 0.0056, 2, 0.26, 0.3333, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L56_C8", "label": "open_gripper()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "vector": [8, 2, 0.3111, 0.0056, 2, 0.26, 0.5, 833, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "open_gripper", "arg_names": [], "import_names": [], "rhs_call_name": "open_gripper", "annotation": ""}, "snippet": " self.robot.open_gripper( self.arm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L57_C8", "label": "sleep()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "vector": [8, 2, 0.3167, 0.0056, 2, 0.26, 0.6667, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L59_C8", "label": "stow()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "vector": [8, 2, 0.3278, 0.0056, 2, 0.26, 0.8333, 817, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stow", "arg_names": [], "import_names": [], "rhs_call_name": "stow", "annotation": ""}, "snippet": " self.stow()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "vector": [13, 2, 0.3333, 0.0056, 2, 0.26, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "label": "wave", "type": "function", "loc": [62, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.3861, 0.0889, 1, 0.73, 0.2, 906, 0, 2, 1, 0, 0, 0, 18], "semantic": {"name": "wave", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wave( self, msg = None ):\n wave_a = [0.0131, 0.325, -0.832, -1.762,-6.511, -0.191, 0.162]\n wave_b = [-0.180, 0.034, 0.108, -1.295, -6.224, -0.383, 0.119]\n self.robot.set_jointangles( self.arm, wave_a, 2.0 )\n rospy.sleep( rospy.Duration( 2.0 ))\n self.robot.set_jointangles( self.arm, wave_b, 1.0 )\n rospy.sleep( rospy.Duration( 1.0 ))\n self.robot.set_jointangles( self.arm, wave_a, 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L63_C8", "label": "wave_a =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [14, 2, 0.35, 0.0056, 2, 0.67, 0.0, 688, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wave_a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wave_a = [0.0131, 0.325, -0.832, -1.762,-6.511, -0.191, 0.162]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L64_C8", "label": "wave_b =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [14, 2, 0.3556, 0.0056, 2, 0.67, 0.0714, 905, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wave_b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wave_b = [-0.180, 0.034, 0.108, -1.295, -6.224, -0.383, 0.119]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L65_C8", "label": "set_jointangles()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.3611, 0.0056, 2, 0.67, 0.1429, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, wave_a, 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L66_C8", "label": "sleep()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.3667, 0.0056, 2, 0.67, 0.2143, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L67_C8", "label": "set_jointangles()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.3722, 0.0056, 2, 0.67, 0.2857, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, wave_b, 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L68_C8", "label": "sleep()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.3778, 0.0056, 2, 0.67, 0.3571, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 1.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L69_C8", "label": "set_jointangles()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.3833, 0.0056, 2, 0.67, 0.4286, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, wave_a, 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L70_C8", "label": "sleep()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.3889, 0.0056, 2, 0.67, 0.5, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 1.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L71_C8", "label": "set_jointangles()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.3944, 0.0056, 2, 0.67, 0.5714, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, wave_b, 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L72_C8", "label": "sleep()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.4, 0.0056, 2, 0.67, 0.6429, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 1.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L73_C8", "label": "set_jointangles()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.4056, 0.0056, 2, 0.67, 0.7143, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, wave_a, 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L74_C8", "label": "sleep()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.4111, 0.0056, 2, 0.67, 0.7857, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 1.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L75_C8", "label": "set_jointangles()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.4167, 0.0056, 2, 0.67, 0.8571, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L76_C8", "label": "sleep()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [8, 2, 0.4222, 0.0056, 2, 0.67, 0.9286, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L77_C8", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "vector": [13, 2, 0.4278, 0.0056, 2, 0.67, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "label": "stow", "type": "function", "loc": [81, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.4722, 0.05, 1, 0.73, 0.3, 817, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "stow", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stow( self, msg=None ):\n # Grab object\n self.robot.close_gripper( self.arm )\n rospy.sleep( rospy.Duration( 2.5 ))\n\n # Stow\n self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )\n rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L83_C8", "label": "close_gripper()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "vector": [8, 2, 0.4611, 0.0056, 2, 0.83, 0.0, 807, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "close_gripper", "arg_names": [], "import_names": [], "rhs_call_name": "close_gripper", "annotation": ""}, "snippet": " self.robot.close_gripper( self.arm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L84_C8", "label": "sleep()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "vector": [8, 2, 0.4667, 0.0056, 2, 0.83, 0.25, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.5 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L87_C8", "label": "set_jointangles()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "vector": [8, 2, 0.4833, 0.0056, 2, 0.83, 0.5, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L88_C8", "label": "sleep()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "vector": [8, 2, 0.4889, 0.0056, 2, 0.83, 0.75, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L89_C8", "label": "return", "type": "return", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "vector": [13, 2, 0.4944, 0.0056, 2, 0.83, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "label": "pre_stow", "type": "function", "loc": [91, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.5278, 0.05, 1, 0.73, 0.4, 44, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "pre_stow", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pre_stow( self, msg=None ):\n # Grab object\n self.robot.close_gripper( self.arm )\n rospy.sleep( rospy.Duration( 2.0 ))\n\n # Stow\n self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )\n rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L93_C8", "label": "close_gripper()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "vector": [8, 2, 0.5167, 0.0056, 2, 0.97, 0.0, 807, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "close_gripper", "arg_names": [], "import_names": [], "rhs_call_name": "close_gripper", "annotation": ""}, "snippet": " self.robot.close_gripper( self.arm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L94_C8", "label": "sleep()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "vector": [8, 2, 0.5222, 0.0056, 2, 0.97, 0.25, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L97_C8", "label": "set_jointangles()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "vector": [8, 2, 0.5389, 0.0056, 2, 0.97, 0.5, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L98_C8", "label": "sleep()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "vector": [8, 2, 0.5444, 0.0056, 2, 0.97, 0.75, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L99_C8", "label": "return", "type": "return", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "vector": [13, 2, 0.55, 0.0056, 2, 0.97, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "label": "grasp", "type": "function", "loc": [101, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.5833, 0.05, 1, 0.73, 0.5, 766, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "grasp", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def grasp( self, msg=None ):\n # Grab object\n self.robot.close_gripper( self.arm )\n rospy.sleep( rospy.Duration( 2.0 ))\n\n # Stow\n self.robot.set_jointangles( self.arm, self.grasp_ja, 3.0 )\n rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L103_C8", "label": "close_gripper()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "vector": [8, 2, 0.5722, 0.0056, 2, 0.87, 0.0, 807, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "close_gripper", "arg_names": [], "import_names": [], "rhs_call_name": "close_gripper", "annotation": ""}, "snippet": " self.robot.close_gripper( self.arm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L104_C8", "label": "sleep()", "type": "expression", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "vector": [8, 2, 0.5778, 0.0056, 2, 0.87, 0.25, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L107_C8", "label": "set_jointangles()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "vector": [8, 2, 0.5944, 0.0056, 2, 0.87, 0.5, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.grasp_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L108_C8", "label": "sleep()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "vector": [8, 2, 0.6, 0.0056, 2, 0.87, 0.75, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L109_C8", "label": "return", "type": "return", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "vector": [13, 2, 0.6056, 0.0056, 2, 0.87, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L111_C4", "label": "stow_grasp", "type": "function", "loc": [111, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.6278, 0.0278, 1, 0.73, 0.6, 270, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "stow_grasp", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stow_grasp( self, msg=None ):\n # Stow\n self.robot.set_jointangles( self.arm, self.stowgrasp_ja, 3.0 )\n rospy.sleep( rospy.Duration( 3.0 ))\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L113_C8", "label": "set_jointangles()", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L111_C4", "vector": [8, 2, 0.6278, 0.0056, 2, 0.06, 0.0, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.stowgrasp_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L114_C8", "label": "sleep()", "type": "expression", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L111_C4", "vector": [8, 2, 0.6333, 0.0056, 2, 0.06, 0.5, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L115_C8", "label": "return", "type": "return", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L111_C4", "vector": [13, 2, 0.6389, 0.0056, 2, 0.06, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L118_C4", "label": "open", "type": "function", "loc": [118, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.6611, 0.0167, 1, 0.73, 0.7, 693, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "open", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def open( self ):\n self.robot.open_gripper( self.arm )\n rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L119_C8", "label": "open_gripper()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L118_C4", "vector": [8, 2, 0.6611, 0.0056, 2, 0.33, 0.0, 833, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "open_gripper", "arg_names": [], "import_names": [], "rhs_call_name": "open_gripper", "annotation": ""}, "snippet": " self.robot.open_gripper( self.arm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L120_C8", "label": "sleep()", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L118_C4", "vector": [8, 2, 0.6667, 0.0056, 2, 0.33, 1.0, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L123_C4", "label": "close", "type": "function", "loc": [123, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.6889, 0.0167, 1, 0.73, 0.8, 77, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close( self ):\n self.robot.close_gripper( self.arm )\n rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L124_C8", "label": "close_gripper()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L123_C4", "vector": [8, 2, 0.6889, 0.0056, 2, 0.01, 0.0, 807, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "close_gripper", "arg_names": [], "import_names": [], "rhs_call_name": "close_gripper", "annotation": ""}, "snippet": " self.robot.close_gripper( self.arm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L125_C8", "label": "sleep()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L123_C4", "vector": [8, 2, 0.6944, 0.0056, 2, 0.01, 1.0, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "label": "handoff", "type": "function", "loc": [128, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.7556, 0.0944, 1, 0.73, 0.9, 798, 0, 2, 1, 0, 0, 0, 12], "semantic": {"name": "handoff", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handoff( self, msg = None ):\n # Put into handoff position.\n self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )\n rospy.sleep( rospy.Duration( 3.0 ))\n\n # Tactile Sensor detector\n rospy.sleep( rospy.Duration( 0.5 ))\n self.ts.thresh_detect( 3000 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L130_C8", "label": "set_jointangles()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [8, 2, 0.7222, 0.0056, 2, 0.27, 0.0, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.target_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L131_C8", "label": "sleep()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [8, 2, 0.7278, 0.0056, 2, 0.27, 0.125, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L134_C8", "label": "sleep()", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [8, 2, 0.7444, 0.0056, 2, 0.27, 0.25, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 0.5 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L135_C8", "label": "thresh_detect()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [8, 2, 0.75, 0.0056, 2, 0.27, 0.375, 233, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "thresh_detect", "arg_names": [], "import_names": [], "rhs_call_name": "thresh_detect", "annotation": ""}, "snippet": " self.ts.thresh_detect( 3000 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L138_C8", "label": "open_gripper()", "type": "expression", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [8, 2, 0.7667, 0.0056, 2, 0.27, 0.5, 833, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "open_gripper", "arg_names": [], "import_names": [], "rhs_call_name": "open_gripper", "annotation": ""}, "snippet": " self.robot.open_gripper( self.arm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L139_C8", "label": "sleep()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [8, 2, 0.7722, 0.0056, 2, 0.27, 0.625, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L142_C8", "label": "set_jointangles()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [8, 2, 0.7889, 0.0056, 2, 0.27, 0.75, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L143_C8", "label": "sleep()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [8, 2, 0.7944, 0.0056, 2, 0.27, 0.875, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L144_C8", "label": "return", "type": "return", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "vector": [13, 2, 0.8, 0.0056, 2, 0.27, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "label": "handoff_pos", "type": "function", "loc": [146, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "vector": [2, 1, 0.8778, 0.1389, 1, 0.73, 1.0, 439, 0, 2, 1, 0, 0, 0, 14], "semantic": {"name": "handoff_pos", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handoff_pos( self, msg ):\n #pos = np.matrix([0.6977, -0.03622, 0.2015]).T\n #ang = tr.Rx(math.radians(0.))\n print(msg)\n pos = np.matrix([ msg.x, msg.y, msg.z ]).T\n ang = tr.Rx( msg.ang )\n \n q = [0, 0, 0, 0, 0, 0, 0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L149_C8", "label": "print()", "type": "expression", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [8, 2, 0.8278, 0.0056, 2, 0.93, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L150_C8", "label": "pos =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [14, 2, 0.8333, 0.0056, 2, 0.93, 0.0833, 627, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = np.matrix([ msg.x, msg.y, msg.z ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L151_C8", "label": "ang = Rx()", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [14, 2, 0.8389, 0.0056, 2, 0.93, 0.1667, 762, 3, 1, 0, 0, 820, 10, 1], "semantic": {"name": "ang", "arg_names": [], "import_names": [], "rhs_call_name": "Rx", "annotation": ""}, "snippet": " ang = tr.Rx( msg.ang )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L153_C8", "label": "q =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [14, 2, 0.85, 0.0056, 2, 0.93, 0.25, 516, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q = [0, 0, 0, 0, 0, 0, 0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L154_C8", "label": "j = IK()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [14, 2, 0.8556, 0.0056, 2, 0.93, 0.3333, 100, 3, 4, 0, 0, 719, 10, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "IK", "annotation": ""}, "snippet": " j = self.robot.IK('right_arm', pos, ang, self.target_ja)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L156_C8", "label": "set_jointangles()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [8, 2, 0.8667, 0.0056, 2, 0.93, 0.4167, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( 'right_arm', j, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L159_C8", "label": "sleep()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [8, 2, 0.8833, 0.0056, 2, 0.93, 0.5, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 0.5 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L160_C8", "label": "thresh_detect()", "type": "expression", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [8, 2, 0.8889, 0.0056, 2, 0.93, 0.5833, 233, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "thresh_detect", "arg_names": [], "import_names": [], "rhs_call_name": "thresh_detect", "annotation": ""}, "snippet": " self.ts.thresh_detect( 3000 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L163_C8", "label": "open_gripper()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [8, 2, 0.9056, 0.0056, 2, 0.93, 0.6667, 833, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "open_gripper", "arg_names": [], "import_names": [], "rhs_call_name": "open_gripper", "annotation": ""}, "snippet": " self.robot.open_gripper( self.arm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L164_C8", "label": "sleep()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [8, 2, 0.9111, 0.0056, 2, 0.93, 0.75, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 2.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L167_C8", "label": "set_jointangles()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [8, 2, 0.9278, 0.0056, 2, 0.93, 0.8333, 240, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_jointangles", "arg_names": [], "import_names": [], "rhs_call_name": "set_jointangles", "annotation": ""}, "snippet": " self.robot.set_jointangles( self.arm, self.start_ja, 3.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L168_C8", "label": "sleep()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [8, 2, 0.9333, 0.0056, 2, 0.93, 0.9167, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( rospy.Duration( 3.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L170_C8", "label": "return", "type": "return", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "vector": [13, 2, 0.9444, 0.0056, 2, 0.93, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L174_C0", "label": "if", "type": "if", "loc": [174, 177], "level": 0, "parent": null, "vector": [4, 0, 0.975, 0.0222, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n hon = HandoffNode()\n #hon.handoff_pos()\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L175_C4", "label": "hon = HandoffNode()", "type": "assigned_variable", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L174_C0", "vector": [14, 1, 0.9722, 0.0056, 1, 0.82, 0.0, 207, 3, 0, 0, 0, 436, 10, 1], "semantic": {"name": "hon", "arg_names": [], "import_names": [], "rhs_call_name": "HandoffNode", "annotation": ""}, "snippet": " hon = HandoffNode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L177_C4", "label": "spin()", "type": "expression", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L174_C0", "vector": [8, 1, 0.9833, 0.0056, 1, 0.82, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Return_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99437:If_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99437:Expr_L177_C4"}] |
#!/usr/bin/python
import numpy as np, math
import cPickle as pkl
import yaml
import scipy.stats as stats
class RfidModel:
def __init__( self, yaml_fname ):
# yaml_fname is yaml file something like: cap_360/rad_plot_combined.yaml
# you will need to have run: ./../process_radpat_plots.py --yaml rad_plot_combined.yaml
# which generates rad_plot_combined_MODEL.pkl
# Loading the YAML file that specified how the data is to be processed.
# This file was used to generate the 'use_combined' data set.
f = open( yaml_fname )
yaml_config = yaml.load( f )
f.close()
# Loading condensed data
f = open( yaml_config['use_combined'].replace('.pkl','_MODEL.pkl'), 'r' )
self.model = pkl.load( f )
f.close()
self.default_detect = 0.0 # These will be multiplied. Will be zero outside the model range.
self.default_rssi = 1.0
self.num = 1
def lookup( self, x, y ):
# Note: The xind and yind are flipped for the model ind, since
# the edges are defined from the histogram ( which is
# transposed compared to the models )
xind = np.sum( x > self.model['xedges'] ) - 1
yind = np.sum( y > self.model['yedges'] ) - 1
# Outside the bounds of our model? Return no reads.
if xind < 0 or xind >= len(self.model['xedges'])-1 or yind < 0 or yind >= len(self.model['yedges'])-1:
return ( None, None, None )
# Return value from models.
return ( self.model['detect_model'][yind,xind],
self.model['rssi_model'][yind,xind],
self.model['stddev_model'][yind,xind] )
def sample( self, x, y ):
# Returns a sample (eg. detection yes or no, and RSSI)
detect, rssi, stddev = self.lookup( x, y )
if (not detect) or (not rssi) or (not stddev):
return -1 # No read RSSI
detected = np.random.uniform() <= detect # all the mass below the detection thresh
if not detected:
return -1 # Probability
return np.clip( np.random.normal( loc=rssi, scale=stddev ),
np.min( self.model['rssi_model'] ),
np.max( self.model['rssi_model'] )) # Bound the results by the model bounds
def prob( self, x, y, measurement ):
# Returns the detection and RSSI probabilities given the data-driven model
detect, rssi, stddev = self.lookup( x, y )
if (not detect) or (not rssi) or (not stddev):
return self.default_detect, self.default_rssi
rv = stats.norm( loc = rssi, scale = stddev )
return detect, rv.pdf( measurement )
def weight( self, measurement, particle ):
# particle is 1Dx2: X,Y. Measurement is RSSI
detect_prob, rssi_prob = self.prob( particle[0], particle[1], measurement )
return detect_prob * rssi_prob
def weight_set( self, measurement, particle_set ):
self.num += 1
if self.num % 10 == 0:
print '\tProcessing sample %d' % self.num
xy = particle_set[:,0:2].T # 2xN
# Will automatically snap all particles to nearest bin (will fix below)
bins_ind_x = np.sum( xy[0][:,np.newaxis] > self.model['xedges'][:-1], axis = 1 ) - 1
bins_ind_y = np.sum( xy[1][:,np.newaxis] > self.model['yedges'][:-1], axis = 1 ) - 1
# When the particle is outside the bin edges, lookup => (None, None, None), so
# detect_prob = 0. Thus, handle these cases by setting weight to 0.0
ind_x_less = np.where( xy[0] < self.model['xedges'][0] )[0]
ind_x_more = np.where( xy[0] > self.model['xedges'][-1] )[0]
ind_y_less = np.where( xy[1] < self.model['yedges'][0] )[0]
ind_y_more = np.where( xy[1] > self.model['yedges'][-1] )[0]
# Lookup values from model
detect = self.model['detect_model'][bins_ind_y,bins_ind_x] # bins are flipped from histogram
rssi = self.model['rssi_model'][bins_ind_y,bins_ind_x] # bins are flipped from histogram
stddev = self.model['stddev_model'][bins_ind_y,bins_ind_x] # bins are flipped from histogram
# Detection prob = model + uniform
uniform_detect = 0.2
detect_prob = detect.filled( 0.0 ) # for masked values, we assign a zero probability
detect_prob += uniform_detect
detect_prob[ ind_x_less ] = uniform_detect # When outside the bin edges, assume detect prob is 0.0
detect_prob[ ind_x_more ] = uniform_detect # When outside the bin edges, assume detect prob is 0.0
detect_prob[ ind_y_less ] = uniform_detect # When outside the bin edges, assume detect prob is 0.0
detect_prob[ ind_y_more ] = uniform_detect # When outside the bin edges, assume detect prob is 0.0
detect_prob = np.clip( detect_prob, 0.0, 1.0 ) # force it to be a legit probability (since we're adding two distributions!)
# RSSI prob is gaussian at each cell
uniform_rssi = 0.2
rssi_prob = 1.0 / np.sqrt(2.0 * np.pi * np.power(stddev,2.0))
rssi_prob *= np.exp( -1.0 * np.power( measurement - rssi, 2.0 ) / (2.0*np.power(stddev,2.0)))
rssi_prob = rssi_prob.filled( 0.0 ) # for masked values, we assign a zero probability
rssi_prob += uniform_rssi
rssi_prob[ ind_x_less ] = uniform_rssi # When outside the bin edges, assume detect prob is 0.0
rssi_prob[ ind_x_more ] = uniform_rssi # When outside the bin edges, assume detect prob is 0.0
rssi_prob[ ind_y_less ] = uniform_rssi # When outside the bin edges, assume detect prob is 0.0
rssi_prob[ ind_y_more ] = uniform_rssi # When outside the bin edges, assume detect prob is 0.0
rssi_prob = np.clip( rssi_prob, 0.0, 1.0 ) # force it to be a legit probability (since we're adding two distributions!)
# Weight is multiplication of the two
weight = detect_prob * rssi_prob
# Setting the probability to 0.0 is harsh (it kills any later updates).
# Add a small (uniform) distribution to account for this.
# minw = np.min( weight[np.where( weight > 1e-20 )] ) * 0.9
# weight = np.clip( weight, minw, np.max( weight ))
# Update particle_set in-place
particle_set[:,2] *= weight
# particle_set[:,2] = np.clip( particle_set[:,2], 1e-10, np.max(particle_set[:,2]) )
# Normalize so that the sum is 1.0
particle_set[:,2] /= np.sum( particle_set[:,2] )
return np.copy( particle_set )
yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/rad_pattern_cap/rad_plot_shoulder_table_both_SpectrMedBot.yaml'
# yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/rad_plot_shoulder_left_datacap2.yaml'
# yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/cap_360/rad_plot_combined.yaml'
#yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_pf/src/rfid_pf/pencil_beam_model.yaml'
class NoMotion:
def __init__( self ):
print 'Starting NoMotion.'
def predict_set( self, control, p_set ):
return p_set
if __name__ == '__main__':
import time
X,Y = np.meshgrid( np.arange(-10,10,0.1), np.arange(-10,10,0.1))
xyw = np.row_stack([ X.flatten(), Y.flatten(), np.ones( X.shape ).flatten() ]).T
def test1( rm, measurement, particles ):
t0 = time.time()
w = np.array([ rm.weight( measurement, p[0:2] ) for p in particles ])
rv = np.column_stack([ particles[:,0:2], w ])
td = time.time() - t0
return rv, td
def test2( rm, measurement, particles ):
t0 = time.time()
rv = rm.weight_set( measurement, particles )
td = time.time() - t0
return rv, td
rm = RfidModel( yaml_fname )
print 'Starting 1'
r1,t1 = test1( rm, 80, xyw )
print 'Done 1 in %2.2f sec.' % t1
print 'Starting 2'
r2,t2 = test2( rm, 80, xyw )
print 'Done 2 in %2.2f sec.' % t2
print 'Speedup: %3.2fx' % (t1 / t2)
| ajibawa-2023/Python-Code-Large/train/row_99438 | 97 | 205 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Import_L3_C0", "label": "numpy import np, math", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0146, 0.0049, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Import_L4_C0", "label": "cPickle import pkl", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0195, 0.0049, 0, 0.66, 0.1429, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Import_L5_C0", "label": "yaml import yaml", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0049, 0, 0.66, 0.2857, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Import_L6_C0", "label": "scipy.stats import stats", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0293, 0.0049, 0, 0.66, 0.4286, 413, 0, 1, 0, 0, 413, 0, 0], "semantic": {"name": "scipy.stats", "arg_names": [], "import_names": ["stats"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.stats as stats"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "label": "RfidModel", "type": "class", "loc": [8, 157], "level": 0, "parent": null, "vector": [3, 0, 0.4024, 0.7317, 0, 0.66, 0.5714, 536, 0, 6, 0, 0, 0, 0, 39], "semantic": {"name": "RfidModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RfidModel:\n def __init__( self, yaml_fname ):\n # yaml_fname is yaml file something like: cap_360/rad_plot_combined.yaml\n # you will need to have run: ./../process_radpat_plots.py --yaml rad_plot_combined.yaml\n # which generates rad_plot_combined_MODEL.pkl\n\n # Loading the YAML file that specified how the data is to be processed.\n # This file was used to generate the 'use_combined' data set."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "label": "__init__", "type": "function", "loc": [9, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "vector": [2, 1, 0.0976, 0.1122, 1, 0.22, 0.0, 555, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "yaml_fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, yaml_fname ):\n # yaml_fname is yaml file something like: cap_360/rad_plot_combined.yaml\n # you will need to have run: ./../process_radpat_plots.py --yaml rad_plot_combined.yaml\n # which generates rad_plot_combined_MODEL.pkl\n\n # Loading the YAML file that specified how the data is to be processed.\n # This file was used to generate the 'use_combined' data set.\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L17_C8", "label": "f = open()", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [14, 2, 0.0829, 0.0049, 2, 0.62, 0.0, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L18_C8", "label": "yaml_config = load()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [14, 2, 0.0878, 0.0049, 2, 0.62, 0.125, 248, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "yaml_config", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " yaml_config = yaml.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L19_C8", "label": "close()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [8, 2, 0.0927, 0.0049, 2, 0.62, 0.25, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L24_C8", "label": "f = open()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [14, 2, 0.1171, 0.0049, 2, 0.62, 0.375, 899, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( yaml_config['use_combined'].replace('.pkl','_MODEL.pkl'), 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L25_C8", "label": "self.model = load()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [14, 2, 0.122, 0.0049, 2, 0.62, 0.5, 81, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "self.model", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " self.model = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L26_C8", "label": "close()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [8, 2, 0.1268, 0.0049, 2, 0.62, 0.625, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L28_C8", "label": "self.default_detect =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [14, 2, 0.1366, 0.0049, 2, 0.62, 0.75, 927, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.default_detect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default_detect = 0.0 # These will be multiplied. Will be zero outside the model range."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L29_C8", "label": "self.default_rssi =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [14, 2, 0.1415, 0.0049, 2, 0.62, 0.875, 730, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.default_rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default_rssi = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L31_C8", "label": "self.num =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "vector": [14, 2, 0.1512, 0.0049, 2, 0.62, 1.0, 970, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.num = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "label": "lookup", "type": "function", "loc": [36, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "vector": [2, 1, 0.2098, 0.0732, 1, 0.22, 0.2, 955, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "lookup", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup( self, x, y ):\n # Note: The xind and yind are flipped for the model ind, since\n # the edges are defined from the histogram ( which is\n # transposed compared to the models )\n xind = np.sum( x > self.model['xedges'] ) - 1\n yind = np.sum( y > self.model['yedges'] ) - 1\n\n # Outside the bounds of our model? Return no reads."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L40_C8", "label": "xind =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "vector": [14, 2, 0.1951, 0.0049, 2, 0.33, 0.0, 831, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xind = np.sum( x > self.model['xedges'] ) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L41_C8", "label": "yind =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "vector": [14, 2, 0.2, 0.0049, 2, 0.33, 0.3333, 693, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "yind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yind = np.sum( y > self.model['yedges'] ) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L44_C8", "label": "if", "type": "if", "loc": [44, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "vector": [4, 2, 0.2171, 0.0098, 2, 0.33, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if xind < 0 or xind >= len(self.model['xedges'])-1 or yind < 0 or yind >= len(self.model['yedges'])-1:\n return ( None, None, None )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L45_C12", "label": "return", "type": "return", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L44_C8", "vector": [13, 3, 0.2195, 0.0049, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ( None, None, None )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "vector": [13, 2, 0.239, 0.0146, 2, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ( self.model['detect_model'][yind,xind],\n self.model['rssi_model'][yind,xind],\n self.model['stddev_model'][yind,xind] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "label": "sample", "type": "function", "loc": [52, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "vector": [2, 1, 0.2829, 0.0634, 1, 0.22, 0.4, 513, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "sample", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sample( self, x, y ):\n # Returns a sample (eg. detection yes or no, and RSSI)\n detect, rssi, stddev = self.lookup( x, y )\n if (not detect) or (not rssi) or (not stddev):\n return -1 # No read RSSI\n\n detected = np.random.uniform() <= detect # all the mass below the detection thresh\n if not detected:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L54_C8", "label": "detect, rssi, stddev = lookup()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "vector": [14, 2, 0.2634, 0.0049, 2, 0.8, 0.0, 683, 3, 2, 0, 0, 955, 10, 1], "semantic": {"name": "detect, rssi, stddev", "arg_names": [], "import_names": [], "rhs_call_name": "lookup", "annotation": ""}, "snippet": " detect, rssi, stddev = self.lookup( x, y )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L55_C8", "label": "if", "type": "if", "loc": [55, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "vector": [4, 2, 0.2707, 0.0098, 2, 0.8, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not detect) or (not rssi) or (not stddev):\n return -1 # No read RSSI"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L56_C12", "label": "return", "type": "return", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L55_C8", "vector": [13, 3, 0.2732, 0.0049, 3, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -1 # No read RSSI"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L58_C8", "label": "detected =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "vector": [14, 2, 0.2829, 0.0049, 2, 0.8, 0.5, 856, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "detected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " detected = np.random.uniform() <= detect # all the mass below the detection thresh"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L59_C8", "label": "if", "type": "if", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "vector": [4, 2, 0.2902, 0.0098, 2, 0.8, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not detected:\n return -1 # Probability"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L60_C12", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L59_C8", "vector": [13, 3, 0.2927, 0.0049, 3, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -1 # Probability"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L62_C8", "label": "return", "type": "return", "loc": [62, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "vector": [13, 2, 0.3073, 0.0146, 2, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.clip( np.random.normal( loc=rssi, scale=stddev ),\n np.min( self.model['rssi_model'] ),\n np.max( self.model['rssi_model'] )) # Bound the results by the model bounds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "label": "prob", "type": "function", "loc": [67, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "vector": [2, 1, 0.3439, 0.039, 1, 0.22, 0.6, 24, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "prob", "arg_names": ["self", "x", "y", "measurement"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prob( self, x, y, measurement ):\n # Returns the detection and RSSI probabilities given the data-driven model\n detect, rssi, stddev = self.lookup( x, y )\n if (not detect) or (not rssi) or (not stddev):\n return self.default_detect, self.default_rssi\n\n rv = stats.norm( loc = rssi, scale = stddev )\n return detect, rv.pdf( measurement )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L69_C8", "label": "detect, rssi, stddev = lookup()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "vector": [14, 2, 0.3366, 0.0049, 2, 0.06, 0.0, 683, 3, 2, 0, 0, 955, 10, 1], "semantic": {"name": "detect, rssi, stddev", "arg_names": [], "import_names": [], "rhs_call_name": "lookup", "annotation": ""}, "snippet": " detect, rssi, stddev = self.lookup( x, y )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L70_C8", "label": "if", "type": "if", "loc": [70, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "vector": [4, 2, 0.3439, 0.0098, 2, 0.06, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not detect) or (not rssi) or (not stddev):\n return self.default_detect, self.default_rssi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L71_C12", "label": "return", "type": "return", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L70_C8", "vector": [13, 3, 0.3463, 0.0049, 3, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.default_detect, self.default_rssi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L73_C8", "label": "rv = norm()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "vector": [14, 2, 0.3561, 0.0049, 2, 0.06, 0.6667, 222, 3, 2, 0, 0, 902, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " rv = stats.norm( loc = rssi, scale = stddev )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L74_C8", "label": "return", "type": "return", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "vector": [13, 2, 0.361, 0.0049, 2, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return detect, rv.pdf( measurement )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L77_C4", "label": "weight", "type": "function", "loc": [77, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "vector": [2, 1, 0.3829, 0.0195, 1, 0.22, 0.8, 205, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "weight", "arg_names": ["self", "measurement", "particle"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def weight( self, measurement, particle ):\n # particle is 1Dx2: X,Y. Measurement is RSSI\n detect_prob, rssi_prob = self.prob( particle[0], particle[1], measurement )\n return detect_prob * rssi_prob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L79_C8", "label": "detect_prob, rssi_prob = prob()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L77_C4", "vector": [14, 2, 0.3854, 0.0049, 2, 0.38, 0.0, 79, 3, 3, 0, 0, 24, 10, 1], "semantic": {"name": "detect_prob, rssi_prob", "arg_names": [], "import_names": [], "rhs_call_name": "prob", "annotation": ""}, "snippet": " detect_prob, rssi_prob = self.prob( particle[0], particle[1], measurement )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L80_C8", "label": "return", "type": "return", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L77_C4", "vector": [13, 2, 0.3902, 0.0049, 2, 0.38, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return detect_prob * rssi_prob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "label": "weight_set", "type": "function", "loc": [84, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "vector": [2, 1, 0.5878, 0.361, 1, 0.22, 1.0, 278, 0, 3, 1, 0, 0, 0, 18], "semantic": {"name": "weight_set", "arg_names": ["self", "measurement", "particle_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def weight_set( self, measurement, particle_set ):\n self.num += 1\n if self.num % 10 == 0:\n print('\\tProcessing sample %d' % self.num)\n \n xy = particle_set[:,0:2].T # 2xN\n\n # Will automatically snap all particles to nearest bin (will fix below)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L86_C8", "label": "if", "type": "if", "loc": [86, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [4, 2, 0.422, 0.0098, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.num % 10 == 0:\n print('\\tProcessing sample %d' % self.num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L87_C12", "label": "print()", "type": "expression", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L86_C8", "vector": [8, 3, 0.4244, 0.0049, 3, 0.5, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tProcessing sample %d' % self.num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L89_C8", "label": "xy =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.4341, 0.0049, 2, 0.46, 0.037, 358, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xy = particle_set[:,0:2].T # 2xN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L92_C8", "label": "bins_ind_x =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.4488, 0.0049, 2, 0.46, 0.0741, 920, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bins_ind_x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bins_ind_x = np.sum( xy[0][:,np.newaxis] > self.model['xedges'][:-1], axis = 1 ) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L93_C8", "label": "bins_ind_y =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.4537, 0.0049, 2, 0.46, 0.1111, 80, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bins_ind_y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bins_ind_y = np.sum( xy[1][:,np.newaxis] > self.model['yedges'][:-1], axis = 1 ) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L97_C8", "label": "ind_x_less =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.4732, 0.0049, 2, 0.46, 0.1481, 416, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind_x_less", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind_x_less = np.where( xy[0] < self.model['xedges'][0] )[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L98_C8", "label": "ind_x_more =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.478, 0.0049, 2, 0.46, 0.1852, 138, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind_x_more", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind_x_more = np.where( xy[0] > self.model['xedges'][-1] )[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L99_C8", "label": "ind_y_less =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.4829, 0.0049, 2, 0.46, 0.2222, 945, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind_y_less", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind_y_less = np.where( xy[1] < self.model['yedges'][0] )[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L100_C8", "label": "ind_y_more =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.4878, 0.0049, 2, 0.46, 0.2593, 273, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind_y_more", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind_y_more = np.where( xy[1] > self.model['yedges'][-1] )[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L103_C8", "label": "detect =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5024, 0.0049, 2, 0.46, 0.2963, 654, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "detect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " detect = self.model['detect_model'][bins_ind_y,bins_ind_x] # bins are flipped from histogram"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L104_C8", "label": "rssi =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5073, 0.0049, 2, 0.46, 0.3333, 906, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rssi = self.model['rssi_model'][bins_ind_y,bins_ind_x] # bins are flipped from histogram"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L105_C8", "label": "stddev =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5122, 0.0049, 2, 0.46, 0.3704, 990, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "stddev", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stddev = self.model['stddev_model'][bins_ind_y,bins_ind_x] # bins are flipped from histogram"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L108_C8", "label": "uniform_detect =", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5268, 0.0049, 2, 0.46, 0.4074, 4, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "uniform_detect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " uniform_detect = 0.2 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L110_C8", "label": "detect_prob = filled()", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5366, 0.0049, 2, 0.46, 0.4444, 347, 3, 1, 0, 0, 984, 10, 1], "semantic": {"name": "detect_prob", "arg_names": [], "import_names": [], "rhs_call_name": "filled", "annotation": ""}, "snippet": " detect_prob = detect.filled( 0.0 ) # for masked values, we assign a zero probability"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L113_C8", "label": "assign", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5512, 0.0049, 2, 0.46, 0.4815, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " detect_prob[ ind_x_less ] = uniform_detect # When outside the bin edges, assume detect prob is 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L114_C8", "label": "assign", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5561, 0.0049, 2, 0.46, 0.5185, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " detect_prob[ ind_x_more ] = uniform_detect # When outside the bin edges, assume detect prob is 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L115_C8", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.561, 0.0049, 2, 0.46, 0.5556, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " detect_prob[ ind_y_less ] = uniform_detect # When outside the bin edges, assume detect prob is 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L116_C8", "label": "assign", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5659, 0.0049, 2, 0.46, 0.5926, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " detect_prob[ ind_y_more ] = uniform_detect # When outside the bin edges, assume detect prob is 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L118_C8", "label": "detect_prob = clip()", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5756, 0.0049, 2, 0.46, 0.6296, 347, 3, 3, 0, 0, 689, 10, 1], "semantic": {"name": "detect_prob", "arg_names": [], "import_names": [], "rhs_call_name": "clip", "annotation": ""}, "snippet": " detect_prob = np.clip( detect_prob, 0.0, 1.0 ) # force it to be a legit probability (since we're adding two distributions!)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L122_C8", "label": "uniform_rssi =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.5951, 0.0049, 2, 0.46, 0.6667, 414, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "uniform_rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " uniform_rssi = 0.2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L124_C8", "label": "rssi_prob =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.6049, 0.0049, 2, 0.46, 0.7037, 553, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "rssi_prob", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rssi_prob = 1.0 / np.sqrt(2.0 * np.pi * np.power(stddev,2.0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L127_C8", "label": "rssi_prob = filled()", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.6195, 0.0049, 2, 0.46, 0.7407, 553, 3, 1, 0, 0, 984, 10, 1], "semantic": {"name": "rssi_prob", "arg_names": [], "import_names": [], "rhs_call_name": "filled", "annotation": ""}, "snippet": " rssi_prob = rssi_prob.filled( 0.0 ) # for masked values, we assign a zero probability"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L130_C8", "label": "assign", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.6341, 0.0049, 2, 0.46, 0.7778, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rssi_prob[ ind_x_less ] = uniform_rssi # When outside the bin edges, assume detect prob is 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L131_C8", "label": "assign", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.639, 0.0049, 2, 0.46, 0.8148, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rssi_prob[ ind_x_more ] = uniform_rssi # When outside the bin edges, assume detect prob is 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L132_C8", "label": "assign", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.6439, 0.0049, 2, 0.46, 0.8519, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rssi_prob[ ind_y_less ] = uniform_rssi # When outside the bin edges, assume detect prob is 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L133_C8", "label": "assign", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.6488, 0.0049, 2, 0.46, 0.8889, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rssi_prob[ ind_y_more ] = uniform_rssi # When outside the bin edges, assume detect prob is 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L135_C8", "label": "rssi_prob = clip()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.6585, 0.0049, 2, 0.46, 0.9259, 553, 3, 3, 0, 0, 689, 10, 1], "semantic": {"name": "rssi_prob", "arg_names": [], "import_names": [], "rhs_call_name": "clip", "annotation": ""}, "snippet": " rssi_prob = np.clip( rssi_prob, 0.0, 1.0 ) # force it to be a legit probability (since we're adding two distributions!)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L140_C8", "label": "weight =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [14, 2, 0.6829, 0.0049, 2, 0.46, 0.963, 205, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "weight", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " weight = detect_prob * rssi_prob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L157_C8", "label": "return", "type": "return", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "vector": [13, 2, 0.7659, 0.0049, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.copy( particle_set )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L159_C0", "label": "yaml_fname =", "type": "assigned_variable", "loc": [159, 159], "level": 0, "parent": null, "vector": [14, 0, 0.7756, 0.0049, 0, 0.66, 0.7143, 590, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "yaml_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "yaml_fname = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/rad_pattern_cap/rad_plot_shoulder_table_both_SpectrMedBot.yaml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L164_C0", "label": "NoMotion", "type": "class", "loc": [164, 169], "level": 0, "parent": null, "vector": [3, 0, 0.8122, 0.0293, 0, 0.66, 0.8571, 932, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "NoMotion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NoMotion:\n def __init__( self ):\n print('Starting NoMotion.')\n\n def predict_set( self, control, p_set ):\n return p_set"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L165_C4", "label": "__init__", "type": "function", "loc": [165, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L164_C0", "vector": [2, 1, 0.8073, 0.0098, 1, 0.6, 0.0, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self ):\n print('Starting NoMotion.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L166_C8", "label": "print()", "type": "expression", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L165_C4", "vector": [8, 2, 0.8098, 0.0049, 2, 0.43, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting NoMotion.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L168_C4", "label": "predict_set", "type": "function", "loc": [168, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L164_C0", "vector": [2, 1, 0.822, 0.0098, 1, 0.6, 1.0, 874, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "predict_set", "arg_names": ["self", "control", "p_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def predict_set( self, control, p_set ):\n return p_set"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L169_C8", "label": "return", "type": "return", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L168_C4", "vector": [13, 2, 0.8244, 0.0049, 2, 0.49, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return p_set"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "label": "if", "type": "if", "loc": [173, 205], "level": 0, "parent": null, "vector": [4, 0, 0.922, 0.161, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import time\n\n X,Y = np.meshgrid( np.arange(-10,10,0.1), np.arange(-10,10,0.1))\n xyw = np.row_stack([ X.flatten(), Y.flatten(), np.ones( X.shape ).flatten() ]).T\n def test1( rm, measurement, particles ):\n t0 = time.time()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Import_L174_C4", "label": "time import time", "type": "import", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [1, 1, 0.8488, 0.0049, 1, 0.23, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": " import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L176_C4", "label": "X, Y = meshgrid()", "type": "assigned_variable", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [14, 1, 0.8585, 0.0049, 1, 0.23, 0.0833, 835, 3, 2, 0, 0, 500, 10, 3], "semantic": {"name": "X, Y", "arg_names": [], "import_names": [], "rhs_call_name": "meshgrid", "annotation": ""}, "snippet": " X,Y = np.meshgrid( np.arange(-10,10,0.1), np.arange(-10,10,0.1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L177_C4", "label": "xyw =", "type": "assigned_variable", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [14, 1, 0.8634, 0.0049, 1, 0.23, 0.1667, 931, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "xyw", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xyw = np.row_stack([ X.flatten(), Y.flatten(), np.ones( X.shape ).flatten() ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "label": "test1", "type": "function", "loc": [178, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [2, 1, 0.8854, 0.039, 1, 0.23, 0.25, 410, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "test1", "arg_names": ["rm", "measurement", "particles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test1( rm, measurement, particles ):\n t0 = time.time()\n\n w = np.array([ rm.weight( measurement, p[0:2] ) for p in particles ])\n rv = np.column_stack([ particles[:,0:2], w ])\n\n td = time.time() - t0\n return rv, td"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L179_C8", "label": "t0 = time()", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "vector": [14, 2, 0.8732, 0.0049, 2, 0.75, 0.0, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L181_C8", "label": "w = array()", "type": "assigned_variable", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "vector": [14, 2, 0.8829, 0.0049, 2, 0.75, 0.25, 549, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " w = np.array([ rm.weight( measurement, p[0:2] ) for p in particles ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L182_C8", "label": "rv = column_stack()", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "vector": [14, 2, 0.8878, 0.0049, 2, 0.75, 0.5, 222, 3, 1, 0, 0, 724, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": " rv = np.column_stack([ particles[:,0:2], w ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L184_C8", "label": "td =", "type": "assigned_variable", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "vector": [14, 2, 0.8976, 0.0049, 2, 0.75, 0.75, 102, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "td", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " td = time.time() - t0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L185_C8", "label": "return", "type": "return", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "vector": [13, 2, 0.9024, 0.0049, 2, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv, td"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "label": "test2", "type": "function", "loc": [187, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [2, 1, 0.9268, 0.0341, 1, 0.23, 0.3333, 869, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "test2", "arg_names": ["rm", "measurement", "particles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test2( rm, measurement, particles ):\n t0 = time.time()\n\n rv = rm.weight_set( measurement, particles )\n\n td = time.time() - t0\n return rv, td"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L188_C8", "label": "t0 = time()", "type": "assigned_variable", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "vector": [14, 2, 0.9171, 0.0049, 2, 0.01, 0.0, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L190_C8", "label": "rv = weight_set()", "type": "assigned_variable", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "vector": [14, 2, 0.9268, 0.0049, 2, 0.01, 0.3333, 222, 3, 2, 0, 0, 278, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "weight_set", "annotation": ""}, "snippet": " rv = rm.weight_set( measurement, particles )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L192_C8", "label": "td =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "vector": [14, 2, 0.9366, 0.0049, 2, 0.01, 0.6667, 102, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "td", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " td = time.time() - t0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L193_C8", "label": "return", "type": "return", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "vector": [13, 2, 0.9415, 0.0049, 2, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv, td"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L195_C4", "label": "rm = RfidModel()", "type": "assigned_variable", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [14, 1, 0.9512, 0.0049, 1, 0.23, 0.4167, 159, 3, 1, 0, 0, 536, 10, 1], "semantic": {"name": "rm", "arg_names": [], "import_names": [], "rhs_call_name": "RfidModel", "annotation": ""}, "snippet": " rm = RfidModel( yaml_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L197_C4", "label": "print()", "type": "expression", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [8, 1, 0.961, 0.0049, 1, 0.23, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting 1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L198_C4", "label": "r1, t1 = test1()", "type": "assigned_variable", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [14, 1, 0.9659, 0.0049, 1, 0.23, 0.5833, 234, 3, 3, 0, 0, 410, 10, 1], "semantic": {"name": "r1, t1", "arg_names": [], "import_names": [], "rhs_call_name": "test1", "annotation": ""}, "snippet": " r1,t1 = test1( rm, 80, xyw )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L199_C4", "label": "print()", "type": "expression", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [8, 1, 0.9707, 0.0049, 1, 0.23, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done 1 in %2.2f sec.' % t1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L201_C4", "label": "print()", "type": "expression", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [8, 1, 0.9805, 0.0049, 1, 0.23, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting 2')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L202_C4", "label": "r2, t2 = test2()", "type": "assigned_variable", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [14, 1, 0.9854, 0.0049, 1, 0.23, 0.8333, 905, 3, 3, 0, 0, 869, 10, 1], "semantic": {"name": "r2, t2", "arg_names": [], "import_names": [], "rhs_call_name": "test2", "annotation": ""}, "snippet": " r2,t2 = test2( rm, 80, xyw )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L203_C4", "label": "print()", "type": "expression", "loc": [203, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [8, 1, 0.9902, 0.0049, 1, 0.23, 0.9167, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done 2 in %2.2f sec.' % t2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L205_C4", "label": "print()", "type": "expression", "loc": [205, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "vector": [8, 1, 1.0, 0.0049, 1, 0.23, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Speedup: %3.2fx' % (t1 / t2))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:ClassDef_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Import_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Return_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Assign_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99438:If_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99438:Expr_L205_C4"}] |
#!/usr/bin/python
## I'm less than enthused about the ("optimization") bloat in
## hrl/pfilter. This implementation draws from that one, but
## eliminates a bunch of cruft and focuses on our particular details.
import random as rd
import numpy as np, math
class PFilter:
def __init__(self, motion_model, measurement_model, particles):
self.motion_model = motion_model # class. Provides 'predict' method: 1Dx2 particle -> 1Dx2 particle
self.measurement_model = measurement_model # class. Provides 'weight' method: 1Dx2 particle, measurement -> double
# Particles. Should be np.matrix Nx3: [[X,Y,Weight],...]
self.p = particles
def motion( self, control_input ):
print 'Motioning'
new_xy = np.row_stack([ self.motion_model.predict( i[0:2] ) # for each [X,Y].T => new [X,Y].T
for i in self.p ]) # stack them into Nx2
new_p = np.column_stack([ new_xy, self.p[:,2] ]) # Particles keep weights => 3xN
self.p = np.copy( new_p )
return np.copy( new_p )
def measurement( self, measurement ):
# Takes in a single measurement, computes new weights for each
# particle and combines them (multplicative) with the old weights.
print 'Measuring.'
w = np.array([ self.measurement_model.weight( measurement, i[0:2] ) for i in self.p ])
new_w = self.p[:,2] * w
new_p = np.column_stack([ self.p[:,0:2], new_w ])
self.p = np.copy( new_p )
return np.copy( new_p )
def resample( self ):
print 'Resampling'
weighted_set = [ ( i[0:2], i[2] ) for i in self.p ]
normalized_set = normalize_likelihood(weighted_set)
new_xy = np.row_stack([ i for i in resample_uss( len(self.p), normalized_set )])
new_p = np.column_stack([ new_xy, np.ones( new_xy.shape[0] ) ])
self.p = np.copy( new_p )
return np.copy( new_p )
def step( self, control_input, measurement ):
self.motion( control_input )
self.measurement( measurement )
self.resample()
def resample_uss(num_samples, particles):
"""
Universal stochastic sampler (low variance resampling)
num_samples - number of samples desired
particles - pairs of (state, weight) tuples
"""
samples = []
r = rd.random() * (1.0 / float(num_samples))
c = (particles[0])[1]
i = 0
for m in xrange(num_samples):
U = r + m * (1.0 / float(num_samples))
#print "U", U
while U > c:
i = i + 1
if i >= len(particles):
i = 0
c = c + (particles[i])[1]
samples.append((particles[i])[0])
return samples
def normalize_likelihood(weighted_particles):
""" Make all the particle weights sum up to 1 """
def add(a,b):
apart, aw = a
bpart, bw = b
return ('', aw+bw)
total_weight = (reduce(add, weighted_particles, ('',0.0)))[1]
def normalize(a):
part, weight = a
return (part, weight/total_weight)
return map(normalize, weighted_particles)
class NoMotion:
def __init__( self ):
print 'Starting NoMotion.'
def predict( self, p ):
return p
class NoMeasure:
def __init__( self ):
print 'Starting NoMeasure.'
def weight( self, p, m ):
return 0.5
if __name__ == '__main__':
X,Y = np.meshgrid( np.linspace(0,3,4),
np.linspace(0,3,4) )
xyw = np.row_stack([ X.flatten(), # Build Nx3
Y.flatten(),
np.ones( X.shape ).flatten() ]).T # weights (multiplicative)
pf = PFilter( NoMotion(), NoMeasure(), xyw )
pf.motion( 0 )
pf.measurement( 0 )
pf.resample()
print pf.p
pf.measurement( 0 )
pf.p[0,2] = 5 # 10 times more likely
pf.resample()
print pf.p
| ajibawa-2023/Python-Code-Large/train/row_99439 | 80 | 122 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Import_L7_C0", "label": "random import rd", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0574, 0.0082, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["rd"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random as rd"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Import_L8_C0", "label": "numpy import np, math", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0656, 0.0082, 0, 0.66, 0.1429, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "label": "PFilter", "type": "class", "loc": [10, 50], "level": 0, "parent": null, "vector": [3, 0, 0.2459, 0.3361, 0, 0.66, 0.2857, 298, 0, 5, 0, 0, 0, 0, 24], "semantic": {"name": "PFilter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PFilter:\n def __init__(self, motion_model, measurement_model, particles):\n self.motion_model = motion_model # class. Provides 'predict' method: 1Dx2 particle -> 1Dx2 particle\n self.measurement_model = measurement_model # class. Provides 'weight' method: 1Dx2 particle, measurement -> double\n\n # Particles. Should be np.matrix Nx3: [[X,Y,Weight],...]\n self.p = particles\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L11_C4", "label": "__init__", "type": "function", "loc": [11, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "vector": [2, 1, 0.1107, 0.0492, 1, 0.56, 0.0, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "motion_model", "measurement_model", "particles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, motion_model, measurement_model, particles):\n self.motion_model = motion_model # class. Provides 'predict' method: 1Dx2 particle -> 1Dx2 particle\n self.measurement_model = measurement_model # class. Provides 'weight' method: 1Dx2 particle, measurement -> double\n\n # Particles. Should be np.matrix Nx3: [[X,Y,Weight],...]\n self.p = particles"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L12_C8", "label": "self.motion_model =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L11_C4", "vector": [14, 2, 0.0984, 0.0082, 2, 0.24, 0.0, 427, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.motion_model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.motion_model = motion_model # class. Provides 'predict' method: 1Dx2 particle -> 1Dx2 particle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L13_C8", "label": "self.measurement_model =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L11_C4", "vector": [14, 2, 0.1066, 0.0082, 2, 0.24, 0.5, 432, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.measurement_model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.measurement_model = measurement_model # class. Provides 'weight' method: 1Dx2 particle, measurement -> double"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L16_C8", "label": "self.p =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L11_C4", "vector": [14, 2, 0.1311, 0.0082, 2, 0.24, 1.0, 657, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.p = particles"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "label": "motion", "type": "function", "loc": [18, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "vector": [2, 1, 0.1721, 0.0574, 1, 0.56, 0.25, 759, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "motion", "arg_names": ["self", "control_input"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def motion( self, control_input ):\n print('Motioning')\n new_xy = np.row_stack([ self.motion_model.predict( i[0:2] ) # for each [X,Y].T => new [X,Y].T\n for i in self.p ]) # stack them into Nx2\n new_p = np.column_stack([ new_xy, self.p[:,2] ]) # Particles keep weights => 3xN\n self.p = np.copy( new_p )\n return np.copy( new_p )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L19_C8", "label": "print()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "vector": [8, 2, 0.1557, 0.0082, 2, 0.54, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Motioning')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L20_C8", "label": "new_xy = row_stack()", "type": "assigned_variable", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "vector": [14, 2, 0.168, 0.0164, 2, 0.54, 0.25, 787, 3, 1, 0, 0, 612, 10, 2], "semantic": {"name": "new_xy", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": " new_xy = np.row_stack([ self.motion_model.predict( i[0:2] ) # for each [X,Y].T => new [X,Y].T\n for i in self.p ]) # stack them into Nx2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L22_C8", "label": "new_p = column_stack()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "vector": [14, 2, 0.1803, 0.0082, 2, 0.54, 0.5, 535, 3, 1, 0, 0, 724, 10, 1], "semantic": {"name": "new_p", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": " new_p = np.column_stack([ new_xy, self.p[:,2] ]) # Particles keep weights => 3xN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L23_C8", "label": "self.p = copy()", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "vector": [14, 2, 0.1885, 0.0082, 2, 0.54, 0.75, 657, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "self.p", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self.p = np.copy( new_p )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "vector": [13, 2, 0.1967, 0.0082, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.copy( new_p )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "label": "measurement", "type": "function", "loc": [26, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "vector": [2, 1, 0.25, 0.082, 1, 0.56, 0.5, 938, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "measurement", "arg_names": ["self", "measurement"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def measurement( self, measurement ):\n # Takes in a single measurement, computes new weights for each\n # particle and combines them (multplicative) with the old weights.\n print('Measuring.')\n w = np.array([ self.measurement_model.weight( measurement, i[0:2] ) for i in self.p ])\n new_w = self.p[:,2] * w\n\n new_p = np.column_stack([ self.p[:,0:2], new_w ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L29_C8", "label": "print()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "vector": [8, 2, 0.2377, 0.0082, 2, 0.12, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Measuring.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L30_C8", "label": "w = array()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "vector": [14, 2, 0.2459, 0.0082, 2, 0.12, 0.2, 549, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " w = np.array([ self.measurement_model.weight( measurement, i[0:2] ) for i in self.p ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L31_C8", "label": "new_w =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "vector": [14, 2, 0.2541, 0.0082, 2, 0.12, 0.4, 563, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_w = self.p[:,2] * w"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L33_C8", "label": "new_p = column_stack()", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "vector": [14, 2, 0.2705, 0.0082, 2, 0.12, 0.6, 535, 3, 1, 0, 0, 724, 10, 1], "semantic": {"name": "new_p", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": " new_p = np.column_stack([ self.p[:,0:2], new_w ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L34_C8", "label": "self.p = copy()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "vector": [14, 2, 0.2787, 0.0082, 2, 0.12, 0.8, 657, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "self.p", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self.p = np.copy( new_p )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L35_C8", "label": "return", "type": "return", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "vector": [13, 2, 0.2869, 0.0082, 2, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.copy( new_p )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "label": "resample", "type": "function", "loc": [37, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "vector": [2, 1, 0.3361, 0.0738, 1, 0.56, 0.75, 342, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "resample", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def resample( self ):\n print('Resampling')\n weighted_set = [ ( i[0:2], i[2] ) for i in self.p ]\n normalized_set = normalize_likelihood(weighted_set)\n \n new_xy = np.row_stack([ i for i in resample_uss( len(self.p), normalized_set )])\n new_p = np.column_stack([ new_xy, np.ones( new_xy.shape[0] ) ])\n self.p = np.copy( new_p )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L38_C8", "label": "print()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "vector": [8, 2, 0.3115, 0.0082, 2, 0.15, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Resampling')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L39_C8", "label": "weighted_set =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "vector": [14, 2, 0.3197, 0.0082, 2, 0.15, 0.1667, 143, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "weighted_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " weighted_set = [ ( i[0:2], i[2] ) for i in self.p ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L40_C8", "label": "normalized_set = normalize_likelihood()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "vector": [14, 2, 0.3279, 0.0082, 2, 0.15, 0.3333, 974, 3, 1, 0, 0, 166, 10, 1], "semantic": {"name": "normalized_set", "arg_names": [], "import_names": [], "rhs_call_name": "normalize_likelihood", "annotation": ""}, "snippet": " normalized_set = normalize_likelihood(weighted_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L42_C8", "label": "new_xy = row_stack()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "vector": [14, 2, 0.3443, 0.0082, 2, 0.15, 0.5, 787, 3, 1, 0, 0, 612, 10, 3], "semantic": {"name": "new_xy", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": " new_xy = np.row_stack([ i for i in resample_uss( len(self.p), normalized_set )])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L43_C8", "label": "new_p = column_stack()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "vector": [14, 2, 0.3525, 0.0082, 2, 0.15, 0.6667, 535, 3, 1, 0, 0, 724, 10, 2], "semantic": {"name": "new_p", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": " new_p = np.column_stack([ new_xy, np.ones( new_xy.shape[0] ) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L44_C8", "label": "self.p = copy()", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "vector": [14, 2, 0.3607, 0.0082, 2, 0.15, 0.8333, 657, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "self.p", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self.p = np.copy( new_p )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L45_C8", "label": "return", "type": "return", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "vector": [13, 2, 0.3689, 0.0082, 2, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.copy( new_p )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L47_C4", "label": "step", "type": "function", "loc": [47, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "vector": [2, 1, 0.3975, 0.0328, 1, 0.56, 1.0, 880, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "step", "arg_names": ["self", "control_input", "measurement"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def step( self, control_input, measurement ):\n self.motion( control_input )\n self.measurement( measurement )\n self.resample()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L48_C8", "label": "motion()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L47_C4", "vector": [8, 2, 0.3934, 0.0082, 2, 0.56, 0.0, 759, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "motion", "arg_names": [], "import_names": [], "rhs_call_name": "motion", "annotation": ""}, "snippet": " self.motion( control_input )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L49_C8", "label": "measurement()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L47_C4", "vector": [8, 2, 0.4016, 0.0082, 2, 0.56, 0.5, 938, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "measurement", "arg_names": [], "import_names": [], "rhs_call_name": "measurement", "annotation": ""}, "snippet": " self.measurement( measurement )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L50_C8", "label": "resample()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L47_C4", "vector": [8, 2, 0.4098, 0.0082, 2, 0.56, 1.0, 342, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "resample", "arg_names": [], "import_names": [], "rhs_call_name": "resample", "annotation": ""}, "snippet": " self.resample()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "label": "resample_uss", "type": "function", "loc": [53, 73], "level": 0, "parent": null, "vector": [2, 0, 0.5164, 0.1721, 0, 0.66, 0.4286, 509, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "resample_uss", "arg_names": ["num_samples", "particles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def resample_uss(num_samples, particles):\n \"\"\" \n Universal stochastic sampler (low variance resampling)\n num_samples - number of samples desired\n particles - pairs of (state, weight) tuples\n \"\"\"\n samples = []\n r = rd.random() * (1.0 / float(num_samples))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L54_C4", "label": "expression", "type": "expression", "loc": [54, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "vector": [8, 1, 0.459, 0.041, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" \n Universal stochastic sampler (low variance resampling)\n num_samples - number of samples desired\n particles - pairs of (state, weight) tuples\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L59_C4", "label": "samples =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "vector": [14, 1, 0.4836, 0.0082, 1, 0.73, 0.1667, 986, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "samples", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " samples = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L60_C4", "label": "r =", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "vector": [14, 1, 0.4918, 0.0082, 1, 0.73, 0.3333, 436, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = rd.random() * (1.0 / float(num_samples))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L61_C4", "label": "c =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "vector": [14, 1, 0.5, 0.0082, 1, 0.73, 0.5, 411, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = (particles[0])[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L62_C4", "label": "i =", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "vector": [14, 1, 0.5082, 0.0082, 1, 0.73, 0.6667, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:For_L64_C4", "label": "for m", "type": "for", "loc": [64, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "vector": [6, 1, 0.5574, 0.0738, 1, 0.73, 0.8333, 711, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in xrange(num_samples):\n U = r + m * (1.0 / float(num_samples))\n #print \"U\", U\n while U > c:\n i = i + 1\n if i >= len(particles):\n i = 0\n c = c + (particles[i])[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L65_C8", "label": "U =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:For_L64_C4", "vector": [14, 2, 0.5328, 0.0082, 2, 0.59, 0.0, 643, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "U", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " U = r + m * (1.0 / float(num_samples))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:While_L67_C8", "label": "while", "type": "while", "loc": [67, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:For_L64_C4", "vector": [5, 2, 0.5656, 0.041, 2, 0.59, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while U > c:\n i = i + 1\n if i >= len(particles):\n i = 0\n c = c + (particles[i])[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L68_C12", "label": "i =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:While_L67_C8", "vector": [14, 3, 0.5574, 0.0082, 3, 0.79, 0.0, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = i + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L69_C12", "label": "if", "type": "if", "loc": [69, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:While_L67_C8", "vector": [4, 3, 0.5697, 0.0164, 3, 0.79, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i >= len(particles):\n i = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L70_C16", "label": "i =", "type": "assigned_variable", "loc": [70, 70], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L69_C12", "vector": [14, 4, 0.5738, 0.0082, 4, 0.81, 0.0, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L71_C12", "label": "c =", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:While_L67_C8", "vector": [14, 3, 0.582, 0.0082, 3, 0.79, 1.0, 411, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = c + (particles[i])[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L72_C8", "label": "append()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:For_L64_C4", "vector": [8, 2, 0.5902, 0.0082, 2, 0.59, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " samples.append((particles[i])[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L73_C4", "label": "return", "type": "return", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "vector": [13, 1, 0.5984, 0.0082, 1, 0.73, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return samples"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "label": "normalize_likelihood", "type": "function", "loc": [75, 85], "level": 0, "parent": null, "vector": [2, 0, 0.6557, 0.0902, 0, 0.66, 0.5714, 166, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "normalize_likelihood", "arg_names": ["weighted_particles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def normalize_likelihood(weighted_particles):\n \"\"\" Make all the particle weights sum up to 1 \"\"\"\n def add(a,b):\n apart, aw = a\n bpart, bw = b\n return ('', aw+bw)\n total_weight = (reduce(add, weighted_particles, ('',0.0)))[1]\n def normalize(a):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L76_C4", "label": "expression", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "vector": [8, 1, 0.623, 0.0082, 1, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Make all the particle weights sum up to 1 \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L77_C4", "label": "add", "type": "function", "loc": [77, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "vector": [2, 1, 0.6434, 0.0328, 1, 0.47, 0.25, 241, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "add", "arg_names": ["a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add(a,b):\n apart, aw = a\n bpart, bw = b\n return ('', aw+bw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L78_C8", "label": "apart, aw =", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L77_C4", "vector": [14, 2, 0.6393, 0.0082, 2, 0.26, 0.0, 465, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "apart, aw", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " apart, aw = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L79_C8", "label": "bpart, bw =", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L77_C4", "vector": [14, 2, 0.6475, 0.0082, 2, 0.26, 0.5, 779, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bpart, bw", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bpart, bw = b"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L80_C8", "label": "return", "type": "return", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L77_C4", "vector": [13, 2, 0.6557, 0.0082, 2, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ('', aw+bw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L81_C4", "label": "total_weight =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "vector": [14, 1, 0.6639, 0.0082, 1, 0.47, 0.5, 91, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "total_weight", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_weight = (reduce(add, weighted_particles, ('',0.0)))[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L82_C4", "label": "normalize", "type": "function", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "vector": [2, 1, 0.6803, 0.0246, 1, 0.47, 0.75, 257, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "normalize", "arg_names": ["a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def normalize(a):\n part, weight = a\n return (part, weight/total_weight)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L83_C8", "label": "part, weight =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L82_C4", "vector": [14, 2, 0.6803, 0.0082, 2, 0.42, 0.0, 822, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "part, weight", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " part, weight = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L84_C8", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L82_C4", "vector": [13, 2, 0.6885, 0.0082, 2, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (part, weight/total_weight)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L85_C4", "label": "return", "type": "return", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "vector": [13, 1, 0.6967, 0.0082, 1, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return map(normalize, weighted_particles)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L87_C0", "label": "NoMotion", "type": "class", "loc": [87, 92], "level": 0, "parent": null, "vector": [3, 0, 0.7336, 0.0492, 0, 0.66, 0.7143, 932, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "NoMotion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NoMotion:\n def __init__( self ):\n print('Starting NoMotion.')\n\n def predict( self, p ):\n return p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L88_C4", "label": "__init__", "type": "function", "loc": [88, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L87_C0", "vector": [2, 1, 0.7254, 0.0164, 1, 0.62, 0.0, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self ):\n print('Starting NoMotion.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L89_C8", "label": "print()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L88_C4", "vector": [8, 2, 0.7295, 0.0082, 2, 0.39, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting NoMotion.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L91_C4", "label": "predict", "type": "function", "loc": [91, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L87_C0", "vector": [2, 1, 0.75, 0.0164, 1, 0.62, 1.0, 127, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "predict", "arg_names": ["self", "p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def predict( self, p ):\n return p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L92_C8", "label": "return", "type": "return", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L91_C4", "vector": [13, 2, 0.7541, 0.0082, 2, 0.99, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L94_C0", "label": "NoMeasure", "type": "class", "loc": [94, 99], "level": 0, "parent": null, "vector": [3, 0, 0.791, 0.0492, 0, 0.66, 0.8571, 271, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "NoMeasure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NoMeasure:\n def __init__( self ):\n print('Starting NoMeasure.')\n\n def weight( self, p, m ):\n return 0.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L95_C4", "label": "__init__", "type": "function", "loc": [95, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L94_C0", "vector": [2, 1, 0.7828, 0.0164, 1, 0.23, 0.0, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self ):\n print('Starting NoMeasure.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L96_C8", "label": "print()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L95_C4", "vector": [8, 2, 0.7869, 0.0082, 2, 0.71, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting NoMeasure.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L98_C4", "label": "weight", "type": "function", "loc": [98, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L94_C0", "vector": [2, 1, 0.8074, 0.0164, 1, 0.23, 1.0, 205, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "weight", "arg_names": ["self", "p", "m"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def weight( self, p, m ):\n return 0.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L99_C8", "label": "return", "type": "return", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L98_C4", "vector": [13, 2, 0.8115, 0.0082, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "label": "if", "type": "if", "loc": [103, 122], "level": 0, "parent": null, "vector": [4, 0, 0.9221, 0.1639, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n\n X,Y = np.meshgrid( np.linspace(0,3,4),\n np.linspace(0,3,4) )\n xyw = np.row_stack([ X.flatten(), # Build Nx3\n Y.flatten(),\n np.ones( X.shape ).flatten() ]).T # weights (multiplicative)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L105_C4", "label": "X, Y = meshgrid()", "type": "assigned_variable", "loc": [105, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [14, 1, 0.8648, 0.0164, 1, 0.59, 0.0, 835, 3, 2, 0, 0, 500, 10, 3], "semantic": {"name": "X, Y", "arg_names": [], "import_names": [], "rhs_call_name": "meshgrid", "annotation": ""}, "snippet": " X,Y = np.meshgrid( np.linspace(0,3,4),\n np.linspace(0,3,4) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L107_C4", "label": "xyw =", "type": "assigned_variable", "loc": [107, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [14, 1, 0.8852, 0.0246, 1, 0.59, 0.1, 931, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "xyw", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xyw = np.row_stack([ X.flatten(), # Build Nx3\n Y.flatten(),\n np.ones( X.shape ).flatten() ]).T # weights (multiplicative)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L111_C4", "label": "pf = PFilter()", "type": "assigned_variable", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [14, 1, 0.9098, 0.0082, 1, 0.59, 0.2, 158, 3, 3, 0, 0, 298, 10, 3], "semantic": {"name": "pf", "arg_names": [], "import_names": [], "rhs_call_name": "PFilter", "annotation": ""}, "snippet": " pf = PFilter( NoMotion(), NoMeasure(), xyw )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L112_C4", "label": "motion()", "type": "expression", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [8, 1, 0.918, 0.0082, 1, 0.59, 0.3, 759, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "motion", "arg_names": [], "import_names": [], "rhs_call_name": "motion", "annotation": ""}, "snippet": " pf.motion( 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L113_C4", "label": "measurement()", "type": "expression", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [8, 1, 0.9262, 0.0082, 1, 0.59, 0.4, 938, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "measurement", "arg_names": [], "import_names": [], "rhs_call_name": "measurement", "annotation": ""}, "snippet": " pf.measurement( 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L114_C4", "label": "resample()", "type": "expression", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [8, 1, 0.9344, 0.0082, 1, 0.59, 0.5, 342, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "resample", "arg_names": [], "import_names": [], "rhs_call_name": "resample", "annotation": ""}, "snippet": " pf.resample()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L116_C4", "label": "print()", "type": "expression", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [8, 1, 0.9508, 0.0082, 1, 0.59, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(pf.p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L118_C4", "label": "measurement()", "type": "expression", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [8, 1, 0.9672, 0.0082, 1, 0.59, 0.7, 938, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "measurement", "arg_names": [], "import_names": [], "rhs_call_name": "measurement", "annotation": ""}, "snippet": " pf.measurement( 0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L119_C4", "label": "assign", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [14, 1, 0.9754, 0.0082, 1, 0.59, 0.8, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pf.p[0,2] = 5 # 10 times more likely"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L120_C4", "label": "resample()", "type": "expression", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [8, 1, 0.9836, 0.0082, 1, 0.59, 0.9, 342, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "resample", "arg_names": [], "import_names": [], "rhs_call_name": "resample", "annotation": ""}, "snippet": " pf.resample()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L122_C4", "label": "print()", "type": "expression", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "vector": [8, 1, 1.0, 0.0082, 1, 0.59, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(pf.p)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:For_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:For_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:For_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:While_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:While_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:While_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L69_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L70_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:While_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:For_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:ClassDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Return_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99439:If_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99439:Expr_L122_C4"}] |
import numpy as np, math
import cPickle as pkl
EXT = 10.0
DIVS = 200 # Keep this even
d = {}
d['xedges'] = np.linspace( -1 * EXT, EXT, DIVS )
d['yedges'] = np.linspace( -1 * EXT, EXT, DIVS )
d['stddev_model'] = np.ma.array(np.ones( (DIVS,DIVS) ))
d['detect_model'] = np.ma.array(np.ones( (DIVS,DIVS) ))
d['rssi_model'] = np.ma.array( np.ones( (DIVS,DIVS) ) * 55 )
t = d['rssi_model'][DIVS/2-1,DIVS/2-1:]
d['rssi_model'][DIVS/2-1,DIVS/2-1:] = np.array([-35.0 / (DIVS / 2) * i + 100
for i in xrange( len( t ))])
# Need to build a fake yaml config file for this fake beam model.
f = open( 'pencil_beam_MODEL.pkl', 'w' )
pkl.dump( d, f )
f.close()
| ajibawa-2023/Python-Code-Large/train/row_99440 | 15 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Import_L1_C0", "label": "numpy import np, math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Import_L2_C0", "label": "cPickle import pkl", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0385, 0, 0.66, 0.0714, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L4_C0", "label": "EXT =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.1538, 0.0385, 0, 0.66, 0.1429, 195, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "EXT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EXT = 10.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L5_C0", "label": "DIVS =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.1923, 0.0385, 0, 0.66, 0.2143, 17, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DIVS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DIVS = 200 # Keep this even"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L8_C0", "label": "d =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.3077, 0.0385, 0, 0.66, 0.2857, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "d = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L9_C0", "label": " = linspace()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.3462, 0.0385, 0, 0.66, 0.3571, 0, 3, 3, 0, 0, 119, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": "d['xedges'] = np.linspace( -1 * EXT, EXT, DIVS )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L10_C0", "label": " = linspace()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.3846, 0.0385, 0, 0.66, 0.4286, 0, 3, 3, 0, 0, 119, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": "d['yedges'] = np.linspace( -1 * EXT, EXT, DIVS )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L11_C0", "label": " = array()", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.4231, 0.0385, 0, 0.66, 0.5, 0, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "d['stddev_model'] = np.ma.array(np.ones( (DIVS,DIVS) ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L12_C0", "label": " = array()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.4615, 0.0385, 0, 0.66, 0.5714, 0, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "d['detect_model'] = np.ma.array(np.ones( (DIVS,DIVS) ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L13_C0", "label": " = array()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0385, 0, 0.66, 0.6429, 0, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "d['rssi_model'] = np.ma.array( np.ones( (DIVS,DIVS) ) * 55 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L15_C0", "label": "t =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.5769, 0.0385, 0, 0.66, 0.7143, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "t = d['rssi_model'][DIVS/2-1,DIVS/2-1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L16_C0", "label": " = array()", "type": "assigned_variable", "loc": [16, 17], "level": 0, "parent": null, "vector": [14, 0, 0.6346, 0.0769, 0, 0.66, 0.7857, 0, 3, 1, 0, 0, 80, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": "d['rssi_model'][DIVS/2-1,DIVS/2-1:] = np.array([-35.0 / (DIVS / 2) * i + 100\n for i in xrange( len( t ))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Assign_L21_C0", "label": "f = open()", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.8077, 0.0385, 0, 0.66, 0.8571, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open( 'pencil_beam_MODEL.pkl', 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Expr_L22_C0", "label": "dump()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.8462, 0.0385, 0, 0.66, 0.9286, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": "pkl.dump( d, f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99440:Expr_L23_C0", "label": "close()", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.8846, 0.0385, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "f.close()"}] | [] |
import roslib
roslib.load_manifest( 'costmap_services' )
import rospy
import numpy as np, math
import costmap_services.python_client as costmap
from display_particles import DisplayParticles
import cPickle as pkl
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--recalc', action='store_true', dest='recalc',
help='recalculate the costmap points?', default = False)
p.add_option('--fname', action='store', type='string', dest='fname',
help='pkl file to use', default = False)
p.add_option('--combine', action='store_true', dest='combine',
help='Combine results of multiple costmaps', default = False)
opt, args = p.parse_args()
rospy.init_node( 'tmp2243425' )
# fname = 'costmap_costs.pkl'
fname = opt.fname
if opt.combine:
# OK, this is just a hack. I need a way to combine a masked map with a previously captured costmap.
print 'YAY!'
f = open( 'gen_costmap_mask.pkl', 'r' )
mask = pkl.load( f )
f.close()
f = open( 'gen_costmap_aware_home.pkl', 'r' )
obs = pkl.load( f )
f.close()
# fname = 'pf_costmap.pkl'
ind_m = np.where( mask[:,2] < 127.0 )[0]
ind_o = np.where( obs[:,2] < 127.0 )[0]
ind = np.intersect1d( ind_m, ind_o ) # Locations that are good in both costmaps
p_set = np.copy( obs )
p_set[:,2] = np.zeros( obs.shape[0] )
p_set[:,2][ind] = True
f = open( fname, 'w' )
pkl.dump( p_set, f )
f.close()
if not opt.fname:
print 'fname required here on out.'
exit()
if opt.recalc:
res = 0.05
cs = costmap.CostmapServices()
X,Y = np.meshgrid( np.arange( -5, 8, res ), np.arange( -5, 8, res ))
xy = zip( X.flatten(), Y.flatten() )
print 'Computing Map Costs...'
mc = []
for i,xyi in enumerate( xy ):
if i % 100 == 0:
print 'Still working ( %d of %d -- %3.2f%%)' % (i, len(xy), 100.0*i/len(xy))
mc += [ cs.getMapCost( *xyi ) ]
print 'Done.'
p_set = np.column_stack([ np.array( X.flatten() ),
np.array( Y.flatten() ),
np.array( mc ) ])
f = open( fname, 'w' )
pkl.dump( p_set, f )
f.close()
dp = DisplayParticles()
f = open( fname, 'r' )
p_set = pkl.load( f )
f.close()
while not rospy.is_shutdown():
print 'Displaying particles'
dp.update( p_set )
rospy.sleep( 0.3 )
| ajibawa-2023/Python-Code-Large/train/row_99442 | 59 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Import_L1_C0", "label": "roslib import roslib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0105, 0.0105, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L2_C0", "label": "load_manifest()", "type": "expression", "loc": [2, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0105, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'costmap_services' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Import_L3_C0", "label": "rospy import rospy", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0316, 0.0105, 0, 0.66, 0.2857, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Import_L5_C0", "label": "numpy import np, math", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0105, 0, 0.66, 0.4286, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Import_L6_C0", "label": "costmap_services.python_client import costmap", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0632, 0.0105, 0, 0.66, 0.5714, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "costmap_services.python_client", "arg_names": [], "import_names": ["costmap"], "rhs_call_name": "", "annotation": ""}, "snippet": "import costmap_services.python_client as costmap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:ImportFrom_L7_C0", "label": "from display_particles import DisplayParticles", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0737, 0.0105, 0, 0.66, 0.7143, 534, 0, 1, 0, 0, 534, 0, 0], "semantic": {"name": "display_particles", "arg_names": [], "import_names": ["DisplayParticles"], "rhs_call_name": "", "annotation": ""}, "snippet": "from display_particles import DisplayParticles"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Import_L8_C0", "label": "cPickle import pkl", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0842, 0.0105, 0, 0.66, 0.8571, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "label": "if", "type": "if", "loc": [13, 95], "level": 0, "parent": null, "vector": [4, 0, 0.5684, 0.8737, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 54], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--recalc', action='store_true', dest='recalc',\n help='recalculate the costmap points?', default = False)\n p.add_option('--fname', action='store', type='string', dest='fname',\n help='pkl file to use', default = False)\n p.add_option('--combine', action='store_true', dest='combine',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Import_L14_C4", "label": "optparse import optparse", "type": "import", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [1, 1, 0.1474, 0.0105, 1, 0.09, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L15_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [14, 1, 0.1579, 0.0105, 1, 0.09, 0.0667, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L16_C4", "label": "add_option()", "type": "expression", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [8, 1, 0.1737, 0.0211, 1, 0.09, 0.1333, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--recalc', action='store_true', dest='recalc',\n help='recalculate the costmap points?', default = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L18_C4", "label": "add_option()", "type": "expression", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [8, 1, 0.1947, 0.0211, 1, 0.09, 0.2, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--fname', action='store', type='string', dest='fname',\n help='pkl file to use', default = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L20_C4", "label": "add_option()", "type": "expression", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [8, 1, 0.2158, 0.0211, 1, 0.09, 0.2667, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--combine', action='store_true', dest='combine',\n help='Combine results of multiple costmaps', default = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L22_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [14, 1, 0.2316, 0.0105, 1, 0.09, 0.3333, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L25_C4", "label": "init_node()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [8, 1, 0.2632, 0.0105, 1, 0.09, 0.4, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'tmp2243425' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L28_C4", "label": "fname =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [14, 1, 0.2947, 0.0105, 1, 0.09, 0.4667, 190, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname = opt.fname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "label": "if", "type": "if", "loc": [30, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [4, 1, 0.4421, 0.2632, 1, 0.09, 0.5333, 0, 7, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.combine:\n # OK, this is just a hack. I need a way to combine a masked map with a previously captured costmap.\n print('YAY!')\n\n f = open( 'gen_costmap_mask.pkl', 'r' )\n mask = pkl.load( f )\n f.close()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L32_C8", "label": "print()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [8, 2, 0.3368, 0.0105, 2, 0.65, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('YAY!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L34_C8", "label": "f = open()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.3579, 0.0105, 2, 0.65, 0.0667, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( 'gen_costmap_mask.pkl', 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L35_C8", "label": "mask = load()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.3684, 0.0105, 2, 0.65, 0.1333, 904, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "mask", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " mask = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L36_C8", "label": "close()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [8, 2, 0.3789, 0.0105, 2, 0.65, 0.2, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L38_C8", "label": "f = open()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.4, 0.0105, 2, 0.65, 0.2667, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( 'gen_costmap_aware_home.pkl', 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L39_C8", "label": "obs = load()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.4105, 0.0105, 2, 0.65, 0.3333, 347, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "obs", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " obs = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L40_C8", "label": "close()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [8, 2, 0.4211, 0.0105, 2, 0.65, 0.4, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L44_C8", "label": "ind_m =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.4632, 0.0105, 2, 0.65, 0.4667, 214, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind_m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind_m = np.where( mask[:,2] < 127.0 )[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L45_C8", "label": "ind_o =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.4737, 0.0105, 2, 0.65, 0.5333, 739, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind_o", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind_o = np.where( obs[:,2] < 127.0 )[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L46_C8", "label": "ind = intersect1d()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.4842, 0.0105, 2, 0.65, 0.6, 680, 3, 2, 0, 0, 645, 10, 1], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "intersect1d", "annotation": ""}, "snippet": " ind = np.intersect1d( ind_m, ind_o ) # Locations that are good in both costmaps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L48_C8", "label": "p_set = copy()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.5053, 0.0105, 2, 0.65, 0.6667, 28, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "p_set", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " p_set = np.copy( obs )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L49_C8", "label": " = zeros()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.5158, 0.0105, 2, 0.65, 0.7333, 0, 3, 1, 0, 0, 213, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "zeros", "annotation": ""}, "snippet": " p_set[:,2] = np.zeros( obs.shape[0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L50_C8", "label": "assign", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.5263, 0.0105, 2, 0.65, 0.8, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p_set[:,2][ind] = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L52_C8", "label": "f = open()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [14, 2, 0.5474, 0.0105, 2, 0.65, 0.8667, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L53_C8", "label": "dump()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [8, 2, 0.5579, 0.0105, 2, 0.65, 0.9333, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pkl.dump( p_set, f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L54_C8", "label": "close()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "vector": [8, 2, 0.5684, 0.0105, 2, 0.65, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L58_C4", "label": "if", "type": "if", "loc": [58, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [4, 1, 0.6211, 0.0316, 1, 0.09, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opt.fname:\n print('fname required here on out.')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L59_C8", "label": "print()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L58_C4", "vector": [8, 2, 0.6211, 0.0105, 2, 0.66, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('fname required here on out.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L60_C8", "label": "exit()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L58_C4", "vector": [8, 2, 0.6316, 0.0105, 2, 0.66, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "label": "if", "type": "if", "loc": [62, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [4, 1, 0.7632, 0.2316, 1, 0.09, 0.6667, 0, 7, 0, 0, 0, 0, 0, 23], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.recalc:\n res = 0.05\n\n cs = costmap.CostmapServices()\n X,Y = np.meshgrid( np.arange( -5, 8, res ), np.arange( -5, 8, res ))\n xy = zip( X.flatten(), Y.flatten() )\n\n print('Computing Map Costs...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L63_C8", "label": "res =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [14, 2, 0.6632, 0.0105, 2, 0.87, 0.0, 413, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = 0.05"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L65_C8", "label": "cs = CostmapServices()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [14, 2, 0.6842, 0.0105, 2, 0.87, 0.0909, 256, 3, 0, 0, 0, 974, 10, 1], "semantic": {"name": "cs", "arg_names": [], "import_names": [], "rhs_call_name": "CostmapServices", "annotation": ""}, "snippet": " cs = costmap.CostmapServices()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L66_C8", "label": "X, Y = meshgrid()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [14, 2, 0.6947, 0.0105, 2, 0.87, 0.1818, 835, 3, 2, 0, 0, 500, 10, 3], "semantic": {"name": "X, Y", "arg_names": [], "import_names": [], "rhs_call_name": "meshgrid", "annotation": ""}, "snippet": " X,Y = np.meshgrid( np.arange( -5, 8, res ), np.arange( -5, 8, res ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L67_C8", "label": "xy = zip()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [14, 2, 0.7053, 0.0105, 2, 0.87, 0.2727, 358, 3, 2, 0, 0, 814, 10, 3], "semantic": {"name": "xy", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " xy = zip( X.flatten(), Y.flatten() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L69_C8", "label": "print()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [8, 2, 0.7263, 0.0105, 2, 0.87, 0.3636, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Computing Map Costs...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L70_C8", "label": "mc =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [14, 2, 0.7368, 0.0105, 2, 0.87, 0.4545, 714, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "mc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mc = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:For_L71_C8", "label": "for i, xyi", "type": "for", "loc": [71, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [6, 2, 0.7632, 0.0421, 2, 0.87, 0.5455, 343, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i, xyi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i,xyi in enumerate( xy ):\n if i % 100 == 0:\n print('Still working ( %d of %d -- %3.2f%%)' % (i, len(xy), 100.0*i/len(xy)))\n mc += [ cs.getMapCost( *xyi ) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L72_C12", "label": "if", "type": "if", "loc": [72, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:For_L71_C8", "vector": [4, 3, 0.7632, 0.0211, 3, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i % 100 == 0:\n print('Still working ( %d of %d -- %3.2f%%)' % (i, len(xy), 100.0*i/len(xy)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L73_C16", "label": "print()", "type": "expression", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L72_C12", "vector": [8, 4, 0.7684, 0.0105, 4, 0.76, 0.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Still working ( %d of %d -- %3.2f%%)' % (i, len(xy), 100.0*i/len(xy)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L75_C8", "label": "print()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [8, 2, 0.7895, 0.0105, 2, 0.87, 0.6364, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L77_C8", "label": "p_set = column_stack()", "type": "assigned_variable", "loc": [77, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [14, 2, 0.8211, 0.0316, 2, 0.87, 0.7273, 28, 3, 1, 0, 0, 724, 10, 6], "semantic": {"name": "p_set", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": " p_set = np.column_stack([ np.array( X.flatten() ),\n np.array( Y.flatten() ),\n np.array( mc ) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L81_C8", "label": "f = open()", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [14, 2, 0.8526, 0.0105, 2, 0.87, 0.8182, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'w' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L82_C8", "label": "dump()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [8, 2, 0.8632, 0.0105, 2, 0.87, 0.9091, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pkl.dump( p_set, f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L83_C8", "label": "close()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "vector": [8, 2, 0.8737, 0.0105, 2, 0.87, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L86_C4", "label": "dp = DisplayParticles()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [14, 1, 0.9053, 0.0105, 1, 0.09, 0.7333, 595, 3, 0, 0, 0, 645, 10, 1], "semantic": {"name": "dp", "arg_names": [], "import_names": [], "rhs_call_name": "DisplayParticles", "annotation": ""}, "snippet": " dp = DisplayParticles()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L88_C4", "label": "f = open()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [14, 1, 0.9263, 0.0105, 1, 0.09, 0.8, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L89_C4", "label": "p_set = load()", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [14, 1, 0.9368, 0.0105, 1, 0.09, 0.8667, 28, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "p_set", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " p_set = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L90_C4", "label": "close()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [8, 1, 0.9474, 0.0105, 1, 0.09, 0.9333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:While_L92_C4", "label": "while", "type": "while", "loc": [92, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "vector": [5, 1, 0.9842, 0.0421, 1, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not rospy.is_shutdown():\n print('Displaying particles')\n dp.update( p_set )\n rospy.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L93_C8", "label": "print()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:While_L92_C4", "vector": [8, 2, 0.9789, 0.0105, 2, 0.21, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Displaying particles')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L94_C8", "label": "update()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:While_L92_C4", "vector": [8, 2, 0.9895, 0.0105, 2, 0.21, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " dp.update( p_set )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L95_C8", "label": "sleep()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99442:While_L92_C4", "vector": [8, 2, 1.0, 0.0105, 2, 0.21, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.3 )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:For_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:For_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:While_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:While_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:While_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99442:While_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99442:Expr_L95_C8"}] |
#!/usr/bin/python
import time
import roslib
roslib.load_manifest( 'rosgraph_msgs' )
roslib.load_manifest( 'rospy' )
import rospy
from rosgraph_msgs.msg import Clock
rospy.init_node( 'clock_pub' )
time.sleep( 0.2 )
pub = rospy.Publisher( '/clock', Clock )
while not rospy.is_shutdown():
pub.publish( Clock().clock.from_sec( time.time() ) )
time.sleep( 0.001 )
| ajibawa-2023/Python-Code-Large/train/row_99444 | 12 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Import_L3_C0", "label": "time import time", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0526, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Import_L5_C0", "label": "roslib import roslib", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2632, 0.0526, 0, 0.66, 0.1111, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Expr_L6_C0", "label": "load_manifest()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.3158, 0.0526, 0, 0.66, 0.2222, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'rosgraph_msgs' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.3684, 0.0526, 0, 0.66, 0.3333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'rospy' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Import_L8_C0", "label": "rospy import rospy", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.4211, 0.0526, 0, 0.66, 0.4444, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:ImportFrom_L10_C0", "label": "from rosgraph_msgs.msg import Clock", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.5263, 0.0526, 0, 0.66, 0.5556, 993, 0, 1, 0, 0, 993, 0, 0], "semantic": {"name": "rosgraph_msgs.msg", "arg_names": [], "import_names": ["Clock"], "rhs_call_name": "", "annotation": ""}, "snippet": "from rosgraph_msgs.msg import Clock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Expr_L12_C0", "label": "init_node()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.6316, 0.0526, 0, 0.66, 0.6667, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": "rospy.init_node( 'clock_pub' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Expr_L13_C0", "label": "sleep()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.6842, 0.0526, 0, 0.66, 0.7778, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": "time.sleep( 0.2 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Assign_L15_C0", "label": "pub = Publisher()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.7895, 0.0526, 0, 0.66, 0.8889, 41, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": "pub = rospy.Publisher( '/clock', Clock )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:While_L17_C0", "label": "while", "type": "while", "loc": [17, 19], "level": 0, "parent": null, "vector": [5, 0, 0.9474, 0.1579, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while not rospy.is_shutdown():\n pub.publish( Clock().clock.from_sec( time.time() ) )\n time.sleep( 0.001 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Expr_L18_C4", "label": "publish()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99444:While_L17_C0", "vector": [8, 1, 0.9474, 0.0526, 1, 0.9, 0.0, 102, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " pub.publish( Clock().clock.from_sec( time.time() ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99444:Expr_L19_C4", "label": "sleep()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99444:While_L17_C0", "vector": [8, 1, 1.0, 0.0526, 1, 0.9, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 0.001 )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99444:While_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99444:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99444:While_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99444:Expr_L19_C4"}] |
__all__ = [
'pf_stats',
'pub_clock',
'stats_best_uniform'
]
| ajibawa-2023/Python-Code-Large/train/row_99446 | 1 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99446:Assign_L1_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [1, 5], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.8333, 0, 0.66, 0.0, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n 'pf_stats',\n 'pub_clock',\n 'stats_best_uniform' \n]"}] | [] |
#!/usr/bin/python
import rfid_model
import lib_pfilter
import roslib
roslib.load_manifest('rfid_behaviors')
roslib.load_manifest('rfid_datacapture')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('visualization_msgs')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('pfilter')
import rospy
import hrl_lib.transforms as tr
import tf.transformations as tft
import display_particles
from display_particles import DisplayParticles
from geometry_msgs.msg import Quaternion, Point
import rfid_datacapture.math_util as mu
import visualization_msgs.msg as vm
import hrl_lib.transforms as tr
import hrl_lib.viz as viz
vsm = viz.single_marker
import random as rd
import cPickle as pkl
import numpy as np, math
import pylab as pl
import time
import glob
# trial_num = 4
# obj_num = 3
# servo_yn = False
def pprint(r):
print '\nLocation %d, Object %d, Trial %d' % (r['loc'], r['obj_num'], r['trial_num'])
if r['servo_yn']:
print '\tSEARCH plus SERVO'
else:
print '\tSEARCH ONLY'
print '\tPos Reads: %d' % (r['pos_readings'])
print '\tTot Reads: %d' % (r['tot_readings'])
print '\tPercent Reads: %2.1f' % (r['pos_readings']*100.0/r['tot_readings'])
if r['best_pos'].__class__ == ''.__class__:
print '\tEstimate Loc: --'
else:
print '\tEstimate Loc: <%2.3f, %2.3f>' % ( r['best_pos'][0], r['best_pos'][1] )
if r['orient_est'].__class__ == ''.__class__:
print '\tEstimate Theta: --'
else:
print '\tEstimate Theta: %2.1f (deg)' % ( math.degrees( r['orient_est'] ))
if r['dxy'].__class__ == ''.__class__:
print '\tDist Err (m): --'
else:
print '\tDist Err (m): %2.3f' % ( r['dxy'] )
if r['dtheta'].__class__ == ''.__class__:
print '\tAng Err (deg): --'
else:
print '\tAng Err (deg): %2.1f' % ( math.degrees( r['dtheta'] ))
# if r.has_key('other'):
# print '\tOther params: ', r['other']
print '\n\n\n'
tdb = { 0: ['OrangeMedBot',[]],
1: ['TravisTVremo',[]],
2: ['RedBottle ',[]],
3: ['OnMetalKeys ',[]],
4: ['WhiteMedsBot',[]],
5: ['BlueMedsBox ',[]],
6: ['TeddyBearToy',[]],
7: ['CordlessPhon',[]],
8: ['BlueHairBrus',[]]}
pts = { 0: ['BehindTree',[3.757, 6.017, 0.036]],
1: ['FireplaceMantle',[5.090, 4.238, 1.514]],
2: ['CircleEndTable',[5.399, 2.857, 0.607]],
3: ['Couch',[3.944, 1.425, 0.527]],
4: ['RectEndTable',[3.302, 0.932, 0.534]],
5: ['BehindKitchenTable',[-0.339, -2.393, 0.793]],
6: ['NearDishwaser',[-1.926, -0.835, 0.946]],
7: ['InCupboard',[-3.257, 1.294, 1.397]],
8: ['OnFilingCabinet',[-0.083, 2.332, 0.670]]}
def process_trialobj( trial_num, obj_num, servo_yn ):
obj_name = tdb[obj_num][0]
tname = obj_name.replace( ' ', '' )
loc = (trial_num + obj_num) % 9
loc_name = pts[loc][0]
loc_pos = np.array(pts[loc][1]) # Tag ground-truth location
fname_prefix = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/'
servo_fname = fname_prefix
servo_fname += 'search_aware_home/'
servo_fname += 'woot_150_'+str(trial_num)+'_tag_'+obj_name.replace(' ','')+'_servo.pkl'
pf_search = servo_fname.replace('_servo.pkl', '_pf_search.pkl')
pf_servo = servo_fname.replace('_servo.pkl', '_pf_servo.pkl')
# Search only
search_reads_fname = fname_prefix
search_reads_fname += 'search_aware_home/woot_150_'+str(trial_num)+'_reads.pkl'
f = open( search_reads_fname, 'r' )
summary_search = pkl.load( f )
f.close()
pos_readings_search = sum([ True for p in summary_search if p.read.rssi != -1 and p.read.tagID == obj_name ])
tot_readings_search = len( summary_search )
if pos_readings_search == 0: # No results!
print '\t No results for this instance.'
res = { 'loc': loc,
'obj_num': obj_num,
'trial_num': trial_num,
'pos_readings': pos_readings_search,
'tot_readings':tot_readings_search,
'best_pos': '--',
'orient_est': '--',
'dxy': '--',
'dtheta': '--',
'servo_yn': servo_yn,
'other': { 'w_mass': 0.0, # specific to pf
'orient_fit': 0.0 }}
return False, res, None
f = open( pf_search ) # load the particle set from Search data. Will overwrite if using search plus servo
p_set_loaded = pkl.load( f )
f.close()
pos_readings = pos_readings_search
tot_readings = tot_readings_search
# If this is Search PLUS servo...
if servo_yn:
# update the stats for pos reads
f = open( servo_fname, 'r' )
summary_servo = pkl.load( f )
f.close()
pos_readings_servo = sum([ True for p in summary_servo if p.read.rssi != -1 and p.read.tagID == obj_name ])
tot_readings_servo = len( summary_servo )
pos_readings = pos_readings_search + pos_readings_servo
tot_readings = tot_readings_search + tot_readings_servo
# use the particle set from the SERVO data
f = open( pf_servo )
p_set_loaded = pkl.load( f )
f.close()
# print '\t Positive Reads: %d of %d (%2.1f)' % ( pos_readings,
# tot_readings,
# 100.0 * pos_readings / tot_readings )
# maxw = np.max( p_set_loaded[:,2] )
# minw = np.min( p_set_loaded[:,2] )
# w_normed = 1.0 * ( p_set_loaded[:,2] - minw ) / ( maxw - minw )
# # Only keep particles in the top 98% of likelihoods (250 / 255). This
# # makes the selection only consider locations where the probability
# # mass is actually located. (These are the ones displayed in the
# # screen captures!)
# p_set = p_set_loaded[ np.where( w_normed > 0.02 )[0] ]
# print 'Shape: ', p_set.shape
# # print 'p_set size (pre-cap): ', p_set.shape
# # p_set_precap = np.copy( p_set )
# # p_set = p_set[np.argsort(p_set[:,2])][:1000] # Cap the total number: keep at most the top 1000
# # print 'p_set size (pre-cap): ', p_set.shape
p_set = np.copy( p_set_loaded )
p_set = p_set[ np.argsort( p_set[:,2] )[::-1] ] # sort by decreasing weight
w_norm = p_set[:,2] / np.sum( p_set[:,2] )
w_cum = np.cumsum( w_norm )
# ONLY KEEP top 8000 particles (computation)
w_mass = w_cum[:8000][-1] * 100.0 # Ratio of mass in p_set to total:
p_set = p_set[:8000] # only keep top 8000 for computational reasons!
# # ONLY KEEP particles that are in top 98% of normalized values. (these are the ones displayed)
# maxw = np.max( p_set[:,2] )
# minw = np.min( p_set[:,2] )
# w_scaled = 1.0 * ( p_set[:,2] - minw ) / ( maxw - minw )
# p_set = p_set[ np.where( w_scaled > 0.02 )[0] ]
# p_set = p_set[:8000] # Only keep top 8000 max
# w_mass = w_cum[ p_set.shape[0] ]
# print 'p_set size (pre-cap): ', p_set.shape
# print w_mass
# print '\tShape: ', p_set.shape
pf_costmap = '/home/travis/svn/robot1/src/projects/rfid_pf/src/rfid_pf/pf_costmap.pkl'
f = open( pf_costmap )
costmap = pkl.load( f )
f.close()
cm = costmap[ np.where( costmap[:,2] )[0] ] # Locations where the robot can be located
# Determine the score for each possible xy robot location
def score_loc( xy ):
# The xy location under consideration for the robot
mag = np.sqrt( np.sum( np.power( p_set[:,0:2] - xy, 2.0 ), axis = 1)) # || dist ||
score = mag * p_set[:,2] # || dist || * w's
return np.sum( score )
# Compute all the scores for possible robot locations
t0 = time.time()
pos_scores = [ score_loc( i[0:2] ) for i in cm ]
dt = time.time() - t0
# print '\tScore computations per second: ', len( pos_scores ) * 1.0 / dt
best_ind = np.argmin( pos_scores )
best_pos = cm[ best_ind ][0:2]
# # Calculate the angle that is the mean
# # Now that we have best_pos, we need to find the best orientation.
# def score_orient( xyw, best_pos ): # returns 1x2
# # xyw is 1x3
# dxy = xyw[0:2] - best_pos # move into best_pose frame (1x2)
# dxy_unit = dxy / np.linalg.norm( dxy ) # normalize to unit circle
# return dxy_unit * xyw[2] # 1x2; [x_circ => x / |dxy| * w, y_circ...]
# so = np.array([ score_orient( i, best_pos ) for i in p_set ])
# so[ np.where(np.isnan( so )) ] = 0.0 # for positions where the particle is one and the same, the norm is 0.0 so score is nan.
# x_so = np.sum( so[:,0] )
# y_so = np.sum( so[:,1] )
# orient_est = np.arctan2( y_so, x_so )
# orient_fit = np.sqrt( x_so**2.0 + y_so**2.0 ) / ( np.sum( p_set[:,2] ))
# Brute force calculate the angle that yields the minimum |dtheta|
theta_hats = np.linspace( -1.0 * np.pi, np.pi, 360, endpoint = False )
theta_hats = np.array([ mu.standard_rad( i ) for i in theta_hats ])
dxy = p_set[:,0:2] - best_pos # put the p_set into the best_pos frame!
pset_thetas = np.arctan2( dxy[:,1], dxy[:,0] )
pset_thetas = np.array([ mu.standard_rad( i ) for i in pset_thetas ])
pset_w_normed = p_set[:,2] / np.sum( p_set[:,2] )
def exp_err( th ):
errs = np.abs([ mu.standard_rad( i ) for i in th - pset_thetas ])
weighted_errs = pset_w_normed * errs
mean_we = np.mean( weighted_errs )
return mean_we
theta_hats_res = np.array([ exp_err( i ) for i in theta_hats ])
# rrr = theta_hats
# res = theta_hats_res
orient_est_ind = np.argmin( theta_hats_res )
orient_est = theta_hats[ orient_est_ind ]
# Compute errors:
dxy = np.linalg.norm( best_pos - loc_pos[0:2] )
true_theta = np.arctan2( loc_pos[1] - best_pos[1], # y / x
loc_pos[0] - best_pos[0] )
dtheta = mu.standard_rad( orient_est - true_theta )
res = { 'loc': loc,
'obj_num': obj_num,
'trial_num': trial_num,
'pos_readings': pos_readings,
'tot_readings':tot_readings,
'best_pos': best_pos,
'orient_est': orient_est,
'dxy': dxy,
'dtheta': dtheta,
'servo_yn': servo_yn,
'other': { 'w_mass': w_mass, # specific to pf
'theta_hats': theta_hats,
'theta_hats_res': theta_hats_res,
'p_set': p_set }}
return True, res, np.copy( p_set ) # Was_reads?, results dict, particles (for display)
def MAIN_PROCESS( trial_num, obj_num, servo_yn, screen_cap = False ):
print 'In MP: ', trial_num, obj_num, servo_yn, screen_cap
# best_pos, orient_est, p_set = process_trialobj( 4, 3, True )
was_reads, res, p_set = process_trialobj( trial_num, obj_num, servo_yn )
print 'RESULTS'
pprint( res )
# save results:
if screen_cap:
f = open( 'Obj%d_Trial%d_Servo%d_pf_results.pkl' % (obj_num, trial_num, int( servo_yn )), 'w')
pkl.dump( res, f )
f.close()
# Make screen capture.
if not was_reads: # Skip step if no reads.
return
best_pos = res[ 'best_pos' ]
orient_est = res[ 'orient_est' ]
pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )
if servo_yn:
c_tm = [0./255, 205./255, 255./255, 1.0] # rgba
else:
c_tm = [255./255, 123./255, 1./255, 1.0] # rgba
tm = vsm( np.matrix([ best_pos[0],best_pos[1], 0.0 ]).T,
np.matrix(tft.quaternion_from_euler( 0.0, 0.0, orient_est )).T,
'arrow', '/map',
scale = [0.5, 1.0, 1.0],
color = c_tm,
duration = 50.0,
m_id = 2*p_set.shape[0] + 1 )
def pub_tm( ):
tm.header.stamp = rospy.Time.now()
for i in xrange( 10 ):
pub_mark.publish( tm )
rospy.sleep( 0.3 )
print 'Click on RVIZ!'
time.sleep( 3 )
pub_tm()
pub_tm()
display_particles.display_trialobj( trial_num, obj_num, servo_yn, screen_cap = screen_cap )
print 'Done.\n\n\n'
return
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--trial', action='store', type='int', dest='trial',
help='trial number (0-8)')
p.add_option('--obj', action='store', type='int', dest='obj',
help='object number (0-8)')
p.add_option('--servo', action='store_true', dest='servo',
help='Use combined search and servo?', default = False)
opt, args = p.parse_args()
obj_num = opt.obj
trial_num = opt.trial
servo_yn = opt.servo
rospy.init_node( 'goober' )
if trial_num < 9:
while not rospy.is_shutdown():
print 'Publishing.'
MAIN_PROCESS( trial_num, obj_num, servo_yn )
else:
# for i in range( 0, 1 ): # trial
# for j in range( 4, 5 ): # obj
for i in range( 0, 9 ): # trial
for j in range( 0, 9 ): # obj
for s in [False, True]: # servo_yn
MAIN_PROCESS( i, j, s, screen_cap = True )
| ajibawa-2023/Python-Code-Large/train/row_99447 | 173 | 402 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L3_C0", "label": "rfid_model import rfid_model", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0025, 0, 0.66, 0.0, 973, 0, 1, 0, 0, 973, 0, 0], "semantic": {"name": "rfid_model", "arg_names": [], "import_names": ["rfid_model"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L4_C0", "label": "lib_pfilter import lib_pfilter", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.01, 0.0025, 0, 0.66, 0.0323, 170, 0, 1, 0, 0, 170, 0, 0], "semantic": {"name": "lib_pfilter", "arg_names": [], "import_names": ["lib_pfilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "import lib_pfilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L6_C0", "label": "roslib import roslib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0025, 0, 0.66, 0.0645, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0174, 0.0025, 0, 0.66, 0.0968, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_behaviors')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0199, 0.0025, 0, 0.66, 0.129, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_datacapture')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0224, 0.0025, 0, 0.66, 0.1613, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0249, 0.0025, 0, 0.66, 0.1935, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('visualization_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L11_C0", "label": "load_manifest()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0274, 0.0025, 0, 0.66, 0.2258, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L12_C0", "label": "load_manifest()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0299, 0.0025, 0, 0.66, 0.2581, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('pfilter')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L13_C0", "label": "rospy import rospy", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0025, 0, 0.66, 0.2903, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L15_C0", "label": "hrl_lib.transforms import tr", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0373, 0.0025, 0, 0.66, 0.3226, 82, 0, 1, 0, 0, 82, 0, 0], "semantic": {"name": "hrl_lib.transforms", "arg_names": [], "import_names": ["tr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.transforms as tr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L16_C0", "label": "tf.transformations import tft", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0398, 0.0025, 0, 0.66, 0.3548, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tft"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tft"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L17_C0", "label": "display_particles import display_particles", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0423, 0.0025, 0, 0.66, 0.3871, 534, 0, 1, 0, 0, 534, 0, 0], "semantic": {"name": "display_particles", "arg_names": [], "import_names": ["display_particles"], "rhs_call_name": "", "annotation": ""}, "snippet": "import display_particles"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:ImportFrom_L18_C0", "label": "from display_particles import DisplayParticles", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0448, 0.0025, 0, 0.66, 0.4194, 534, 0, 1, 0, 0, 534, 0, 0], "semantic": {"name": "display_particles", "arg_names": [], "import_names": ["DisplayParticles"], "rhs_call_name": "", "annotation": ""}, "snippet": "from display_particles import DisplayParticles"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:ImportFrom_L19_C0", "label": "from geometry_msgs.msg import Quaternion, Point", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0473, 0.0025, 0, 0.66, 0.4516, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Quaternion", "Point"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Quaternion, Point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L21_C0", "label": "rfid_datacapture.math_util import mu", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0522, 0.0025, 0, 0.66, 0.4839, 974, 0, 1, 0, 0, 974, 0, 0], "semantic": {"name": "rfid_datacapture.math_util", "arg_names": [], "import_names": ["mu"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_datacapture.math_util as mu"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L22_C0", "label": "visualization_msgs.msg import vm", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0547, 0.0025, 0, 0.66, 0.5161, 124, 0, 1, 0, 0, 124, 0, 0], "semantic": {"name": "visualization_msgs.msg", "arg_names": [], "import_names": ["vm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import visualization_msgs.msg as vm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L23_C0", "label": "hrl_lib.transforms import tr", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0572, 0.0025, 0, 0.66, 0.5484, 82, 0, 1, 0, 0, 82, 0, 0], "semantic": {"name": "hrl_lib.transforms", "arg_names": [], "import_names": ["tr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.transforms as tr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L24_C0", "label": "hrl_lib.viz import viz", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0597, 0.0025, 0, 0.66, 0.5806, 48, 0, 1, 0, 0, 48, 0, 0], "semantic": {"name": "hrl_lib.viz", "arg_names": [], "import_names": ["viz"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.viz as viz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L25_C0", "label": "vsm =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.0622, 0.0025, 0, 0.66, 0.6129, 910, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vsm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "vsm = viz.single_marker"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L28_C0", "label": "random import rd", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0697, 0.0025, 0, 0.66, 0.6452, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["rd"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random as rd"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L29_C0", "label": "cPickle import pkl", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0721, 0.0025, 0, 0.66, 0.6774, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L30_C0", "label": "numpy import np, math", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.0746, 0.0025, 0, 0.66, 0.7097, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L31_C0", "label": "pylab import pl", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.0771, 0.0025, 0, 0.66, 0.7419, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L32_C0", "label": "time import time", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.0796, 0.0025, 0, 0.66, 0.7742, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L33_C0", "label": "glob import glob", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.0821, 0.0025, 0, 0.66, 0.8065, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "label": "pprint", "type": "function", "loc": [40, 75], "level": 0, "parent": null, "vector": [2, 0, 0.143, 0.0896, 0, 0.66, 0.8387, 276, 0, 1, 0, 0, 0, 0, 17], "semantic": {"name": "pprint", "arg_names": ["r"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pprint(r):\n print('\\nLocation %d, Object %d, Trial %d' % (r['loc'], r['obj_num'], r['trial_num']))\n\n if r['servo_yn']:\n print('\\tSEARCH plus SERVO')\n else:\n print('\\tSEARCH ONLY')\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L41_C4", "label": "print()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [8, 1, 0.102, 0.0025, 1, 0.12, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nLocation %d, Object %d, Trial %d' % (r['loc'], r['obj_num'], r['trial_num']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L43_C4", "label": "if", "type": "if", "loc": [43, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [4, 1, 0.1107, 0.01, 1, 0.12, 0.1111, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r['servo_yn']:\n print('\\tSEARCH plus SERVO')\n else:\n print('\\tSEARCH ONLY')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L44_C8", "label": "print()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L43_C4", "vector": [8, 2, 0.1095, 0.0025, 2, 0.07, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tSEARCH plus SERVO')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L46_C8", "label": "print()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L43_C4", "vector": [8, 2, 0.1144, 0.0025, 2, 0.07, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tSEARCH ONLY')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L48_C4", "label": "print()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [8, 1, 0.1194, 0.0025, 1, 0.12, 0.2222, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tPos Reads: %d' % (r['pos_readings']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L49_C4", "label": "print()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [8, 1, 0.1219, 0.0025, 1, 0.12, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tTot Reads: %d' % (r['tot_readings']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L50_C4", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [8, 1, 0.1244, 0.0025, 1, 0.12, 0.4444, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tPercent Reads: %2.1f' % (r['pos_readings']*100.0/r['tot_readings']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L52_C4", "label": "if", "type": "if", "loc": [52, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [4, 1, 0.1331, 0.01, 1, 0.12, 0.5556, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r['best_pos'].__class__ == ''.__class__:\n print('\\tEstimate Loc: --')\n else:\n print('\\tEstimate Loc: <%2.3f, %2.3f>' % ( r['best_pos'][0], r['best_pos'][1] ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L53_C8", "label": "print()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L52_C4", "vector": [8, 2, 0.1318, 0.0025, 2, 0.66, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tEstimate Loc: --')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L55_C8", "label": "print()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L52_C4", "vector": [8, 2, 0.1368, 0.0025, 2, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tEstimate Loc: <%2.3f, %2.3f>' % ( r['best_pos'][0], r['best_pos'][1] ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L57_C4", "label": "if", "type": "if", "loc": [57, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [4, 1, 0.1455, 0.01, 1, 0.12, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r['orient_est'].__class__ == ''.__class__:\n print('\\tEstimate Theta: --')\n else:\n print('\\tEstimate Theta: %2.1f (deg)' % ( math.degrees( r['orient_est'] )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L58_C8", "label": "print()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L57_C4", "vector": [8, 2, 0.1443, 0.0025, 2, 0.34, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tEstimate Theta: --')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L60_C8", "label": "print()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L57_C4", "vector": [8, 2, 0.1493, 0.0025, 2, 0.34, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tEstimate Theta: %2.1f (deg)' % ( math.degrees( r['orient_est'] )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L62_C4", "label": "if", "type": "if", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [4, 1, 0.158, 0.01, 1, 0.12, 0.7778, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r['dxy'].__class__ == ''.__class__:\n print('\\tDist Err (m): --')\n else:\n print('\\tDist Err (m): %2.3f' % ( r['dxy'] ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L63_C8", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L62_C4", "vector": [8, 2, 0.1567, 0.0025, 2, 0.73, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tDist Err (m): --')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L65_C8", "label": "print()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L62_C4", "vector": [8, 2, 0.1617, 0.0025, 2, 0.73, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tDist Err (m): %2.3f' % ( r['dxy'] ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L67_C4", "label": "if", "type": "if", "loc": [67, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [4, 1, 0.1704, 0.01, 1, 0.12, 0.8889, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r['dtheta'].__class__ == ''.__class__:\n print('\\tAng Err (deg): --')\n else:\n print('\\tAng Err (deg): %2.1f' % ( math.degrees( r['dtheta'] )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L68_C8", "label": "print()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L67_C4", "vector": [8, 2, 0.1692, 0.0025, 2, 0.42, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tAng Err (deg): --')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L70_C8", "label": "print()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L67_C4", "vector": [8, 2, 0.1741, 0.0025, 2, 0.42, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tAng Err (deg): %2.1f' % ( math.degrees( r['dtheta'] )))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L75_C4", "label": "print()", "type": "expression", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "vector": [8, 1, 0.1866, 0.0025, 1, 0.12, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\n\\n\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L79_C0", "label": "tdb =", "type": "assigned_variable", "loc": [79, 87], "level": 0, "parent": null, "vector": [14, 0, 0.2065, 0.0224, 0, 0.66, 0.871, 84, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "tdb", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "tdb = { 0: ['OrangeMedBot',[]],\n 1: ['TravisTVremo',[]],\n 2: ['RedBottle ',[]],\n 3: ['OnMetalKeys ',[]],\n 4: ['WhiteMedsBot',[]],\n 5: ['BlueMedsBox ',[]],\n 6: ['TeddyBearToy',[]],\n 7: ['CordlessPhon',[]],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L89_C0", "label": "pts =", "type": "assigned_variable", "loc": [89, 97], "level": 0, "parent": null, "vector": [14, 0, 0.2313, 0.0224, 0, 0.66, 0.9032, 195, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pts = { 0: ['BehindTree',[3.757, 6.017, 0.036]],\n 1: ['FireplaceMantle',[5.090, 4.238, 1.514]],\n 2: ['CircleEndTable',[5.399, 2.857, 0.607]],\n 3: ['Couch',[3.944, 1.425, 0.527]],\n 4: ['RectEndTable',[3.302, 0.932, 0.534]],\n 5: ['BehindKitchenTable',[-0.339, -2.393, 0.793]],\n 6: ['NearDishwaser',[-1.926, -0.835, 0.946]],\n 7: ['InCupboard',[-3.257, 1.294, 1.397]],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "label": "process_trialobj", "type": "function", "loc": [99, 310], "level": 0, "parent": null, "vector": [2, 0, 0.5087, 0.5274, 0, 0.66, 0.9355, 41, 0, 3, 1, 0, 0, 0, 57], "semantic": {"name": "process_trialobj", "arg_names": ["trial_num", "obj_num", "servo_yn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_trialobj( trial_num, obj_num, servo_yn ):\n obj_name = tdb[obj_num][0]\n tname = obj_name.replace( ' ', '' )\n\n loc = (trial_num + obj_num) % 9\n loc_name = pts[loc][0]\n loc_pos = np.array(pts[loc][1]) # Tag ground-truth location\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L100_C4", "label": "obj_name =", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2488, 0.0025, 1, 0.96, 0.0, 412, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_name = tdb[obj_num][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L101_C4", "label": "tname = replace()", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2512, 0.0025, 1, 0.96, 0.0189, 985, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "tname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tname = obj_name.replace( ' ', '' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L103_C4", "label": "loc =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2562, 0.0025, 1, 0.96, 0.0377, 822, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc = (trial_num + obj_num) % 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L104_C4", "label": "loc_name =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2587, 0.0025, 1, 0.96, 0.0566, 380, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "loc_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc_name = pts[loc][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L105_C4", "label": "loc_pos = array()", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2612, 0.0025, 1, 0.96, 0.0755, 668, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "loc_pos", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " loc_pos = np.array(pts[loc][1]) # Tag ground-truth location"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L108_C4", "label": "fname_prefix =", "type": "assigned_variable", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2687, 0.0025, 1, 0.96, 0.0943, 929, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fname_prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname_prefix = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L110_C4", "label": "servo_fname =", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2736, 0.0025, 1, 0.96, 0.1132, 192, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "servo_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_fname = fname_prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L114_C4", "label": "pf_search = replace()", "type": "assigned_variable", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2836, 0.0025, 1, 0.96, 0.1321, 743, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "pf_search", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " pf_search = servo_fname.replace('_servo.pkl', '_pf_search.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L115_C4", "label": "pf_servo = replace()", "type": "assigned_variable", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2861, 0.0025, 1, 0.96, 0.1509, 88, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "pf_servo", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " pf_servo = servo_fname.replace('_servo.pkl', '_pf_servo.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L120_C4", "label": "search_reads_fname =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.2985, 0.0025, 1, 0.96, 0.1698, 950, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "search_reads_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search_reads_fname = fname_prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L122_C4", "label": "f = open()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.3035, 0.0025, 1, 0.96, 0.1887, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( search_reads_fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L123_C4", "label": "summary_search = load()", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.306, 0.0025, 1, 0.96, 0.2075, 232, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "summary_search", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " summary_search = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L124_C4", "label": "close()", "type": "expression", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [8, 1, 0.3085, 0.0025, 1, 0.96, 0.2264, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L126_C4", "label": "pos_readings_search = sum()", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.3134, 0.0025, 1, 0.96, 0.2453, 568, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "pos_readings_search", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " pos_readings_search = sum([ True for p in summary_search if p.read.rssi != -1 and p.read.tagID == obj_name ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L127_C4", "label": "tot_readings_search = len()", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.3159, 0.0025, 1, 0.96, 0.2642, 153, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "tot_readings_search", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " tot_readings_search = len( summary_search )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L129_C4", "label": "if", "type": "if", "loc": [129, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [4, 1, 0.3396, 0.0398, 1, 0.96, 0.283, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pos_readings_search == 0: # No results!\n print('\\t No results for this instance.')\n\n res = { 'loc': loc,\n 'obj_num': obj_num,\n 'trial_num': trial_num,\n 'pos_readings': pos_readings_search,\n 'tot_readings':tot_readings_search,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L130_C8", "label": "print()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L129_C4", "vector": [8, 2, 0.3234, 0.0025, 2, 0.0, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\t No results for this instance.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L132_C8", "label": "res =", "type": "assigned_variable", "loc": [132, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L129_C4", "vector": [14, 2, 0.342, 0.0299, 2, 0.0, 0.5, 413, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = { 'loc': loc,\n 'obj_num': obj_num,\n 'trial_num': trial_num,\n 'pos_readings': pos_readings_search,\n 'tot_readings':tot_readings_search,\n 'best_pos': '--',\n 'orient_est': '--',\n 'dxy': '--',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L144_C8", "label": "return", "type": "return", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L129_C4", "vector": [13, 2, 0.3582, 0.0025, 2, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, res, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L146_C4", "label": "f = open()", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.3632, 0.0025, 1, 0.96, 0.3019, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( pf_search ) # load the particle set from Search data. Will overwrite if using search plus servo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L147_C4", "label": "p_set_loaded = load()", "type": "assigned_variable", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.3657, 0.0025, 1, 0.96, 0.3208, 579, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "p_set_loaded", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " p_set_loaded = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L148_C4", "label": "close()", "type": "expression", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [8, 1, 0.3682, 0.0025, 1, 0.96, 0.3396, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L150_C4", "label": "pos_readings =", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.3731, 0.0025, 1, 0.96, 0.3585, 225, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos_readings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos_readings = pos_readings_search"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L151_C4", "label": "tot_readings =", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.3756, 0.0025, 1, 0.96, 0.3774, 585, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tot_readings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tot_readings = tot_readings_search"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "label": "if", "type": "if", "loc": [154, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [4, 1, 0.4042, 0.0448, 1, 0.96, 0.3962, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if servo_yn:\n\n # update the stats for pos reads\n f = open( servo_fname, 'r' )\n summary_servo = pkl.load( f )\n f.close()\n\n pos_readings_servo = sum([ True for p in summary_servo if p.read.rssi != -1 and p.read.tagID == obj_name ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L157_C8", "label": "f = open()", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [14, 2, 0.3905, 0.0025, 2, 0.58, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( servo_fname, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L158_C8", "label": "summary_servo = load()", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [14, 2, 0.393, 0.0025, 2, 0.58, 0.1111, 764, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "summary_servo", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " summary_servo = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L159_C8", "label": "close()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [8, 2, 0.3955, 0.0025, 2, 0.58, 0.2222, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L161_C8", "label": "pos_readings_servo = sum()", "type": "assigned_variable", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [14, 2, 0.4005, 0.0025, 2, 0.58, 0.3333, 629, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "pos_readings_servo", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " pos_readings_servo = sum([ True for p in summary_servo if p.read.rssi != -1 and p.read.tagID == obj_name ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L162_C8", "label": "tot_readings_servo = len()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [14, 2, 0.403, 0.0025, 2, 0.58, 0.4444, 79, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "tot_readings_servo", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " tot_readings_servo = len( summary_servo )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L164_C8", "label": "pos_readings =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [14, 2, 0.408, 0.0025, 2, 0.58, 0.5556, 225, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos_readings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos_readings = pos_readings_search + pos_readings_servo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L165_C8", "label": "tot_readings =", "type": "assigned_variable", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [14, 2, 0.4104, 0.0025, 2, 0.58, 0.6667, 585, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tot_readings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tot_readings = tot_readings_search + tot_readings_servo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L169_C8", "label": "f = open()", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [14, 2, 0.4204, 0.0025, 2, 0.58, 0.7778, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( pf_servo )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L170_C8", "label": "p_set_loaded = load()", "type": "assigned_variable", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [14, 2, 0.4229, 0.0025, 2, 0.58, 0.8889, 579, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "p_set_loaded", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " p_set_loaded = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L171_C8", "label": "close()", "type": "expression", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "vector": [8, 2, 0.4254, 0.0025, 2, 0.58, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L196_C4", "label": "p_set = copy()", "type": "assigned_variable", "loc": [196, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.4876, 0.0025, 1, 0.96, 0.4151, 28, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "p_set", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " p_set = np.copy( p_set_loaded )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L197_C4", "label": "p_set =", "type": "assigned_variable", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.49, 0.0025, 1, 0.96, 0.434, 28, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "p_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p_set = p_set[ np.argsort( p_set[:,2] )[::-1] ] # sort by decreasing weight"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L198_C4", "label": "w_norm =", "type": "assigned_variable", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.4925, 0.0025, 1, 0.96, 0.4528, 849, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "w_norm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_norm = p_set[:,2] / np.sum( p_set[:,2] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L199_C4", "label": "w_cum = cumsum()", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.495, 0.0025, 1, 0.96, 0.4717, 234, 3, 1, 0, 0, 214, 10, 1], "semantic": {"name": "w_cum", "arg_names": [], "import_names": [], "rhs_call_name": "cumsum", "annotation": ""}, "snippet": " w_cum = np.cumsum( w_norm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L203_C4", "label": "w_mass =", "type": "assigned_variable", "loc": [203, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.505, 0.0025, 1, 0.96, 0.4906, 327, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w_mass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_mass = w_cum[:8000][-1] * 100.0 # Ratio of mass in p_set to total:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L204_C4", "label": "p_set =", "type": "assigned_variable", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.5075, 0.0025, 1, 0.96, 0.5094, 28, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p_set = p_set[:8000] # only keep top 8000 for computational reasons!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L219_C4", "label": "pf_costmap =", "type": "assigned_variable", "loc": [219, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.5448, 0.0025, 1, 0.96, 0.5283, 278, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pf_costmap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pf_costmap = '/home/travis/svn/robot1/src/projects/rfid_pf/src/rfid_pf/pf_costmap.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L221_C4", "label": "f = open()", "type": "assigned_variable", "loc": [221, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.5498, 0.0025, 1, 0.96, 0.5472, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( pf_costmap )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L222_C4", "label": "costmap = load()", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.5522, 0.0025, 1, 0.96, 0.566, 960, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "costmap", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " costmap = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L223_C4", "label": "close()", "type": "expression", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [8, 1, 0.5547, 0.0025, 1, 0.96, 0.5849, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L225_C4", "label": "cm =", "type": "assigned_variable", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.5597, 0.0025, 1, 0.96, 0.6038, 675, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cm = costmap[ np.where( costmap[:,2] )[0] ] # Locations where the robot can be located"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L229_C4", "label": "score_loc", "type": "function", "loc": [229, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [2, 1, 0.5746, 0.0124, 1, 0.96, 0.6226, 537, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "score_loc", "arg_names": ["xy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def score_loc( xy ):\n # The xy location under consideration for the robot\n mag = np.sqrt( np.sum( np.power( p_set[:,0:2] - xy, 2.0 ), axis = 1)) # || dist ||\n score = mag * p_set[:,2] # || dist || * w's\n return np.sum( score )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L231_C8", "label": "mag = sqrt()", "type": "assigned_variable", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L229_C4", "vector": [14, 2, 0.5746, 0.0025, 2, 0.69, 0.0, 533, 3, 1, 0, 0, 259, 10, 3], "semantic": {"name": "mag", "arg_names": [], "import_names": [], "rhs_call_name": "sqrt", "annotation": ""}, "snippet": " mag = np.sqrt( np.sum( np.power( p_set[:,0:2] - xy, 2.0 ), axis = 1)) # || dist ||"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L232_C8", "label": "score =", "type": "assigned_variable", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L229_C4", "vector": [14, 2, 0.5771, 0.0025, 2, 0.69, 0.5, 34, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "score", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " score = mag * p_set[:,2] # || dist || * w's"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L233_C8", "label": "return", "type": "return", "loc": [233, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L229_C4", "vector": [13, 2, 0.5796, 0.0025, 2, 0.69, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.sum( score )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L237_C4", "label": "t0 = time()", "type": "assigned_variable", "loc": [237, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.5896, 0.0025, 1, 0.96, 0.6415, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L238_C4", "label": "pos_scores =", "type": "assigned_variable", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.592, 0.0025, 1, 0.96, 0.6604, 879, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pos_scores", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos_scores = [ score_loc( i[0:2] ) for i in cm ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L239_C4", "label": "dt =", "type": "assigned_variable", "loc": [239, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.5945, 0.0025, 1, 0.96, 0.6792, 455, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dt = time.time() - t0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L243_C4", "label": "best_ind = argmin()", "type": "assigned_variable", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.6045, 0.0025, 1, 0.96, 0.6981, 419, 3, 1, 0, 0, 879, 10, 1], "semantic": {"name": "best_ind", "arg_names": [], "import_names": [], "rhs_call_name": "argmin", "annotation": ""}, "snippet": " best_ind = np.argmin( pos_scores )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L244_C4", "label": "best_pos =", "type": "assigned_variable", "loc": [244, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.607, 0.0025, 1, 0.96, 0.717, 408, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "best_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_pos = cm[ best_ind ][0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L267_C4", "label": "theta_hats = linspace()", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.6642, 0.0025, 1, 0.96, 0.7358, 198, 3, 4, 0, 0, 119, 10, 1], "semantic": {"name": "theta_hats", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": " theta_hats = np.linspace( -1.0 * np.pi, np.pi, 360, endpoint = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L268_C4", "label": "theta_hats = array()", "type": "assigned_variable", "loc": [268, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.6667, 0.0025, 1, 0.96, 0.7547, 198, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "theta_hats", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " theta_hats = np.array([ mu.standard_rad( i ) for i in theta_hats ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L270_C4", "label": "dxy =", "type": "assigned_variable", "loc": [270, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.6716, 0.0025, 1, 0.96, 0.7736, 773, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dxy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dxy = p_set[:,0:2] - best_pos # put the p_set into the best_pos frame!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L271_C4", "label": "pset_thetas = arctan2()", "type": "assigned_variable", "loc": [271, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.6741, 0.0025, 1, 0.96, 0.7925, 948, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "pset_thetas", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " pset_thetas = np.arctan2( dxy[:,1], dxy[:,0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L272_C4", "label": "pset_thetas = array()", "type": "assigned_variable", "loc": [272, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.6766, 0.0025, 1, 0.96, 0.8113, 948, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "pset_thetas", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " pset_thetas = np.array([ mu.standard_rad( i ) for i in pset_thetas ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L274_C4", "label": "pset_w_normed =", "type": "assigned_variable", "loc": [274, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.6816, 0.0025, 1, 0.96, 0.8302, 494, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pset_w_normed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pset_w_normed = p_set[:,2] / np.sum( p_set[:,2] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "label": "exp_err", "type": "function", "loc": [276, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [2, 1, 0.6915, 0.0124, 1, 0.96, 0.8491, 230, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "exp_err", "arg_names": ["th"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exp_err( th ):\n errs = np.abs([ mu.standard_rad( i ) for i in th - pset_thetas ])\n weighted_errs = pset_w_normed * errs\n mean_we = np.mean( weighted_errs )\n return mean_we"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L277_C8", "label": "errs = abs()", "type": "assigned_variable", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "vector": [14, 2, 0.6891, 0.0025, 2, 0.97, 0.0, 190, 3, 1, 0, 0, 799, 10, 2], "semantic": {"name": "errs", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " errs = np.abs([ mu.standard_rad( i ) for i in th - pset_thetas ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L278_C8", "label": "weighted_errs =", "type": "assigned_variable", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "vector": [14, 2, 0.6915, 0.0025, 2, 0.97, 0.3333, 731, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "weighted_errs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " weighted_errs = pset_w_normed * errs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L279_C8", "label": "mean_we = mean()", "type": "assigned_variable", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "vector": [14, 2, 0.694, 0.0025, 2, 0.97, 0.6667, 579, 3, 1, 0, 0, 856, 10, 1], "semantic": {"name": "mean_we", "arg_names": [], "import_names": [], "rhs_call_name": "mean", "annotation": ""}, "snippet": " mean_we = np.mean( weighted_errs )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L280_C8", "label": "return", "type": "return", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "vector": [13, 2, 0.6965, 0.0025, 2, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mean_we"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L282_C4", "label": "theta_hats_res = array()", "type": "assigned_variable", "loc": [282, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.7015, 0.0025, 1, 0.96, 0.8679, 598, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "theta_hats_res", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " theta_hats_res = np.array([ exp_err( i ) for i in theta_hats ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L286_C4", "label": "orient_est_ind = argmin()", "type": "assigned_variable", "loc": [286, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.7114, 0.0025, 1, 0.96, 0.8868, 10, 3, 1, 0, 0, 879, 10, 1], "semantic": {"name": "orient_est_ind", "arg_names": [], "import_names": [], "rhs_call_name": "argmin", "annotation": ""}, "snippet": " orient_est_ind = np.argmin( theta_hats_res )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L287_C4", "label": "orient_est =", "type": "assigned_variable", "loc": [287, 287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.7139, 0.0025, 1, 0.96, 0.9057, 160, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "orient_est", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " orient_est = theta_hats[ orient_est_ind ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L290_C4", "label": "dxy = norm()", "type": "assigned_variable", "loc": [290, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.7214, 0.0025, 1, 0.96, 0.9245, 773, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "dxy", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " dxy = np.linalg.norm( best_pos - loc_pos[0:2] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L291_C4", "label": "true_theta = arctan2()", "type": "assigned_variable", "loc": [291, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.7251, 0.005, 1, 0.96, 0.9434, 52, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "true_theta", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " true_theta = np.arctan2( loc_pos[1] - best_pos[1], # y / x\n loc_pos[0] - best_pos[0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L293_C4", "label": "dtheta = standard_rad()", "type": "assigned_variable", "loc": [293, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.7289, 0.0025, 1, 0.96, 0.9623, 256, 3, 1, 0, 0, 54, 10, 1], "semantic": {"name": "dtheta", "arg_names": [], "import_names": [], "rhs_call_name": "standard_rad", "annotation": ""}, "snippet": " dtheta = mu.standard_rad( orient_est - true_theta )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L295_C4", "label": "res =", "type": "assigned_variable", "loc": [295, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [14, 1, 0.75, 0.0348, 1, 0.96, 0.9811, 413, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = { 'loc': loc,\n 'obj_num': obj_num,\n 'trial_num': trial_num,\n 'pos_readings': pos_readings,\n 'tot_readings':tot_readings,\n 'best_pos': best_pos,\n 'orient_est': orient_est,\n 'dxy': dxy,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L310_C4", "label": "return", "type": "return", "loc": [310, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "vector": [13, 1, 0.7711, 0.0025, 1, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, res, np.copy( p_set ) # Was_reads?, results dict, particles (for display)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "label": "MAIN_PROCESS", "type": "function", "loc": [314, 366], "level": 0, "parent": null, "vector": [2, 0, 0.8458, 0.1318, 0, 0.66, 0.9677, 148, 0, 4, 0, 0, 0, 0, 23], "semantic": {"name": "MAIN_PROCESS", "arg_names": ["trial_num", "obj_num", "servo_yn", "screen_cap"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def MAIN_PROCESS( trial_num, obj_num, servo_yn, screen_cap = False ):\n print('In MP: ', trial_num, obj_num, servo_yn, screen_cap)\n # best_pos, orient_est, p_set = process_trialobj( 4, 3, True )\n was_reads, res, p_set = process_trialobj( trial_num, obj_num, servo_yn )\n\n print('RESULTS')\n pprint( res )\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L315_C4", "label": "print()", "type": "expression", "loc": [315, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.7836, 0.0025, 1, 0.99, 0.0, 535, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('In MP: ', trial_num, obj_num, servo_yn, screen_cap)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L317_C4", "label": "was_reads, res, p_set = process_trialobj()", "type": "assigned_variable", "loc": [317, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [14, 1, 0.7886, 0.0025, 1, 0.99, 0.0556, 888, 3, 3, 0, 0, 41, 10, 1], "semantic": {"name": "was_reads, res, p_set", "arg_names": [], "import_names": [], "rhs_call_name": "process_trialobj", "annotation": ""}, "snippet": " was_reads, res, p_set = process_trialobj( trial_num, obj_num, servo_yn )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L319_C4", "label": "print()", "type": "expression", "loc": [319, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.7935, 0.0025, 1, 0.99, 0.1111, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('RESULTS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L320_C4", "label": "pprint()", "type": "expression", "loc": [320, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.796, 0.0025, 1, 0.99, 0.1667, 276, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pprint", "arg_names": [], "import_names": [], "rhs_call_name": "pprint", "annotation": ""}, "snippet": " pprint( res )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L324_C4", "label": "if", "type": "if", "loc": [324, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [4, 1, 0.8097, 0.01, 1, 0.99, 0.2222, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if screen_cap:\n f = open( 'Obj%d_Trial%d_Servo%d_pf_results.pkl' % (obj_num, trial_num, int( servo_yn )), 'w')\n pkl.dump( res, f )\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L325_C8", "label": "f = open()", "type": "assigned_variable", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L324_C4", "vector": [14, 2, 0.8085, 0.0025, 2, 0.73, 0.0, 899, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( 'Obj%d_Trial%d_Servo%d_pf_results.pkl' % (obj_num, trial_num, int( servo_yn )), 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L326_C8", "label": "dump()", "type": "expression", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L324_C4", "vector": [8, 2, 0.8109, 0.0025, 2, 0.73, 0.5, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pkl.dump( res, f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L327_C8", "label": "close()", "type": "expression", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L324_C4", "vector": [8, 2, 0.8134, 0.0025, 2, 0.73, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L331_C4", "label": "if", "type": "if", "loc": [331, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [4, 1, 0.8246, 0.005, 1, 0.99, 0.2778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not was_reads: # Skip step if no reads.\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L332_C8", "label": "return", "type": "return", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L331_C4", "vector": [13, 2, 0.8259, 0.0025, 2, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L334_C4", "label": "best_pos =", "type": "assigned_variable", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [14, 1, 0.8308, 0.0025, 1, 0.99, 0.3333, 408, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "best_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_pos = res[ 'best_pos' ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L335_C4", "label": "orient_est =", "type": "assigned_variable", "loc": [335, 335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [14, 1, 0.8333, 0.0025, 1, 0.99, 0.3889, 160, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "orient_est", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " orient_est = res[ 'orient_est' ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L337_C4", "label": "pub_mark = Publisher()", "type": "assigned_variable", "loc": [337, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [14, 1, 0.8383, 0.0025, 1, 0.99, 0.4444, 577, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub_mark", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L339_C4", "label": "if", "type": "if", "loc": [339, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [4, 1, 0.847, 0.01, 1, 0.99, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if servo_yn:\n c_tm = [0./255, 205./255, 255./255, 1.0] # rgba\n else:\n c_tm = [255./255, 123./255, 1./255, 1.0] # rgba"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L340_C8", "label": "c_tm =", "type": "assigned_variable", "loc": [340, 340], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L339_C4", "vector": [14, 2, 0.8458, 0.0025, 2, 0.2, 0.0, 621, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "c_tm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_tm = [0./255, 205./255, 255./255, 1.0] # rgba"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L342_C8", "label": "c_tm =", "type": "assigned_variable", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L339_C4", "vector": [14, 2, 0.8507, 0.0025, 2, 0.2, 1.0, 621, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "c_tm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_tm = [255./255, 123./255, 1./255, 1.0] # rgba"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L344_C4", "label": "tm = vsm()", "type": "assigned_variable", "loc": [344, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [14, 1, 0.8632, 0.0174, 1, 0.99, 0.5556, 404, 3, 8, 0, 0, 910, 10, 4], "semantic": {"name": "tm", "arg_names": [], "import_names": [], "rhs_call_name": "vsm", "annotation": ""}, "snippet": " tm = vsm( np.matrix([ best_pos[0],best_pos[1], 0.0 ]).T,\n np.matrix(tft.quaternion_from_euler( 0.0, 0.0, orient_est )).T,\n 'arrow', '/map',\n scale = [0.5, 1.0, 1.0],\n color = c_tm, \n duration = 50.0,\n m_id = 2*p_set.shape[0] + 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L352_C4", "label": "pub_tm", "type": "function", "loc": [352, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [2, 1, 0.8806, 0.0124, 1, 0.99, 0.6111, 74, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "pub_tm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pub_tm( ):\n tm.header.stamp = rospy.Time.now()\n for i in xrange( 10 ):\n pub_mark.publish( tm )\n rospy.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L353_C8", "label": "tm.header.stamp = now()", "type": "assigned_variable", "loc": [353, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L352_C4", "vector": [14, 2, 0.8781, 0.0025, 2, 0.34, 0.0, 858, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "tm.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " tm.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L354_C8", "label": "for i", "type": "for", "loc": [354, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L352_C4", "vector": [6, 2, 0.8831, 0.0075, 2, 0.34, 1.0, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange( 10 ):\n pub_mark.publish( tm )\n rospy.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L355_C12", "label": "publish()", "type": "expression", "loc": [355, 355], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L354_C8", "vector": [8, 3, 0.8831, 0.0025, 3, 0.4, 0.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " pub_mark.publish( tm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L356_C12", "label": "sleep()", "type": "expression", "loc": [356, 356], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L354_C8", "vector": [8, 3, 0.8856, 0.0025, 3, 0.4, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L358_C4", "label": "print()", "type": "expression", "loc": [358, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.8905, 0.0025, 1, 0.99, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Click on RVIZ!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L359_C4", "label": "sleep()", "type": "expression", "loc": [359, 359], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.893, 0.0025, 1, 0.99, 0.7222, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L361_C4", "label": "pub_tm()", "type": "expression", "loc": [361, 361], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.898, 0.0025, 1, 0.99, 0.7778, 74, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pub_tm", "arg_names": [], "import_names": [], "rhs_call_name": "pub_tm", "annotation": ""}, "snippet": " pub_tm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L362_C4", "label": "pub_tm()", "type": "expression", "loc": [362, 362], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.9005, 0.0025, 1, 0.99, 0.8333, 74, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pub_tm", "arg_names": [], "import_names": [], "rhs_call_name": "pub_tm", "annotation": ""}, "snippet": " pub_tm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L363_C4", "label": "display_trialobj()", "type": "expression", "loc": [363, 363], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.903, 0.0025, 1, 0.99, 0.8889, 4, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "display_trialobj", "arg_names": [], "import_names": [], "rhs_call_name": "display_trialobj", "annotation": ""}, "snippet": " display_particles.display_trialobj( trial_num, obj_num, servo_yn, screen_cap = screen_cap )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L364_C4", "label": "print()", "type": "expression", "loc": [364, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [8, 1, 0.9055, 0.0025, 1, 0.99, 0.9444, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done.\\n\\n\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L366_C4", "label": "return", "type": "return", "loc": [366, 366], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "vector": [13, 1, 0.9104, 0.0025, 1, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "label": "if", "type": "if", "loc": [373, 402], "level": 0, "parent": null, "vector": [4, 0, 0.9639, 0.0746, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n\n import optparse\n p = optparse.OptionParser()\n p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')\n p.add_option('--obj', action='store', type='int', dest='obj',\n help='object number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L375_C4", "label": "optparse import optparse", "type": "import", "loc": [375, 375], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [1, 1, 0.9328, 0.0025, 1, 0.23, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L376_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [376, 376], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [14, 1, 0.9353, 0.0025, 1, 0.23, 0.1, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L377_C4", "label": "add_option()", "type": "expression", "loc": [377, 378], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [8, 1, 0.9391, 0.005, 1, 0.23, 0.2, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L379_C4", "label": "add_option()", "type": "expression", "loc": [379, 380], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [8, 1, 0.944, 0.005, 1, 0.23, 0.3, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--obj', action='store', type='int', dest='obj',\n help='object number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L381_C4", "label": "add_option()", "type": "expression", "loc": [381, 382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [8, 1, 0.949, 0.005, 1, 0.23, 0.4, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--servo', action='store_true', dest='servo',\n help='Use combined search and servo?', default = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L383_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [383, 383], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [14, 1, 0.9527, 0.0025, 1, 0.23, 0.5, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L385_C4", "label": "obj_num =", "type": "assigned_variable", "loc": [385, 385], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [14, 1, 0.9577, 0.0025, 1, 0.23, 0.6, 584, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj_num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_num = opt.obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L386_C4", "label": "trial_num =", "type": "assigned_variable", "loc": [386, 386], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [14, 1, 0.9602, 0.0025, 1, 0.23, 0.7, 298, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "trial_num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " trial_num = opt.trial"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L387_C4", "label": "servo_yn =", "type": "assigned_variable", "loc": [387, 387], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [14, 1, 0.9627, 0.0025, 1, 0.23, 0.8, 267, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "servo_yn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_yn = opt.servo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L389_C4", "label": "init_node()", "type": "expression", "loc": [389, 389], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [8, 1, 0.9677, 0.0025, 1, 0.23, 0.9, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'goober' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L392_C4", "label": "if", "type": "if", "loc": [392, 402], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "vector": [4, 1, 0.9876, 0.0274, 1, 0.23, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if trial_num < 9:\n while not rospy.is_shutdown():\n print('Publishing.')\n MAIN_PROCESS( trial_num, obj_num, servo_yn )\n else:\n # for i in range( 0, 1 ): # trial\n # for j in range( 4, 5 ): # obj\n for i in range( 0, 9 ): # trial"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:While_L393_C8", "label": "while", "type": "while", "loc": [393, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L392_C4", "vector": [5, 2, 0.9801, 0.0075, 2, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not rospy.is_shutdown():\n print('Publishing.')\n MAIN_PROCESS( trial_num, obj_num, servo_yn )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L394_C12", "label": "print()", "type": "expression", "loc": [394, 394], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:While_L393_C8", "vector": [8, 3, 0.9801, 0.0025, 3, 0.63, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Publishing.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L395_C12", "label": "MAIN_PROCESS()", "type": "expression", "loc": [395, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:While_L393_C8", "vector": [8, 3, 0.9826, 0.0025, 3, 0.63, 1.0, 148, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "MAIN_PROCESS", "arg_names": [], "import_names": [], "rhs_call_name": "MAIN_PROCESS", "annotation": ""}, "snippet": " MAIN_PROCESS( trial_num, obj_num, servo_yn )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L399_C8", "label": "for i", "type": "for", "loc": [399, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L392_C4", "vector": [6, 2, 0.9963, 0.01, 2, 0.31, 1.0, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range( 0, 9 ): # trial\n for j in range( 0, 9 ): # obj\n for s in [False, True]: # servo_yn\n MAIN_PROCESS( i, j, s, screen_cap = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L400_C12", "label": "for j", "type": "for", "loc": [400, 402], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L399_C8", "vector": [6, 3, 0.9975, 0.0075, 3, 0.75, 0.0, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range( 0, 9 ): # obj\n for s in [False, True]: # servo_yn\n MAIN_PROCESS( i, j, s, screen_cap = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L401_C16", "label": "for s", "type": "for", "loc": [401, 402], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L400_C12", "vector": [6, 4, 0.9988, 0.005, 4, 0.89, 0.0, 553, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s in [False, True]: # servo_yn\n MAIN_PROCESS( i, j, s, screen_cap = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L402_C20", "label": "MAIN_PROCESS()", "type": "expression", "loc": [402, 402], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L401_C16", "vector": [8, 5, 1.0, 0.0025, 5, 0.02, 0.0, 148, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "MAIN_PROCESS", "arg_names": [], "import_names": [], "rhs_call_name": "MAIN_PROCESS", "annotation": ""}, "snippet": " MAIN_PROCESS( i, j, s, screen_cap = True )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L293_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L331_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L340_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L352_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L353_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L352_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L356_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L361_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L364_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:FunctionDef_L314_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Return_L366_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Import_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L376_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L377_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L379_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L381_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L383_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L385_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L386_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Assign_L387_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L389_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L392_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L392_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:While_L393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:While_L393_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L394_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:While_L393_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L395_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:If_L392_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L399_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L400_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L400_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L401_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99447:For_L401_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99447:Expr_L402_C20"}] |
#!/usr/bin/python
import rfid_model
import lib_pfilter
import roslib
roslib.load_manifest('visualization_msgs')
roslib.load_manifest('hrl_lib')
roslib.load_manifest('pfilter')
import rospy
import visualization_msgs.msg as vm
import hrl_lib.transforms as tr
import hrl_lib.viz as viz
vsm = viz.single_marker
import pfilter.pfilter as pfilter
import random as rd
import numpy as np, math
import pylab as pl
import time
import cPickle as pkl
import os
import glob
class DisplayParticles:
def __init__( self, pub_topic = '/particles' ):
self.m = None
self.pub_mark = rospy.Publisher( pub_topic, vm.Marker )
self.mid = 0
try:
rospy.init_node('display_particles')
except:
rospy.logout( 'DisplayParticles: Node already initialized' )
pass
def create_mark( self, p, c = [1.0, 0.0, 0.0, 0.8], mid = None ):
if mid == None:
self.mid += 1
mid = self.mid
m = vsm( np.matrix([ p[0], p[1], 0.0 ]).T,
np.matrix([ 0.0, 0.0, 0.0, 1.0 ]).T,
'sphere', '/map',
scale = [0.025, 0.025, 0.025],
color = [1.0, 0.0, 0.0, 0.3], # rgba,
duration = 10.0,
m_id = mid )
m.header.stamp = rospy.Time.now()
return m
def update( self, particles ):
xyz = np.column_stack([ particles[:,0:2], np.zeros( particles.shape[0] )]).T
w = particles[:,2] # becomes 1D
# print w
wmin = np.min( w )
wmax = np.max( w )
# import pdb
# pdb.set_trace()
if wmin == wmax:
colors = np.row_stack([ np.ones( particles.shape[0] ),
np.zeros( particles.shape[0] ),
np.zeros( particles.shape[0] ),
np.ones( particles.shape[0] ) ])
else:
colors = np.array([ pl.cm.jet( int( 1.0 * ( wi - wmin ) / (wmax - wmin) * 255.0 ))
for wi in w ]).T
m = viz.list_marker( xyz, colors, [0.025, 0.025, 0.025], 'points', '/map', 300 )
m.header.stamp = rospy.Time.now()
for i in xrange( 10 ):
self.pub_mark.publish( m )
rospy.sleep( 0.2 )
return
def update2( self, particles ):
xyz = np.column_stack([ particles[:,0:2], np.zeros( particles.shape[0] )]).T
w = particles[:,2] # becomes 1D
# print w
wmin = np.min( w )
wmax = np.max( w )
# import pdb
# pdb.set_trace()
if wmin == wmax:
colors = np.row_stack([ np.ones( particles.shape[0] ),
np.zeros( particles.shape[0] ),
np.zeros( particles.shape[0] ),
np.ones( particles.shape[0] ) ])
iv = np.ones( len( w )).tolist()
else:
iv = [ int( 1.0 * ( wi - wmin ) / (wmax - wmin) * 255.0 ) for wi in w ]
colors = np.array([ pl.cm.jet( ivi ) for ivi in iv ]).T
# colors[3] *= 0.3
print np.array(iv)
ind = np.where( np.array(iv) > 5 )[0]
aind = np.argsort( w[ind] ) # sort them so that some come to top.
m = viz.list_marker( xyz[:,ind][:,aind], colors[:,ind][:,aind], [0.05, 0.05, 0.025], 'points', '/map', 30 )
m.header.stamp = rospy.Time.now()
for i in xrange( 10 ):
self.pub_mark.publish( m )
rospy.sleep( 0.2 )
return
def display_trialobj( trial_num, obj_num, servo_yn, screen_cap = False ):
try:
rospy.init_node( 'ros_pf' )
except:
print 'display_trialobj: node already initialized'
pass
tdb = { 0: ['OrangeMedBot',[]],
1: ['TravisTVremo',[]],
2: ['RedBottle ',[]],
3: ['OnMetalKeys ',[]],
4: ['WhiteMedsBot',[]],
5: ['BlueMedsBox ',[]],
6: ['TeddyBearToy',[]],
7: ['CordlessPhon',[]],
8: ['BlueHairBrus',[]]}
pts = { 0: ['BehindTree',[3.757, 6.017, 0.036]],
1: ['FireplaceMantle',[5.090, 4.238, 1.514]],
2: ['CircleEndTable',[5.399, 2.857, 0.607]],
3: ['Couch',[3.944, 1.425, 0.527]],
4: ['RectEndTable',[3.302, 0.932, 0.534]],
5: ['BehindKitchenTable',[-0.339, -2.393, 0.793]],
6: ['NearDishwaser',[-1.926, -0.835, 0.946]],
7: ['InCupboard',[-3.257, 1.294, 1.397]],
8: ['OnFilingCabinet',[-0.083, 2.332, 0.670]]}
obj_name = tdb[obj_num][0]
tname = obj_name.replace( ' ', '' )
loc = (trial_num + obj_num) % 9
loc_name = pts[loc][0]
loc_pos = np.array(pts[loc][1]) # Tag ground-truth location
fname_prefix = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/'
servo_fname = fname_prefix
servo_fname += 'search_aware_home/'
servo_fname += 'woot_150_'+str(trial_num)+'_tag_'+obj_name.replace(' ','')+'_servo.pkl'
pf_search = servo_fname.replace('_servo.pkl', '_pf_search.pkl')
pf_servo = servo_fname.replace('_servo.pkl', '_pf_servo.pkl')
glob_r = glob.glob( servo_fname )
if glob_r == []:
print '\t No results for this instance.\n\n'
return
if len(glob_r) > 1:
print '\t Multiple results...?! Weirdness. Skipping.'
return
if servo_yn:
f = open( pf_servo, 'r' )
p_set = pkl.load( f )
f.close()
else:
f = open( pf_search, 'r' )
p_set = pkl.load( f )
f.close()
dp = DisplayParticles()
pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )
tm = vsm( np.matrix([ pts[loc][1][0],
pts[loc][1][1],
pts[loc][1][2] ]).T,
np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),
'sphere', '/map',
color = [0.0, 1.0, 0.0, 1.0], # rgba
duration = 150.0,
m_id = 2*p_set.shape[0] + 1 )
def pub_tm():
tm.header.stamp = rospy.Time.now()
for i in xrange( 10 ):
pub_mark.publish( tm )
rospy.sleep( 0.3 )
def update_display():
print 'UPDATING DISPLAY... '
pub_tm()
pub_tm()
dp.update2( p_set )
rospy.sleep( 0.3 )
print 'DONE.'
print 'UPDATING'
update_display()
rospy.sleep( 1.0 )
if screen_cap:
os.system( 'scrot -d 2 -u Obj%d_Trial%d_Servo%d_pf_results.png' % ( obj_num, trial_num, int(servo_yn) ))
rospy.sleep( 2.0 )
print 'DERP'
return
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--trial', action='store', type='int', dest='trial',
help='trial number (0-8)')
p.add_option('--obj', action='store', type='int', dest='obj',
help='object number (0-8)')
p.add_option('--servo', action='store_true', dest='servo',
help='Use combined search and servo?', default = False)
opt, args = p.parse_args()
obj_num = opt.obj
trial_num = opt.trial
servo_yn = opt.servo
if trial_num < 9:
while not rospy.is_shutdown():
display_trialobj( trial_num, obj_num, servo_yn )
else:
print 'Click on RVIZ!'
time.sleep( 3 )
for trial_num in range( 0, 9 ):
for obj_num in range( 0, 9 ):
for servo_yn in [False, True]:
print 'Calling display trialobj: ', trial_num, obj_num, servo_yn
display_trialobj( trial_num, obj_num, servo_yn, screen_cap = True )
print 'Done.\n\n\n'
| ajibawa-2023/Python-Code-Large/train/row_99448 | 139 | 247 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L3_C0", "label": "rfid_model import rfid_model", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0121, 0.004, 0, 0.66, 0.0, 973, 0, 1, 0, 0, 973, 0, 0], "semantic": {"name": "rfid_model", "arg_names": [], "import_names": ["rfid_model"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rfid_model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L4_C0", "label": "lib_pfilter import lib_pfilter", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0162, 0.004, 0, 0.66, 0.0476, 170, 0, 1, 0, 0, 170, 0, 0], "semantic": {"name": "lib_pfilter", "arg_names": [], "import_names": ["lib_pfilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "import lib_pfilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L6_C0", "label": "roslib import roslib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0243, 0.004, 0, 0.66, 0.0952, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0283, 0.004, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('visualization_msgs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0324, 0.004, 0, 0.66, 0.1905, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0364, 0.004, 0, 0.66, 0.2381, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('pfilter')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L10_C0", "label": "rospy import rospy", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0405, 0.004, 0, 0.66, 0.2857, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L12_C0", "label": "visualization_msgs.msg import vm", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0486, 0.004, 0, 0.66, 0.3333, 124, 0, 1, 0, 0, 124, 0, 0], "semantic": {"name": "visualization_msgs.msg", "arg_names": [], "import_names": ["vm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import visualization_msgs.msg as vm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L13_C0", "label": "hrl_lib.transforms import tr", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.004, 0, 0.66, 0.381, 82, 0, 1, 0, 0, 82, 0, 0], "semantic": {"name": "hrl_lib.transforms", "arg_names": [], "import_names": ["tr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.transforms as tr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L14_C0", "label": "hrl_lib.viz import viz", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0567, 0.004, 0, 0.66, 0.4286, 48, 0, 1, 0, 0, 48, 0, 0], "semantic": {"name": "hrl_lib.viz", "arg_names": [], "import_names": ["viz"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.viz as viz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L15_C0", "label": "vsm =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0607, 0.004, 0, 0.66, 0.4762, 910, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vsm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "vsm = viz.single_marker"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L16_C0", "label": "pfilter.pfilter import pfilter", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0648, 0.004, 0, 0.66, 0.5238, 876, 0, 1, 0, 0, 876, 0, 0], "semantic": {"name": "pfilter.pfilter", "arg_names": [], "import_names": ["pfilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pfilter.pfilter as pfilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L18_C0", "label": "random import rd", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0729, 0.004, 0, 0.66, 0.5714, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["rd"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random as rd"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L19_C0", "label": "numpy import np, math", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.004, 0, 0.66, 0.619, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L20_C0", "label": "pylab import pl", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.081, 0.004, 0, 0.66, 0.6667, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L21_C0", "label": "time import time", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.085, 0.004, 0, 0.66, 0.7143, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L22_C0", "label": "cPickle import pkl", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0891, 0.004, 0, 0.66, 0.7619, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pkl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pkl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L23_C0", "label": "os import os", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0931, 0.004, 0, 0.66, 0.8095, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L24_C0", "label": "glob import glob", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0972, 0.004, 0, 0.66, 0.8571, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "label": "DisplayParticles", "type": "class", "loc": [26, 110], "level": 0, "parent": null, "vector": [3, 0, 0.2753, 0.3441, 0, 0.66, 0.9048, 645, 0, 4, 0, 0, 0, 0, 49], "semantic": {"name": "DisplayParticles", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DisplayParticles:\n def __init__( self, pub_topic = '/particles' ):\n self.m = None\n self.pub_mark = rospy.Publisher( pub_topic, vm.Marker )\n self.mid = 0\n\n try:\n rospy.init_node('display_particles')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "label": "__init__", "type": "function", "loc": [27, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "vector": [2, 1, 0.1275, 0.0405, 1, 0.26, 0.0, 555, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "pub_topic"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, pub_topic = '/particles' ):\n self.m = None\n self.pub_mark = rospy.Publisher( pub_topic, vm.Marker )\n self.mid = 0\n\n try:\n rospy.init_node('display_particles')\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L28_C8", "label": "self.m =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "vector": [14, 2, 0.1134, 0.004, 2, 0.95, 0.0, 561, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.m = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L29_C8", "label": "self.pub_mark = Publisher()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "vector": [14, 2, 0.1174, 0.004, 2, 0.95, 0.3333, 938, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.pub_mark", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.pub_mark = rospy.Publisher( pub_topic, vm.Marker )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L30_C8", "label": "self.mid =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "vector": [14, 2, 0.1215, 0.004, 2, 0.95, 0.6667, 732, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.mid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mid = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L32_C8", "label": "try", "type": "try", "loc": [32, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "vector": [7, 2, 0.1377, 0.0202, 2, 0.95, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node('display_particles')\n except:\n rospy.logout( 'DisplayParticles: Node already initialized' )\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L33_C12", "label": "init_node()", "type": "expression", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L32_C8", "vector": [8, 3, 0.1336, 0.004, 3, 0.33, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('display_particles')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L35_C12", "label": "logout()", "type": "expression", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L32_C8", "vector": [8, 3, 0.1417, 0.004, 3, 0.33, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'DisplayParticles: Node already initialized' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "label": "create_mark", "type": "function", "loc": [38, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "vector": [2, 1, 0.1802, 0.0567, 1, 0.26, 0.3333, 830, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "create_mark", "arg_names": ["self", "p", "c", "mid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_mark( self, p, c = [1.0, 0.0, 0.0, 0.8], mid = None ):\n if mid == None:\n self.mid += 1\n mid = self.mid\n \n m = vsm( np.matrix([ p[0], p[1], 0.0 ]).T,\n np.matrix([ 0.0, 0.0, 0.0, 1.0 ]).T,\n 'sphere', '/map',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L39_C8", "label": "if", "type": "if", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "vector": [4, 2, 0.1619, 0.0121, 2, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mid == None:\n self.mid += 1\n mid = self.mid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L41_C12", "label": "mid =", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L39_C8", "vector": [14, 3, 0.166, 0.004, 3, 0.18, 0.0, 254, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mid = self.mid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L43_C8", "label": "m = vsm()", "type": "assigned_variable", "loc": [43, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "vector": [14, 2, 0.1862, 0.0283, 2, 0.8, 0.3333, 711, 3, 8, 0, 0, 910, 10, 3], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "vsm", "annotation": ""}, "snippet": " m = vsm( np.matrix([ p[0], p[1], 0.0 ]).T,\n np.matrix([ 0.0, 0.0, 0.0, 1.0 ]).T,\n 'sphere', '/map',\n scale = [0.025, 0.025, 0.025],\n color = [1.0, 0.0, 0.0, 0.3], # rgba,\n duration = 10.0,\n m_id = mid )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L50_C8", "label": "m.header.stamp = now()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "vector": [14, 2, 0.2024, 0.004, 2, 0.8, 0.6667, 726, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "m.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " m.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L51_C8", "label": "return", "type": "return", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "vector": [13, 2, 0.2065, 0.004, 2, 0.8, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "label": "update", "type": "function", "loc": [54, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "vector": [2, 1, 0.2652, 0.0972, 1, 0.26, 0.6667, 637, 0, 2, 0, 0, 0, 0, 17], "semantic": {"name": "update", "arg_names": ["self", "particles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update( self, particles ):\n xyz = np.column_stack([ particles[:,0:2], np.zeros( particles.shape[0] )]).T\n w = particles[:,2] # becomes 1D\n # print w\n wmin = np.min( w )\n wmax = np.max( w )\n # import pdb\n # pdb.set_trace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L55_C8", "label": "xyz =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [14, 2, 0.2227, 0.004, 2, 0.96, 0.0, 164, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "xyz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xyz = np.column_stack([ particles[:,0:2], np.zeros( particles.shape[0] )]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L56_C8", "label": "w =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [14, 2, 0.2267, 0.004, 2, 0.96, 0.125, 549, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = particles[:,2] # becomes 1D"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L58_C8", "label": "wmin = min()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [14, 2, 0.2348, 0.004, 2, 0.96, 0.25, 863, 3, 1, 0, 0, 867, 10, 1], "semantic": {"name": "wmin", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " wmin = np.min( w )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L59_C8", "label": "wmax = max()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [14, 2, 0.2389, 0.004, 2, 0.96, 0.375, 995, 3, 1, 0, 0, 442, 10, 1], "semantic": {"name": "wmax", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " wmax = np.max( w )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L63_C8", "label": "if", "type": "if", "loc": [63, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [4, 2, 0.2692, 0.0324, 2, 0.96, 0.5, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wmin == wmax:\n colors = np.row_stack([ np.ones( particles.shape[0] ),\n np.zeros( particles.shape[0] ),\n np.zeros( particles.shape[0] ),\n np.ones( particles.shape[0] ) ])\n else:\n colors = np.array([ pl.cm.jet( int( 1.0 * ( wi - wmin ) / (wmax - wmin) * 255.0 ))\n for wi in w ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L64_C12", "label": "colors = row_stack()", "type": "assigned_variable", "loc": [64, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L63_C8", "vector": [14, 3, 0.2652, 0.0162, 3, 0.53, 0.0, 656, 3, 1, 0, 0, 612, 10, 5], "semantic": {"name": "colors", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": " colors = np.row_stack([ np.ones( particles.shape[0] ),\n np.zeros( particles.shape[0] ),\n np.zeros( particles.shape[0] ),\n np.ones( particles.shape[0] ) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L69_C12", "label": "colors =", "type": "assigned_variable", "loc": [69, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L63_C8", "vector": [14, 3, 0.2814, 0.0081, 3, 0.53, 1.0, 656, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "colors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colors = np.array([ pl.cm.jet( int( 1.0 * ( wi - wmin ) / (wmax - wmin) * 255.0 ))\n for wi in w ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L71_C8", "label": "m = list_marker()", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [14, 2, 0.2874, 0.004, 2, 0.96, 0.625, 711, 3, 6, 0, 0, 370, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "list_marker", "annotation": ""}, "snippet": " m = viz.list_marker( xyz, colors, [0.025, 0.025, 0.025], 'points', '/map', 300 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L72_C8", "label": "m.header.stamp = now()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [14, 2, 0.2915, 0.004, 2, 0.96, 0.75, 726, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "m.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " m.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L73_C8", "label": "for i", "type": "for", "loc": [73, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [6, 2, 0.2996, 0.0121, 2, 0.96, 0.875, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange( 10 ):\n self.pub_mark.publish( m )\n rospy.sleep( 0.2 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L74_C12", "label": "publish()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L73_C8", "vector": [8, 3, 0.2996, 0.004, 3, 0.1, 0.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub_mark.publish( m )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L75_C12", "label": "sleep()", "type": "expression", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L73_C8", "vector": [8, 3, 0.3036, 0.004, 3, 0.1, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.2 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L77_C8", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "vector": [13, 2, 0.3117, 0.004, 2, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "label": "update2", "type": "function", "loc": [80, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "vector": [2, 1, 0.3846, 0.1255, 1, 0.26, 1.0, 148, 0, 2, 0, 0, 0, 0, 25], "semantic": {"name": "update2", "arg_names": ["self", "particles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update2( self, particles ):\n xyz = np.column_stack([ particles[:,0:2], np.zeros( particles.shape[0] )]).T\n w = particles[:,2] # becomes 1D\n # print w\n wmin = np.min( w )\n wmax = np.max( w )\n # import pdb\n # pdb.set_trace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L81_C8", "label": "xyz =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [14, 2, 0.3279, 0.004, 2, 0.22, 0.0, 164, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "xyz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xyz = np.column_stack([ particles[:,0:2], np.zeros( particles.shape[0] )]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L82_C8", "label": "w =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [14, 2, 0.332, 0.004, 2, 0.22, 0.0909, 549, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = particles[:,2] # becomes 1D"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L84_C8", "label": "wmin = min()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [14, 2, 0.3401, 0.004, 2, 0.22, 0.1818, 863, 3, 1, 0, 0, 867, 10, 1], "semantic": {"name": "wmin", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " wmin = np.min( w )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L85_C8", "label": "wmax = max()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [14, 2, 0.3441, 0.004, 2, 0.22, 0.2727, 995, 3, 1, 0, 0, 442, 10, 1], "semantic": {"name": "wmax", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " wmax = np.max( w )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "label": "if", "type": "if", "loc": [89, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [4, 2, 0.3765, 0.0364, 2, 0.22, 0.3636, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wmin == wmax:\n colors = np.row_stack([ np.ones( particles.shape[0] ),\n np.zeros( particles.shape[0] ),\n np.zeros( particles.shape[0] ),\n np.ones( particles.shape[0] ) ])\n iv = np.ones( len( w )).tolist()\n else:\n iv = [ int( 1.0 * ( wi - wmin ) / (wmax - wmin) * 255.0 ) for wi in w ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L90_C12", "label": "colors = row_stack()", "type": "assigned_variable", "loc": [90, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "vector": [14, 3, 0.3704, 0.0162, 3, 0.23, 0.0, 656, 3, 1, 0, 0, 612, 10, 5], "semantic": {"name": "colors", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": " colors = np.row_stack([ np.ones( particles.shape[0] ),\n np.zeros( particles.shape[0] ),\n np.zeros( particles.shape[0] ),\n np.ones( particles.shape[0] ) ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L94_C12", "label": "iv = tolist()", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "vector": [14, 3, 0.3806, 0.004, 3, 0.23, 0.3333, 184, 3, 0, 0, 0, 185, 10, 3], "semantic": {"name": "iv", "arg_names": [], "import_names": [], "rhs_call_name": "tolist", "annotation": ""}, "snippet": " iv = np.ones( len( w )).tolist()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L96_C12", "label": "iv =", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "vector": [14, 3, 0.3887, 0.004, 3, 0.23, 0.6667, 184, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "iv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iv = [ int( 1.0 * ( wi - wmin ) / (wmax - wmin) * 255.0 ) for wi in w ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L97_C12", "label": "colors =", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "vector": [14, 3, 0.3927, 0.004, 3, 0.23, 1.0, 656, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "colors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colors = np.array([ pl.cm.jet( ivi ) for ivi in iv ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L100_C8", "label": "print()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [8, 2, 0.4049, 0.004, 2, 0.22, 0.4545, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(np.array(iv))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L101_C8", "label": "ind =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [14, 2, 0.4089, 0.004, 2, 0.22, 0.5455, 680, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind = np.where( np.array(iv) > 5 )[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L102_C8", "label": "aind = argsort()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [14, 2, 0.413, 0.004, 2, 0.22, 0.6364, 582, 3, 1, 0, 0, 237, 10, 1], "semantic": {"name": "aind", "arg_names": [], "import_names": [], "rhs_call_name": "argsort", "annotation": ""}, "snippet": " aind = np.argsort( w[ind] ) # sort them so that some come to top."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L104_C8", "label": "m = list_marker()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [14, 2, 0.4211, 0.004, 2, 0.22, 0.7273, 711, 3, 6, 0, 0, 370, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "list_marker", "annotation": ""}, "snippet": " m = viz.list_marker( xyz[:,ind][:,aind], colors[:,ind][:,aind], [0.05, 0.05, 0.025], 'points', '/map', 30 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L105_C8", "label": "m.header.stamp = now()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [14, 2, 0.4251, 0.004, 2, 0.22, 0.8182, 726, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "m.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " m.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L106_C8", "label": "for i", "type": "for", "loc": [106, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [6, 2, 0.4332, 0.0121, 2, 0.22, 0.9091, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange( 10 ):\n self.pub_mark.publish( m )\n rospy.sleep( 0.2 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L107_C12", "label": "publish()", "type": "expression", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L106_C8", "vector": [8, 3, 0.4332, 0.004, 3, 0.61, 0.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub_mark.publish( m )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L108_C12", "label": "sleep()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L106_C8", "vector": [8, 3, 0.4372, 0.004, 3, 0.61, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.2 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "vector": [13, 2, 0.4453, 0.004, 2, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "label": "display_trialobj", "type": "function", "loc": [116, 217], "level": 0, "parent": null, "vector": [2, 0, 0.6741, 0.413, 0, 0.66, 0.9524, 4, 0, 4, 0, 0, 0, 0, 40], "semantic": {"name": "display_trialobj", "arg_names": ["trial_num", "obj_num", "servo_yn", "screen_cap"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def display_trialobj( trial_num, obj_num, servo_yn, screen_cap = False ):\n try:\n rospy.init_node( 'ros_pf' )\n except:\n print('display_trialobj: node already initialized')\n pass\n \n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L117_C4", "label": "try", "type": "try", "loc": [117, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [7, 1, 0.4818, 0.0202, 1, 0.59, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node( 'ros_pf' )\n except:\n print('display_trialobj: node already initialized')\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L118_C8", "label": "init_node()", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L117_C4", "vector": [8, 2, 0.4777, 0.004, 2, 0.15, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'ros_pf' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L120_C8", "label": "print()", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L117_C4", "vector": [8, 2, 0.4858, 0.004, 2, 0.15, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('display_trialobj: node already initialized')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L124_C4", "label": "tdb =", "type": "assigned_variable", "loc": [124, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.5182, 0.0364, 1, 0.59, 0.037, 84, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "tdb", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tdb = { 0: ['OrangeMedBot',[]],\n 1: ['TravisTVremo',[]],\n 2: ['RedBottle ',[]],\n 3: ['OnMetalKeys ',[]],\n 4: ['WhiteMedsBot',[]],\n 5: ['BlueMedsBox ',[]],\n 6: ['TeddyBearToy',[]],\n 7: ['CordlessPhon',[]],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L134_C4", "label": "pts =", "type": "assigned_variable", "loc": [134, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.5587, 0.0364, 1, 0.59, 0.0741, 195, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts = { 0: ['BehindTree',[3.757, 6.017, 0.036]],\n 1: ['FireplaceMantle',[5.090, 4.238, 1.514]],\n 2: ['CircleEndTable',[5.399, 2.857, 0.607]],\n 3: ['Couch',[3.944, 1.425, 0.527]],\n 4: ['RectEndTable',[3.302, 0.932, 0.534]],\n 5: ['BehindKitchenTable',[-0.339, -2.393, 0.793]],\n 6: ['NearDishwaser',[-1.926, -0.835, 0.946]],\n 7: ['InCupboard',[-3.257, 1.294, 1.397]],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L145_C4", "label": "obj_name =", "type": "assigned_variable", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.587, 0.004, 1, 0.59, 0.1111, 412, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_name = tdb[obj_num][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L146_C4", "label": "tname = replace()", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.5911, 0.004, 1, 0.59, 0.1481, 985, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "tname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tname = obj_name.replace( ' ', '' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L148_C4", "label": "loc =", "type": "assigned_variable", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.5992, 0.004, 1, 0.59, 0.1852, 822, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc = (trial_num + obj_num) % 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L149_C4", "label": "loc_name =", "type": "assigned_variable", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.6032, 0.004, 1, 0.59, 0.2222, 380, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "loc_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc_name = pts[loc][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L150_C4", "label": "loc_pos = array()", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.6073, 0.004, 1, 0.59, 0.2593, 668, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "loc_pos", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " loc_pos = np.array(pts[loc][1]) # Tag ground-truth location"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L153_C4", "label": "fname_prefix =", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.6194, 0.004, 1, 0.59, 0.2963, 929, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fname_prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fname_prefix = '/home/travis/svn/robot1/src/projects/rfid_datacapture/src/rfid_datacapture/search_cap/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L155_C4", "label": "servo_fname =", "type": "assigned_variable", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.6275, 0.004, 1, 0.59, 0.3333, 192, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "servo_fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_fname = fname_prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L159_C4", "label": "pf_search = replace()", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.6437, 0.004, 1, 0.59, 0.3704, 743, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "pf_search", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " pf_search = servo_fname.replace('_servo.pkl', '_pf_search.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L160_C4", "label": "pf_servo = replace()", "type": "assigned_variable", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.6478, 0.004, 1, 0.59, 0.4074, 88, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "pf_servo", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " pf_servo = servo_fname.replace('_servo.pkl', '_pf_servo.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L162_C4", "label": "glob_r = glob()", "type": "assigned_variable", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.6559, 0.004, 1, 0.59, 0.4444, 550, 3, 1, 0, 0, 958, 10, 1], "semantic": {"name": "glob_r", "arg_names": [], "import_names": [], "rhs_call_name": "glob", "annotation": ""}, "snippet": " glob_r = glob.glob( servo_fname )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L163_C4", "label": "if", "type": "if", "loc": [163, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [4, 1, 0.664, 0.0121, 1, 0.59, 0.4815, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if glob_r == []:\n print('\\t No results for this instance.\\n\\n')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L164_C8", "label": "print()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L163_C4", "vector": [8, 2, 0.664, 0.004, 2, 0.71, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\t No results for this instance.\\n\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L165_C8", "label": "return", "type": "return", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L163_C4", "vector": [13, 2, 0.668, 0.004, 2, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L166_C4", "label": "if", "type": "if", "loc": [166, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [4, 1, 0.6761, 0.0121, 1, 0.59, 0.5185, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(glob_r) > 1:\n print('\\t Multiple results...?! Weirdness. Skipping.')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L167_C8", "label": "print()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L166_C4", "vector": [8, 2, 0.6761, 0.004, 2, 0.19, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\t Multiple results...?! Weirdness. Skipping.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L168_C8", "label": "return", "type": "return", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L166_C4", "vector": [13, 2, 0.6802, 0.004, 2, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "label": "if", "type": "if", "loc": [170, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [4, 1, 0.7024, 0.0324, 1, 0.59, 0.5556, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if servo_yn:\n f = open( pf_servo, 'r' )\n p_set = pkl.load( f )\n f.close()\n else:\n f = open( pf_search, 'r' )\n p_set = pkl.load( f )\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L171_C8", "label": "f = open()", "type": "assigned_variable", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "vector": [14, 2, 0.6923, 0.004, 2, 0.44, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( pf_servo, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L172_C8", "label": "p_set = load()", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "vector": [14, 2, 0.6964, 0.004, 2, 0.44, 0.2, 28, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "p_set", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " p_set = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L173_C8", "label": "close()", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "vector": [8, 2, 0.7004, 0.004, 2, 0.44, 0.4, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L175_C8", "label": "f = open()", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "vector": [14, 2, 0.7085, 0.004, 2, 0.44, 0.6, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open( pf_search, 'r' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L176_C8", "label": "p_set = load()", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "vector": [14, 2, 0.7126, 0.004, 2, 0.44, 0.8, 28, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "p_set", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " p_set = pkl.load( f )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L177_C8", "label": "close()", "type": "expression", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "vector": [8, 2, 0.7166, 0.004, 2, 0.44, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L179_C4", "label": "dp = DisplayParticles()", "type": "assigned_variable", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.7247, 0.004, 1, 0.59, 0.5926, 595, 3, 0, 0, 0, 645, 10, 1], "semantic": {"name": "dp", "arg_names": [], "import_names": [], "rhs_call_name": "DisplayParticles", "annotation": ""}, "snippet": " dp = DisplayParticles()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L181_C4", "label": "pub_mark = Publisher()", "type": "assigned_variable", "loc": [181, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.7328, 0.004, 1, 0.59, 0.6296, 577, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "pub_mark", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " pub_mark = rospy.Publisher( '/tag_poses', vm.Marker )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L183_C4", "label": "tm = vsm()", "type": "assigned_variable", "loc": [183, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [14, 1, 0.7551, 0.0324, 1, 0.59, 0.6667, 404, 3, 7, 0, 0, 910, 10, 3], "semantic": {"name": "tm", "arg_names": [], "import_names": [], "rhs_call_name": "vsm", "annotation": ""}, "snippet": " tm = vsm( np.matrix([ pts[loc][1][0],\n pts[loc][1][1],\n pts[loc][1][2] ]).T,\n np.matrix([ [0.0], [0.0], [0.0], [1.0] ]),\n 'sphere', '/map',\n color = [0.0, 1.0, 0.0, 1.0], # rgba\n duration = 150.0,\n m_id = 2*p_set.shape[0] + 1 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L192_C4", "label": "pub_tm", "type": "function", "loc": [192, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [2, 1, 0.7854, 0.0202, 1, 0.59, 0.7037, 74, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "pub_tm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pub_tm():\n tm.header.stamp = rospy.Time.now()\n for i in xrange( 10 ):\n pub_mark.publish( tm )\n rospy.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L193_C8", "label": "tm.header.stamp = now()", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L192_C4", "vector": [14, 2, 0.7814, 0.004, 2, 0.37, 0.0, 858, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "tm.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " tm.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L194_C8", "label": "for i", "type": "for", "loc": [194, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L192_C4", "vector": [6, 2, 0.7895, 0.0121, 2, 0.37, 1.0, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange( 10 ):\n pub_mark.publish( tm )\n rospy.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L195_C12", "label": "publish()", "type": "expression", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L194_C8", "vector": [8, 3, 0.7895, 0.004, 3, 0.99, 0.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " pub_mark.publish( tm )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L196_C12", "label": "sleep()", "type": "expression", "loc": [196, 196], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L194_C8", "vector": [8, 3, 0.7935, 0.004, 3, 0.99, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "label": "update_display", "type": "function", "loc": [198, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [2, 1, 0.8138, 0.0283, 1, 0.59, 0.7407, 658, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "update_display", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_display():\n print('UPDATING DISPLAY... ')\n pub_tm()\n pub_tm()\n dp.update2( p_set )\n rospy.sleep( 0.3 )\n print('DONE.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L199_C8", "label": "print()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "vector": [8, 2, 0.8057, 0.004, 2, 0.34, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('UPDATING DISPLAY... ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L200_C8", "label": "pub_tm()", "type": "expression", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "vector": [8, 2, 0.8097, 0.004, 2, 0.34, 0.2, 74, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pub_tm", "arg_names": [], "import_names": [], "rhs_call_name": "pub_tm", "annotation": ""}, "snippet": " pub_tm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L201_C8", "label": "pub_tm()", "type": "expression", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "vector": [8, 2, 0.8138, 0.004, 2, 0.34, 0.4, 74, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pub_tm", "arg_names": [], "import_names": [], "rhs_call_name": "pub_tm", "annotation": ""}, "snippet": " pub_tm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L202_C8", "label": "update2()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "vector": [8, 2, 0.8178, 0.004, 2, 0.34, 0.6, 148, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update2", "arg_names": [], "import_names": [], "rhs_call_name": "update2", "annotation": ""}, "snippet": " dp.update2( p_set )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L203_C8", "label": "sleep()", "type": "expression", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "vector": [8, 2, 0.8219, 0.004, 2, 0.34, 0.8, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 0.3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L204_C8", "label": "print()", "type": "expression", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "vector": [8, 2, 0.8259, 0.004, 2, 0.34, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('DONE.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L207_C4", "label": "print()", "type": "expression", "loc": [207, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [8, 1, 0.8381, 0.004, 1, 0.59, 0.7778, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('UPDATING')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L208_C4", "label": "update_display()", "type": "expression", "loc": [208, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [8, 1, 0.8421, 0.004, 1, 0.59, 0.8148, 658, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_display", "arg_names": [], "import_names": [], "rhs_call_name": "update_display", "annotation": ""}, "snippet": " update_display()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L209_C4", "label": "sleep()", "type": "expression", "loc": [209, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [8, 1, 0.8462, 0.004, 1, 0.59, 0.8519, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 1.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L211_C4", "label": "if", "type": "if", "loc": [211, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [4, 1, 0.8563, 0.0081, 1, 0.59, 0.8889, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if screen_cap:\n os.system( 'scrot -d 2 -u Obj%d_Trial%d_Servo%d_pf_results.png' % ( obj_num, trial_num, int(servo_yn) ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L212_C8", "label": "system()", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L211_C4", "vector": [8, 2, 0.8583, 0.004, 2, 0.2, 0.0, 856, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system( 'scrot -d 2 -u Obj%d_Trial%d_Servo%d_pf_results.png' % ( obj_num, trial_num, int(servo_yn) ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L214_C4", "label": "sleep()", "type": "expression", "loc": [214, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [8, 1, 0.8664, 0.004, 1, 0.59, 0.9259, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep( 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L215_C4", "label": "print()", "type": "expression", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [8, 1, 0.8704, 0.004, 1, 0.59, 0.963, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('DERP')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L217_C4", "label": "return", "type": "return", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "vector": [13, 1, 0.8785, 0.004, 1, 0.59, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "label": "if", "type": "if", "loc": [220, 247], "level": 0, "parent": null, "vector": [4, 0, 0.9453, 0.1134, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n p = optparse.OptionParser()\n p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')\n p.add_option('--obj', action='store', type='int', dest='obj',\n help='object number (0-8)')\n p.add_option('--servo', action='store_true', dest='servo',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L221_C4", "label": "optparse import optparse", "type": "import", "loc": [221, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [1, 1, 0.8947, 0.004, 1, 0.97, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L222_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [14, 1, 0.8988, 0.004, 1, 0.97, 0.1111, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L223_C4", "label": "add_option()", "type": "expression", "loc": [223, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [8, 1, 0.9049, 0.0081, 1, 0.97, 0.2222, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--trial', action='store', type='int', dest='trial',\n help='trial number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L225_C4", "label": "add_option()", "type": "expression", "loc": [225, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [8, 1, 0.913, 0.0081, 1, 0.97, 0.3333, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--obj', action='store', type='int', dest='obj',\n help='object number (0-8)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L227_C4", "label": "add_option()", "type": "expression", "loc": [227, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [8, 1, 0.9211, 0.0081, 1, 0.97, 0.4444, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('--servo', action='store_true', dest='servo',\n help='Use combined search and servo?', default = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L229_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [14, 1, 0.9271, 0.004, 1, 0.97, 0.5556, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L231_C4", "label": "obj_num =", "type": "assigned_variable", "loc": [231, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [14, 1, 0.9352, 0.004, 1, 0.97, 0.6667, 584, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj_num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj_num = opt.obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L232_C4", "label": "trial_num =", "type": "assigned_variable", "loc": [232, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [14, 1, 0.9393, 0.004, 1, 0.97, 0.7778, 298, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "trial_num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " trial_num = opt.trial"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L233_C4", "label": "servo_yn =", "type": "assigned_variable", "loc": [233, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [14, 1, 0.9433, 0.004, 1, 0.97, 0.8889, 267, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "servo_yn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " servo_yn = opt.servo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "label": "if", "type": "if", "loc": [235, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "vector": [4, 1, 0.9757, 0.0526, 1, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if trial_num < 9:\n while not rospy.is_shutdown():\n display_trialobj( trial_num, obj_num, servo_yn )\n else:\n print('Click on RVIZ!')\n time.sleep( 3 )\n\n for trial_num in range( 0, 9 ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:While_L236_C8", "label": "while", "type": "while", "loc": [236, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "vector": [5, 2, 0.9575, 0.0081, 2, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not rospy.is_shutdown():\n display_trialobj( trial_num, obj_num, servo_yn )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L237_C12", "label": "display_trialobj()", "type": "expression", "loc": [237, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:While_L236_C8", "vector": [8, 3, 0.9595, 0.004, 3, 0.78, 0.0, 4, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "display_trialobj", "arg_names": [], "import_names": [], "rhs_call_name": "display_trialobj", "annotation": ""}, "snippet": " display_trialobj( trial_num, obj_num, servo_yn )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L239_C8", "label": "print()", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "vector": [8, 2, 0.9676, 0.004, 2, 0.69, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Click on RVIZ!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L240_C8", "label": "sleep()", "type": "expression", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "vector": [8, 2, 0.9717, 0.004, 2, 0.69, 0.6667, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep( 3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L242_C8", "label": "for trial_num", "type": "for", "loc": [242, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "vector": [6, 2, 0.9899, 0.0243, 2, 0.69, 1.0, 298, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "trial_num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for trial_num in range( 0, 9 ):\n for obj_num in range( 0, 9 ):\n for servo_yn in [False, True]:\n print('Calling display trialobj: ', trial_num, obj_num, servo_yn)\n display_trialobj( trial_num, obj_num, servo_yn, screen_cap = True )\n print('Done.\\n\\n\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L243_C12", "label": "for obj_num", "type": "for", "loc": [243, 247], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L242_C8", "vector": [6, 3, 0.9919, 0.0202, 3, 0.1, 0.0, 584, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "obj_num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj_num in range( 0, 9 ):\n for servo_yn in [False, True]:\n print('Calling display trialobj: ', trial_num, obj_num, servo_yn)\n display_trialobj( trial_num, obj_num, servo_yn, screen_cap = True )\n print('Done.\\n\\n\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L244_C16", "label": "for servo_yn", "type": "for", "loc": [244, 247], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L243_C12", "vector": [6, 4, 0.9939, 0.0162, 4, 0.81, 0.0, 267, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "servo_yn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for servo_yn in [False, True]:\n print('Calling display trialobj: ', trial_num, obj_num, servo_yn)\n display_trialobj( trial_num, obj_num, servo_yn, screen_cap = True )\n print('Done.\\n\\n\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L245_C20", "label": "print()", "type": "expression", "loc": [245, 245], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L244_C16", "vector": [8, 5, 0.9919, 0.004, 5, 0.52, 0.0, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Calling display trialobj: ', trial_num, obj_num, servo_yn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L246_C20", "label": "display_trialobj()", "type": "expression", "loc": [246, 246], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L244_C16", "vector": [8, 5, 0.996, 0.004, 5, 0.52, 0.5, 4, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "display_trialobj", "arg_names": [], "import_names": [], "rhs_call_name": "display_trialobj", "annotation": ""}, "snippet": " display_trialobj( trial_num, obj_num, servo_yn, screen_cap = True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L247_C20", "label": "print()", "type": "expression", "loc": [247, 247], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L244_C16", "vector": [8, 5, 1.0, 0.004, 5, 0.52, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Done.\\n\\n\\n')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:Try_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Return_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Import_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Assign_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:While_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:While_L236_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:If_L235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L242_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L243_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L244_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L244_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L245_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L244_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L246_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99448:For_L244_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99448:Expr_L247_C20"}] |
#!/usr/bin/python
import roslib
roslib.load_manifest('rfid_hardware')
import rospy
from std_msgs.msg import Float64
import tf
import time
import numpy as np, math
import functools
class tf_updater():
def __init__(self, name,
right_pan = '/robotis/servo_right_pan',
right_tilt = '/robotis/servo_right_tilt',
left_pan = '/robotis/servo_left_pan',
left_tilt = '/robotis/servo_left_tilt'):
try:
rospy.init_node( name )
except:
pass
# Right pan
rospy.Subscriber( right_pan, Float64,
functools.partial( self.rpan_cb, bc = tf.TransformBroadcaster() ))
# Right tilt
rospy.Subscriber( right_tilt, Float64,
functools.partial( self.rtilt_cb, bc = tf.TransformBroadcaster() ))
# Left pan
rospy.Subscriber( left_pan, Float64,
functools.partial( self.lpan_cb, bc = tf.TransformBroadcaster() ))
# Left tilt
rospy.Subscriber( left_tilt, Float64,
functools.partial( self.ltilt_cb, bc = tf.TransformBroadcaster() ))
def rpan_cb( self, ang_msg, bc ):
# bc is a specific TransformBroadcaster
bc.sendTransform( (-0.0655, -0.0510, 0.0675),
tf.transformations.quaternion_from_euler( 0.0, 0.0, -1.0 * ang_msg.data - math.radians( 60.0 ) ),
rospy.Time.now(),
'ear_pan_right',
'plate_right_base' )
def rtilt_cb( self, ang_msg, bc ):
# bc is a specific TransformBroadcaster
bc.sendTransform( (0.0673, 0.0, 0.0),
tf.transformations.quaternion_from_euler( 0.0, ang_msg.data, 0.0 ),
rospy.Time.now(),
'ear_tilt_right',
'ear_pan_right' )
def lpan_cb( self, ang_msg, bc ):
# bc is a specific TransformBroadcaster
bc.sendTransform( (-0.0655, +0.0510, 0.0675),
tf.transformations.quaternion_from_euler( 0.0, 0.0, -1.0 * ang_msg.data + math.radians( 60.0 )),
rospy.Time.now(),
'ear_pan_left',
'plate_left_base' )
def ltilt_cb( self, ang_msg, bc ):
# bc is a specific TransformBroadcaster
bc.sendTransform( (0.0673, 0.0, 0.0),
tf.transformations.quaternion_from_euler( 0.0, -1.0 * ang_msg.data, 0.0 ),
rospy.Time.now(),
'ear_tilt_left',
'ear_pan_left' )
if __name__ == '__main__':
tfs = tf_updater('servo_tf_updater')
rospy.spin()
| ajibawa-2023/Python-Code-Large/train/row_99449 | 27 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0366, 0.0122, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0488, 0.0122, 0, 0.66, 0.1111, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('rfid_hardware')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Import_L5_C0", "label": "rospy import rospy", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.061, 0.0122, 0, 0.66, 0.2222, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:ImportFrom_L7_C0", "label": "from std_msgs.msg import Float64", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0854, 0.0122, 0, 0.66, 0.3333, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Float64"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Float64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Import_L8_C0", "label": "tf import tf", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0976, 0.0122, 0, 0.66, 0.4444, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Import_L10_C0", "label": "time import time", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.122, 0.0122, 0, 0.66, 0.5556, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Import_L11_C0", "label": "numpy import np, math", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1341, 0.0122, 0, 0.66, 0.6667, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Import_L12_C0", "label": "functools import functools", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1463, 0.0122, 0, 0.66, 0.7778, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": ["functools"], "rhs_call_name": "", "annotation": ""}, "snippet": "import functools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "label": "tf_updater", "type": "class", "loc": [14, 74], "level": 0, "parent": null, "vector": [3, 0, 0.5366, 0.7439, 0, 0.66, 0.8889, 21, 0, 5, 0, 0, 0, 0, 27], "semantic": {"name": "tf_updater", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class tf_updater():\n def __init__(self, name, \n right_pan = '/robotis/servo_right_pan',\n right_tilt = '/robotis/servo_right_tilt',\n left_pan = '/robotis/servo_left_pan',\n left_tilt = '/robotis/servo_left_tilt'):\n try:\n rospy.init_node( name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "label": "__init__", "type": "function", "loc": [15, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "vector": [2, 1, 0.3293, 0.3049, 1, 0.41, 0.0, 555, 0, 6, 0, 0, 0, 0, 13], "semantic": {"name": "__init__", "arg_names": ["self", "name", "right_pan", "right_tilt", "left_pan", "left_tilt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, \n right_pan = '/robotis/servo_right_pan',\n right_tilt = '/robotis/servo_right_tilt',\n left_pan = '/robotis/servo_left_pan',\n left_tilt = '/robotis/servo_left_tilt'):\n try:\n rospy.init_node( name )\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Try_L20_C8", "label": "try", "type": "try", "loc": [20, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "vector": [7, 2, 0.2622, 0.0488, 2, 0.69, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node( name )\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L21_C12", "label": "init_node()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:Try_L20_C8", "vector": [8, 3, 0.2561, 0.0122, 3, 0.9, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L26_C8", "label": "Subscriber()", "type": "expression", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "vector": [8, 2, 0.3232, 0.0244, 2, 0.69, 0.25, 455, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber( right_pan, Float64, \n functools.partial( self.rpan_cb, bc = tf.TransformBroadcaster() ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L30_C8", "label": "Subscriber()", "type": "expression", "loc": [30, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "vector": [8, 2, 0.372, 0.0244, 2, 0.69, 0.5, 455, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber( right_tilt, Float64, \n functools.partial( self.rtilt_cb, bc = tf.TransformBroadcaster() ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L34_C8", "label": "Subscriber()", "type": "expression", "loc": [34, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "vector": [8, 2, 0.4207, 0.0244, 2, 0.69, 0.75, 455, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber( left_pan, Float64, \n functools.partial( self.lpan_cb, bc = tf.TransformBroadcaster() ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L38_C8", "label": "Subscriber()", "type": "expression", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "vector": [8, 2, 0.4695, 0.0244, 2, 0.69, 1.0, 455, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber( left_tilt, Float64, \n functools.partial( self.ltilt_cb, bc = tf.TransformBroadcaster() ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L44_C4", "label": "rpan_cb", "type": "function", "loc": [44, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "vector": [2, 1, 0.5732, 0.0854, 1, 0.41, 0.25, 133, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "rpan_cb", "arg_names": ["self", "ang_msg", "bc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rpan_cb( self, ang_msg, bc ):\n # bc is a specific TransformBroadcaster\n bc.sendTransform( (-0.0655, -0.0510, 0.0675),\n tf.transformations.quaternion_from_euler( 0.0, 0.0, -1.0 * ang_msg.data - math.radians( 60.0 ) ),\n rospy.Time.now(),\n 'ear_pan_right',\n 'plate_right_base' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L46_C8", "label": "sendTransform()", "type": "expression", "loc": [46, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L44_C4", "vector": [8, 2, 0.5854, 0.061, 2, 0.49, 0.0, 373, 3, 5, 0, 0, 0, 0, 4], "semantic": {"name": "sendTransform", "arg_names": [], "import_names": [], "rhs_call_name": "sendTransform", "annotation": ""}, "snippet": " bc.sendTransform( (-0.0655, -0.0510, 0.0675),\n tf.transformations.quaternion_from_euler( 0.0, 0.0, -1.0 * ang_msg.data - math.radians( 60.0 ) ),\n rospy.Time.now(),\n 'ear_pan_right',\n 'plate_right_base' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L52_C4", "label": "rtilt_cb", "type": "function", "loc": [52, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "vector": [2, 1, 0.6707, 0.0854, 1, 0.41, 0.5, 638, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "rtilt_cb", "arg_names": ["self", "ang_msg", "bc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rtilt_cb( self, ang_msg, bc ):\n # bc is a specific TransformBroadcaster\n bc.sendTransform( (0.0673, 0.0, 0.0),\n tf.transformations.quaternion_from_euler( 0.0, ang_msg.data, 0.0 ),\n rospy.Time.now(),\n 'ear_tilt_right',\n 'ear_pan_right' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L54_C8", "label": "sendTransform()", "type": "expression", "loc": [54, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L52_C4", "vector": [8, 2, 0.6829, 0.061, 2, 0.66, 0.0, 373, 3, 5, 0, 0, 0, 0, 3], "semantic": {"name": "sendTransform", "arg_names": [], "import_names": [], "rhs_call_name": "sendTransform", "annotation": ""}, "snippet": " bc.sendTransform( (0.0673, 0.0, 0.0),\n tf.transformations.quaternion_from_euler( 0.0, ang_msg.data, 0.0 ),\n rospy.Time.now(),\n 'ear_tilt_right',\n 'ear_pan_right' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L60_C4", "label": "lpan_cb", "type": "function", "loc": [60, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "vector": [2, 1, 0.7683, 0.0854, 1, 0.41, 0.75, 833, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "lpan_cb", "arg_names": ["self", "ang_msg", "bc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lpan_cb( self, ang_msg, bc ):\n # bc is a specific TransformBroadcaster\n bc.sendTransform( (-0.0655, +0.0510, 0.0675),\n tf.transformations.quaternion_from_euler( 0.0, 0.0, -1.0 * ang_msg.data + math.radians( 60.0 )),\n rospy.Time.now(),\n 'ear_pan_left',\n 'plate_left_base' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L62_C8", "label": "sendTransform()", "type": "expression", "loc": [62, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L60_C4", "vector": [8, 2, 0.7805, 0.061, 2, 0.83, 0.0, 373, 3, 5, 0, 0, 0, 0, 4], "semantic": {"name": "sendTransform", "arg_names": [], "import_names": [], "rhs_call_name": "sendTransform", "annotation": ""}, "snippet": " bc.sendTransform( (-0.0655, +0.0510, 0.0675),\n tf.transformations.quaternion_from_euler( 0.0, 0.0, -1.0 * ang_msg.data + math.radians( 60.0 )),\n rospy.Time.now(),\n 'ear_pan_left',\n 'plate_left_base' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L68_C4", "label": "ltilt_cb", "type": "function", "loc": [68, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "vector": [2, 1, 0.8659, 0.0854, 1, 0.41, 1.0, 287, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "ltilt_cb", "arg_names": ["self", "ang_msg", "bc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ltilt_cb( self, ang_msg, bc ):\n # bc is a specific TransformBroadcaster\n bc.sendTransform( (0.0673, 0.0, 0.0),\n tf.transformations.quaternion_from_euler( 0.0, -1.0 * ang_msg.data, 0.0 ),\n rospy.Time.now(),\n 'ear_tilt_left',\n 'ear_pan_left' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L70_C8", "label": "sendTransform()", "type": "expression", "loc": [70, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L68_C4", "vector": [8, 2, 0.878, 0.061, 2, 0.53, 0.0, 373, 3, 5, 0, 0, 0, 0, 3], "semantic": {"name": "sendTransform", "arg_names": [], "import_names": [], "rhs_call_name": "sendTransform", "annotation": ""}, "snippet": " bc.sendTransform( (0.0673, 0.0, 0.0),\n tf.transformations.quaternion_from_euler( 0.0, -1.0 * ang_msg.data, 0.0 ),\n rospy.Time.now(),\n 'ear_tilt_left',\n 'ear_pan_left' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:If_L80_C0", "label": "if", "type": "if", "loc": [80, 82], "level": 0, "parent": null, "vector": [4, 0, 0.9878, 0.0366, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n tfs = tf_updater('servo_tf_updater')\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Assign_L81_C4", "label": "tfs = tf_updater()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:If_L80_C0", "vector": [14, 1, 0.9878, 0.0122, 1, 0.06, 0.0, 586, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "tfs", "arg_names": [], "import_names": [], "rhs_call_name": "tf_updater", "annotation": ""}, "snippet": " tfs = tf_updater('servo_tf_updater')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L82_C4", "label": "spin()", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99449:If_L80_C0", "vector": [8, 1, 1.0, 0.0122, 1, 0.06, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Try_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:If_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99449:If_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99449:Expr_L82_C4"}] |
#!/usr/bin/python
import roslib
roslib.load_manifest( 'rfid_hardware' )
import rospy
import robotis.ros_robotis as rr
import time
import math
if __name__ == '__main__':
p_left = rr.ROS_Robotis_Client( 'left_pan' )
t_left = rr.ROS_Robotis_Client( 'left_tilt' )
p_left.move_angle( 1.370, math.radians(10), blocking = False )
t_left.move_angle( 0.0, math.radians(10), blocking = False )
p_right = rr.ROS_Robotis_Client( 'right_pan' )
t_right = rr.ROS_Robotis_Client( 'right_tilt' )
p_right.move_angle( -1.370, math.radians(10), blocking = False )
t_right.move_angle( 0.0, math.radians(10), blocking = False )
| ajibawa-2023/Python-Code-Large/train/row_99450 | 15 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0417, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L4_C0", "label": "load_manifest()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.0417, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'rfid_hardware' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Import_L5_C0", "label": "rospy import rospy", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2083, 0.0417, 0, 0.66, 0.3333, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Import_L6_C0", "label": "robotis.ros_robotis import rr", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.0417, 0, 0.66, 0.5, 570, 0, 1, 0, 0, 570, 0, 0], "semantic": {"name": "robotis.ros_robotis", "arg_names": [], "import_names": ["rr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import robotis.ros_robotis as rr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Import_L8_C0", "label": "time import time", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0417, 0, 0.66, 0.6667, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Import_L9_C0", "label": "math import math", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.375, 0.0417, 0, 0.66, 0.8333, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "label": "if", "type": "if", "loc": [11, 23], "level": 0, "parent": null, "vector": [4, 0, 0.7083, 0.5417, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n p_left = rr.ROS_Robotis_Client( 'left_pan' )\n t_left = rr.ROS_Robotis_Client( 'left_tilt' )\n \n p_left.move_angle( 1.370, math.radians(10), blocking = False )\n t_left.move_angle( 0.0, math.radians(10), blocking = False )\n\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Assign_L12_C4", "label": "p_left = ROS_Robotis_Client()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "vector": [14, 1, 0.5, 0.0417, 1, 0.61, 0.0, 339, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "p_left", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Client", "annotation": ""}, "snippet": " p_left = rr.ROS_Robotis_Client( 'left_pan' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Assign_L13_C4", "label": "t_left = ROS_Robotis_Client()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "vector": [14, 1, 0.5417, 0.0417, 1, 0.61, 0.1429, 276, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "t_left", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Client", "annotation": ""}, "snippet": " t_left = rr.ROS_Robotis_Client( 'left_tilt' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L15_C4", "label": "move_angle()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "vector": [8, 1, 0.625, 0.0417, 1, 0.61, 0.2857, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " p_left.move_angle( 1.370, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L16_C4", "label": "move_angle()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "vector": [8, 1, 0.6667, 0.0417, 1, 0.61, 0.4286, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " t_left.move_angle( 0.0, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Assign_L19_C4", "label": "p_right = ROS_Robotis_Client()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "vector": [14, 1, 0.7917, 0.0417, 1, 0.61, 0.5714, 866, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "p_right", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Client", "annotation": ""}, "snippet": " p_right = rr.ROS_Robotis_Client( 'right_pan' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Assign_L20_C4", "label": "t_right = ROS_Robotis_Client()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "vector": [14, 1, 0.8333, 0.0417, 1, 0.61, 0.7143, 942, 3, 1, 0, 0, 769, 10, 1], "semantic": {"name": "t_right", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Client", "annotation": ""}, "snippet": " t_right = rr.ROS_Robotis_Client( 'right_tilt' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L22_C4", "label": "move_angle()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "vector": [8, 1, 0.9167, 0.0417, 1, 0.61, 0.8571, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " p_right.move_angle( -1.370, math.radians(10), blocking = False )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L23_C4", "label": "move_angle()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "vector": [8, 1, 0.9583, 0.0417, 1, 0.61, 1.0, 293, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "move_angle", "arg_names": [], "import_names": [], "rhs_call_name": "move_angle", "annotation": ""}, "snippet": " t_right.move_angle( 0.0, math.radians(10), blocking = False )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99450:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99450:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99450:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99450:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99450:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99450:Expr_L23_C4"}] |
#!/usr/bin/python
# Merges functionality from ros_M5e in hrl_rfid package.
# if opt.device == 'ears':
# print 'Starting Ears RFID Services'
# ros_rfid = ROS_M5e( name = 'ears', readPwr = opt.power,
# portStr = '/dev/robot/RFIDreader',
# antFuncs = [EleLeftEar, EleRightEar],
# callbacks = [] )
# rospy.spin()
# ros_rfid.stop()
import roslib
roslib.load_manifest( 'rfid_hardware' )
import rospy
import time
from threading import Thread
# The Servers need to distinguish b/w real vs. simulated!
# They implement same services / functions. (Clients unaffected)
import os
if os.environ.has_key('ROBOT') and os.environ['ROBOT'] == 'sim':
roslib.load_manifest( 'rfid_people_following' ) # this code should really be moved to "RFID Sim" or some such thing, but I'm in a hurry.
import rfid_people_following.robotis_servo_sim as rr
import rfid_people_following.M5e_reader_sim as rM5e
else:
import robotis.ros_robotis as rr
import hrl_rfid.ros_M5e as rM5e
if __name__ == '__main__':
# p_right = rr.ROS_Robotis_Poller( '/dev/robot/servo1', [29,30], ['right_pan', 'right_tilt'] )
# p_left = rr.ROS_Robotis_Poller( '/dev/robot/servo0', [27,28], ['left_pan', 'left_tilt'] )
p_left = rr.ROS_Robotis_Poller( '/dev/robot/servo1', [29,30], ['left_pan', 'left_tilt'] )
p_right = rr.ROS_Robotis_Poller( '/dev/robot/servo0', [27,28], ['right_pan', 'right_tilt'] )
# Hack to prevent the right servo from shaking.
p_right.servos[0].write_address( 27, [3] ) # change the right pan compliance region
p_right.servos[0].write_address( 26, [3] ) # change the right pan compliance region
# p_right = rr.ROS_Robotis_Poller( '/dev/robot/servo0', [29,30], ['right_pan', 'right_tilt'] )
# p_left = rr.ROS_Robotis_Poller( '/dev/robot/servo1', [27,28], ['left_pan', 'left_tilt'] )
ros_rfid = rM5e.ROS_M5e( name = 'ears', readPwr = 3000,
portStr = '/dev/robot/RFIDreader',
antFuncs = [ rM5e.EleLeftEar, rM5e.EleRightEar ],
callbacks = [] )
rospy.spin()
ros_rfid.stop()
p_right.stop()
p_left.stop()
| ajibawa-2023/Python-Code-Large/train/row_99451 | 22 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L14_C0", "label": "roslib import roslib", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.2642, 0.0189, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L15_C0", "label": "load_manifest()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.283, 0.0189, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest( 'rfid_hardware' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L16_C0", "label": "rospy import rospy", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.3019, 0.0189, 0, 0.66, 0.2857, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L18_C0", "label": "time import time", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.3396, 0.0189, 0, 0.66, 0.4286, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:ImportFrom_L19_C0", "label": "from threading import Thread", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.3585, 0.0189, 0, 0.66, 0.5714, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L23_C0", "label": "os import os", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.434, 0.0189, 0, 0.66, 0.7143, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "label": "if", "type": "if", "loc": [24, 31], "level": 0, "parent": null, "vector": [4, 0, 0.5189, 0.1509, 0, 0.66, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if os.environ.has_key('ROBOT') and os.environ['ROBOT'] == 'sim':\n roslib.load_manifest( 'rfid_people_following' ) # this code should really be moved to \"RFID Sim\" or some such thing, but I'm in a hurry.\n import rfid_people_following.robotis_servo_sim as rr\n import rfid_people_following.M5e_reader_sim as rM5e\n \nelse:\n import robotis.ros_robotis as rr\n import hrl_rfid.ros_M5e as rM5e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L25_C4", "label": "load_manifest()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "vector": [8, 1, 0.4717, 0.0189, 1, 0.76, 0.0, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": " roslib.load_manifest( 'rfid_people_following' ) # this code should really be moved to \"RFID Sim\" or some such thing, but I'm in a hurry."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L26_C4", "label": "rfid_people_following.robotis_servo_sim import rr", "type": "import", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "vector": [1, 1, 0.4906, 0.0189, 1, 0.76, 0.25, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "rfid_people_following.robotis_servo_sim", "arg_names": [], "import_names": ["rr"], "rhs_call_name": "", "annotation": ""}, "snippet": " import rfid_people_following.robotis_servo_sim as rr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L27_C4", "label": "rfid_people_following.M5e_reader_sim import rM5e", "type": "import", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "vector": [1, 1, 0.5094, 0.0189, 1, 0.76, 0.5, 501, 0, 1, 0, 0, 501, 0, 0], "semantic": {"name": "rfid_people_following.M5e_reader_sim", "arg_names": [], "import_names": ["rM5e"], "rhs_call_name": "", "annotation": ""}, "snippet": " import rfid_people_following.M5e_reader_sim as rM5e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L30_C4", "label": "robotis.ros_robotis import rr", "type": "import", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "vector": [1, 1, 0.566, 0.0189, 1, 0.76, 0.75, 570, 0, 1, 0, 0, 570, 0, 0], "semantic": {"name": "robotis.ros_robotis", "arg_names": [], "import_names": ["rr"], "rhs_call_name": "", "annotation": ""}, "snippet": " import robotis.ros_robotis as rr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L31_C4", "label": "hrl_rfid.ros_M5e import rM5e", "type": "import", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "vector": [1, 1, 0.5849, 0.0189, 1, 0.76, 1.0, 604, 0, 1, 0, 0, 604, 0, 0], "semantic": {"name": "hrl_rfid.ros_M5e", "arg_names": [], "import_names": ["rM5e"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hrl_rfid.ros_M5e as rM5e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "label": "if", "type": "if", "loc": [34, 52], "level": 0, "parent": null, "vector": [4, 0, 0.8113, 0.3585, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n# p_right = rr.ROS_Robotis_Poller( '/dev/robot/servo1', [29,30], ['right_pan', 'right_tilt'] )\n# p_left = rr.ROS_Robotis_Poller( '/dev/robot/servo0', [27,28], ['left_pan', 'left_tilt'] )\n p_left = rr.ROS_Robotis_Poller( '/dev/robot/servo1', [29,30], ['left_pan', 'left_tilt'] )\n p_right = rr.ROS_Robotis_Poller( '/dev/robot/servo0', [27,28], ['right_pan', 'right_tilt'] )\n # Hack to prevent the right servo from shaking.\n p_right.servos[0].write_address( 27, [3] ) # change the right pan compliance region\n p_right.servos[0].write_address( 26, [3] ) # change the right pan compliance region"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Assign_L37_C4", "label": "p_left = ROS_Robotis_Poller()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [14, 1, 0.6981, 0.0189, 1, 0.16, 0.0, 339, 3, 3, 0, 0, 343, 10, 1], "semantic": {"name": "p_left", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Poller", "annotation": ""}, "snippet": " p_left = rr.ROS_Robotis_Poller( '/dev/robot/servo1', [29,30], ['left_pan', 'left_tilt'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Assign_L38_C4", "label": "p_right = ROS_Robotis_Poller()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [14, 1, 0.717, 0.0189, 1, 0.16, 0.125, 866, 3, 3, 0, 0, 343, 10, 1], "semantic": {"name": "p_right", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_Robotis_Poller", "annotation": ""}, "snippet": " p_right = rr.ROS_Robotis_Poller( '/dev/robot/servo0', [27,28], ['right_pan', 'right_tilt'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L40_C4", "label": "write_address()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [8, 1, 0.7547, 0.0189, 1, 0.16, 0.25, 504, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write_address", "arg_names": [], "import_names": [], "rhs_call_name": "write_address", "annotation": ""}, "snippet": " p_right.servos[0].write_address( 27, [3] ) # change the right pan compliance region"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L41_C4", "label": "write_address()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [8, 1, 0.7736, 0.0189, 1, 0.16, 0.375, 504, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write_address", "arg_names": [], "import_names": [], "rhs_call_name": "write_address", "annotation": ""}, "snippet": " p_right.servos[0].write_address( 26, [3] ) # change the right pan compliance region"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Assign_L44_C4", "label": "ros_rfid = ROS_M5e()", "type": "assigned_variable", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [14, 1, 0.8585, 0.0755, 1, 0.16, 0.5, 68, 3, 5, 0, 0, 65, 10, 1], "semantic": {"name": "ros_rfid", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_M5e", "annotation": ""}, "snippet": " ros_rfid = rM5e.ROS_M5e( name = 'ears', readPwr = 3000,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [ rM5e.EleLeftEar, rM5e.EleRightEar ],\n callbacks = [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L48_C4", "label": "spin()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [8, 1, 0.9057, 0.0189, 1, 0.16, 0.625, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L50_C4", "label": "stop()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [8, 1, 0.9434, 0.0189, 1, 0.16, 0.75, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " ros_rfid.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L51_C4", "label": "stop()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [8, 1, 0.9623, 0.0189, 1, 0.16, 0.875, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " p_right.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L52_C4", "label": "stop()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "vector": [8, 1, 0.9811, 0.0189, 1, 0.16, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " p_left.stop()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Import_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99451:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99451:Expr_L52_C4"}] |
#!/usr/bin/python
#
# Copyright (c) 2009, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Travis Deyle (Healthcare Robotics Lab, Georgia Tech.)
# ROS imports
import roslib; roslib.load_manifest('hrl_rfid')
import rospy
from hrl_rfid.msg import RFIDread
from hrl_rfid.msg import RFIDreadArr
from hrl_rfid.srv import RfidSrv
import hrl_rfid.lib_M5e as M5e
import time
from threading import Thread
# Modeled off lib_M5e.M5e_Poller
class ROS_M5e( Thread ):
QUERY_MODE = 'query'
TRACK_MODE = 'track'
def __init__(self, name = 'reader1', readPwr = 2300,
portStr = '/dev/robot/RFIDreader',
antFuncs = [], callbacks = []):
Thread.__init__(self)
self.should_run = True
try:
rospy.init_node( 'rfid_m5e_' + name )
except rospy.ROSException:
pass
self.mode = ''
self.name = name + '_reader'
rospy.logout( 'ROS_M5e: Launching RFID Reader' )
rospy.logout( 'ROS_M5e: Please check out our related work @ http://www.hsi.gatech.edu/hrl/project_rfid.shtml' )
rospy.logout( 'ROS_M5e: '+self.name+' Building & Connecting to reader' )
def prin( x ): rospy.logout( 'ROS_M5e: lib_M5e: ' + x ) # use rospy.logout in underlying lib's output
self.reader = M5e.M5e(readPwr=readPwr, portSTR = portStr, verbosity_func = prin)
self.antFuncs = antFuncs
self.callbacks = callbacks + [self.broadcast]
rospy.logout( 'ROS_M5e: publishing RFID reader with type RFIDread to channel /rfid/'+name+'_reader' )
self.channel = rospy.Publisher('/rfid/'+name+'_reader', RFIDread)
self.pub_arr = rospy.Publisher('/rfid/'+name+'_reader_arr', RFIDreadArr)
self._mode_service_obj = rospy.Service('/rfid/'+name+'_mode',
RfidSrv, self._mode_service)
rospy.logout( 'ROS_M5e: '+self.name+' Inialized and awaiting instructions' )
self.start() # Thread: calls self.run()
def run( self ):
while self.should_run and not rospy.is_shutdown():
if self.mode == self.QUERY_MODE:
for aF in self.antFuncs:
antennaName = aF(self.reader) # let current antFunc make appropriate changes
results = self.reader.QueryEnvironment()
if len(results) == 0:
results = [[ '', -1 ]] # [[ tagid, rssi ], ...]
#datum = [antennaName, '', -1]
#[cF(datum) for cF in self.callbacks]
arr = []
t_now = rospy.Time.now()
for tagid, rssi in results:
rv = RFIDread( None, antennaName, tagid, rssi )
rv.header.stamp = t_now
arr.append( rv )
datum = [antennaName, tagid, rssi]
[cF(datum) for cF in self.callbacks]
rfid_arr = RFIDreadArr()
rfid_arr.header.stamp = t_now
rfid_arr.arr = arr
self.pub_arr.publish( rfid_arr )
elif self.mode == self.TRACK_MODE:
for aF in self.antFuncs:
antennaName = aF(self.reader) # let current antFunc make appropriate changes
tagid = self.tag_to_track
rssi = self.reader.TrackSingleTag(tagid, timeout=50)
t_now = rospy.Time.now()
rv = RFIDread( None, antennaName, tagid, rssi )
rv.header.stamp = t_now
rfid_arr = RFIDreadArr()
rfid_arr.header.stamp = t_now
rfid_arr.arr = [rv]
self.pub_arr.publish( rfid_arr )
#if rssi != -1:
datum = [antennaName, tagid, rssi]
[cF(datum) for cF in self.callbacks]
else:
time.sleep(0.005)
rospy.logout( 'ROS_M5e: '+self.name+' Shutting down reader' )
def stop( self ):
self.should_run = False
self.join(3)
if (self.isAlive()):
raise RuntimeError("ROS_M5e: unable to stop thread")
def broadcast(self, data):
antName, tagid, rssi = data
rv = RFIDread( None, antName, tagid, rssi )
rv.header.stamp = rospy.Time.now()
self.channel.publish( rv )
# For internal use only
def _mode_service(self, data):
val = data.data
if len(val) == 0:
rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )
elif len(val) == 1:
if val[0] == self.QUERY_MODE:
rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )
self.mode = self.QUERY_MODE
else:
rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )
self.mode = ''
elif len(val) == 2:
if val[0] == self.TRACK_MODE and len(val[1]) == 12:
rospy.logout( 'ROS_M5e: '+self.name+' Entering Track Mode: ' + str(val[1]) )
self.mode = self.TRACK_MODE
self.tag_to_track = val[1]
else:
rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )
else:
rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )
return True
# -----------------------------------------------
# Likely Callbacks: (various antennas)
# -----------------------------------------------
def EleLeftEar(M5e):
M5e.ChangeAntennaPorts(1,1)
time.sleep(0.010)
return 'EleLeftEar'
def EleRightEar(M5e):
M5e.ChangeAntennaPorts(2,2)
time.sleep(0.010)
return 'EleRightEar'
def Hand_Right_1(M5e):
# GPIO1 = 1, GPIO2 = 0
M5e.TransmitCommand('\x02\x96\x01\x01')
M5e.ReceiveResponse()
M5e.TransmitCommand('\x02\x96\x02\x00')
M5e.ReceiveResponse()
return 'Hand_Right_1'
def Hand_Right_2(M5e):
# GPIO1 = 1, GPIO2 = 1
M5e.TransmitCommand('\x02\x96\x01\x01')
M5e.ReceiveResponse()
M5e.TransmitCommand('\x02\x96\x02\x01')
M5e.ReceiveResponse()
return 'Hand_Right_2'
def Hand_Left_1(M5e):
# GPIO1 = 0, GPIO2 = 0
M5e.TransmitCommand('\x02\x96\x01\x00')
M5e.ReceiveResponse()
M5e.TransmitCommand('\x02\x96\x02\x00')
M5e.ReceiveResponse()
return 'Hand_Left_1'
def Hand_Left_2(M5e):
# GPIO1 = 0, GPIO2 = 1
M5e.TransmitCommand('\x02\x96\x01\x00')
M5e.ReceiveResponse()
M5e.TransmitCommand('\x02\x96\x02\x01')
M5e.ReceiveResponse()
return 'Hand_Left_2'
def PrintDatum(data):
ant, ids, rssi = data
print data
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('-d', action='store', type='string', dest='device',
help='Which RFID device to initialize.')
p.add_option('-p', action='store', type='int', dest='power', default=3000,
help='Which RFID device to initialize.')
opt, args = p.parse_args()
if opt.device == 'ears':
print 'Starting Ears RFID Services'
ros_rfid = ROS_M5e( name = 'ears', readPwr = opt.power,
portStr = '/dev/robot/RFIDreader',
antFuncs = [EleLeftEar, EleRightEar],
callbacks = [] )
rospy.spin()
ros_rfid.stop()
if opt.device == 'inhand':
print 'Starting Inhand RFID Services'
ros_rfid = ROS_M5e( name = 'inhand', readPwr = opt.power,
portStr = '/dev/robot/inHandReader',
antFuncs = [Hand_Right_1, Hand_Right_2,
Hand_Left_1, Hand_Left_2 ],
callbacks = [] )
rospy.spin()
ros_rfid.stop()
if opt.device == 'head':
print 'Starting PR2 Head RFID Services'
def PR2_Head(M5e):
M5e.ChangeAntennaPorts(1,1)
time.sleep(0.010)
return 'PR2_Head'
ros_rfid = ROS_M5e( name = 'head', readPwr = opt.power,
portStr = '/dev/robot/RFIDreader',
antFuncs = [PR2_Head],
callbacks = [] )
rospy.spin()
ros_rfid.stop()
| ajibawa-2023/Python-Code-Large/train/row_99453 | 156 | 258 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Import_L34_C0", "label": "roslib import roslib", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.1318, 0.0039, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_rfid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L34_C15", "label": "load_manifest()", "type": "expression", "loc": [34, 34], "level": 0, "parent": null, "vector": [8, 0, 0.1318, 0.0039, 0, 0.66, 0.0588, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_rfid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Import_L35_C0", "label": "rospy import rospy", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.1357, 0.0039, 0, 0.66, 0.1176, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:ImportFrom_L36_C0", "label": "from hrl_rfid.msg import RFIDread", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.1395, 0.0039, 0, 0.66, 0.1765, 328, 0, 1, 0, 0, 328, 0, 0], "semantic": {"name": "hrl_rfid.msg", "arg_names": [], "import_names": ["RFIDread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.msg import RFIDread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:ImportFrom_L37_C0", "label": "from hrl_rfid.msg import RFIDreadArr", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.1434, 0.0039, 0, 0.66, 0.2353, 328, 0, 1, 0, 0, 328, 0, 0], "semantic": {"name": "hrl_rfid.msg", "arg_names": [], "import_names": ["RFIDreadArr"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.msg import RFIDreadArr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:ImportFrom_L38_C0", "label": "from hrl_rfid.srv import RfidSrv", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.1473, 0.0039, 0, 0.66, 0.2941, 592, 0, 1, 0, 0, 592, 0, 0], "semantic": {"name": "hrl_rfid.srv", "arg_names": [], "import_names": ["RfidSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.srv import RfidSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Import_L39_C0", "label": "hrl_rfid.lib_M5e import M5e", "type": "import", "loc": [39, 39], "level": 0, "parent": null, "vector": [1, 0, 0.1512, 0.0039, 0, 0.66, 0.3529, 761, 0, 1, 0, 0, 761, 0, 0], "semantic": {"name": "hrl_rfid.lib_M5e", "arg_names": [], "import_names": ["M5e"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_rfid.lib_M5e as M5e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Import_L41_C0", "label": "time import time", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.1589, 0.0039, 0, 0.66, 0.4118, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:ImportFrom_L42_C0", "label": "from threading import Thread", "type": "import", "loc": [42, 42], "level": 0, "parent": null, "vector": [1, 0, 0.1628, 0.0039, 0, 0.66, 0.4706, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "label": "ROS_M5e", "type": "class", "loc": [46, 160], "level": 0, "parent": null, "vector": [3, 0, 0.3992, 0.4457, 0, 0.66, 0.5294, 65, 0, 6, 0, 0, 134, 0, 52], "semantic": {"name": "ROS_M5e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ROS_M5e( Thread ):\n QUERY_MODE = 'query'\n TRACK_MODE = 'track'\n \n def __init__(self, name = 'reader1', readPwr = 2300,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [], callbacks = []):\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L47_C4", "label": "QUERY_MODE =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "vector": [14, 1, 0.1822, 0.0039, 1, 0.71, 0.0, 353, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "QUERY_MODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " QUERY_MODE = 'query'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L48_C4", "label": "TRACK_MODE =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "vector": [14, 1, 0.186, 0.0039, 1, 0.71, 0.1667, 197, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TRACK_MODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TRACK_MODE = 'track'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "label": "__init__", "type": "function", "loc": [50, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "vector": [2, 1, 0.2578, 0.1318, 1, 0.71, 0.3333, 555, 0, 6, 0, 0, 0, 0, 13], "semantic": {"name": "__init__", "arg_names": ["self", "name", "readPwr", "portStr", "antFuncs", "callbacks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name = 'reader1', readPwr = 2300,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [], callbacks = []):\n\n Thread.__init__(self)\n self.should_run = True\n\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L54_C8", "label": "__init__()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [8, 2, 0.2093, 0.0039, 2, 0.96, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Thread.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L55_C8", "label": "self.should_run =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.2132, 0.0039, 2, 0.96, 0.0588, 736, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_run", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_run = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Try_L57_C8", "label": "try", "type": "try", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [7, 2, 0.2267, 0.0155, 2, 0.96, 0.1176, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node( 'rfid_m5e_' + name )\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L58_C12", "label": "init_node()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:Try_L57_C8", "vector": [8, 3, 0.2248, 0.0039, 3, 0.75, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'rfid_m5e_' + name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L62_C8", "label": "self.mode =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.2403, 0.0039, 2, 0.96, 0.1765, 474, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L63_C8", "label": "self.name =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.2442, 0.0039, 2, 0.96, 0.2353, 689, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = name + '_reader'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L65_C8", "label": "logout()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [8, 2, 0.2519, 0.0039, 2, 0.96, 0.2941, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Launching RFID Reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L66_C8", "label": "logout()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [8, 2, 0.2558, 0.0039, 2, 0.96, 0.3529, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Please check out our related work @ http://www.hsi.gatech.edu/hrl/project_rfid.shtml' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L67_C8", "label": "logout()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [8, 2, 0.2597, 0.0039, 2, 0.96, 0.4118, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Building & Connecting to reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L69_C8", "label": "prin", "type": "function", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [2, 2, 0.2674, 0.0039, 2, 0.96, 0.4706, 607, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "prin", "arg_names": ["x"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prin( x ): rospy.logout( 'ROS_M5e: lib_M5e: ' + x ) # use rospy.logout in underlying lib's output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L69_C23", "label": "logout()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L69_C8", "vector": [8, 3, 0.2674, 0.0039, 3, 0.39, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " def prin( x ): rospy.logout( 'ROS_M5e: lib_M5e: ' + x ) # use rospy.logout in underlying lib's output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L71_C8", "label": "self.reader = M5e()", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.2752, 0.0039, 2, 0.96, 0.5294, 536, 3, 3, 0, 0, 931, 10, 1], "semantic": {"name": "self.reader", "arg_names": [], "import_names": [], "rhs_call_name": "M5e", "annotation": ""}, "snippet": " self.reader = M5e.M5e(readPwr=readPwr, portSTR = portStr, verbosity_func = prin)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L72_C8", "label": "self.antFuncs =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.2791, 0.0039, 2, 0.96, 0.5882, 516, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.antFuncs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.antFuncs = antFuncs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L73_C8", "label": "self.callbacks =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.2829, 0.0039, 2, 0.96, 0.6471, 264, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.callbacks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.callbacks = callbacks + [self.broadcast]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L75_C8", "label": "logout()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [8, 2, 0.2907, 0.0039, 2, 0.96, 0.7059, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: publishing RFID reader with type RFIDread to channel /rfid/'+name+'_reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L76_C8", "label": "self.channel = Publisher()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.2946, 0.0039, 2, 0.96, 0.7647, 503, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.channel", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.channel = rospy.Publisher('/rfid/'+name+'_reader', RFIDread)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L77_C8", "label": "self.pub_arr = Publisher()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.2984, 0.0039, 2, 0.96, 0.8235, 27, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.pub_arr", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.pub_arr = rospy.Publisher('/rfid/'+name+'_reader_arr', RFIDreadArr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L78_C8", "label": "self._mode_service_obj = Service()", "type": "assigned_variable", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [14, 2, 0.3043, 0.0078, 2, 0.96, 0.8824, 356, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._mode_service_obj", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._mode_service_obj = rospy.Service('/rfid/'+name+'_mode',\n RfidSrv, self._mode_service)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L81_C8", "label": "logout()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [8, 2, 0.314, 0.0039, 2, 0.96, 0.9412, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Inialized and awaiting instructions' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L83_C8", "label": "start()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "vector": [8, 2, 0.3217, 0.0039, 2, 0.96, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self.start() # Thread: calls self.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L85_C4", "label": "run", "type": "function", "loc": [85, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "vector": [2, 1, 0.407, 0.1589, 1, 0.71, 0.5, 679, 0, 1, 0, 0, 0, 0, 19], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run( self ): \n while self.should_run and not rospy.is_shutdown():\n if self.mode == self.QUERY_MODE:\n for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n results = self.reader.QueryEnvironment()\n if len(results) == 0:\n results = [[ '', -1 ]] # [[ tagid, rssi ], ...]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:While_L86_C8", "label": "while", "type": "while", "loc": [86, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L85_C4", "vector": [5, 2, 0.405, 0.1473, 2, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.should_run and not rospy.is_shutdown():\n if self.mode == self.QUERY_MODE:\n for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n results = self.reader.QueryEnvironment()\n if len(results) == 0:\n results = [[ '', -1 ]] # [[ tagid, rssi ], ...]\n #datum = [antennaName, '', -1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L87_C12", "label": "if", "type": "if", "loc": [87, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:While_L86_C8", "vector": [4, 3, 0.407, 0.1434, 3, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.mode == self.QUERY_MODE:\n for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n results = self.reader.QueryEnvironment()\n if len(results) == 0:\n results = [[ '', -1 ]] # [[ tagid, rssi ], ...]\n #datum = [antennaName, '', -1]\n #[cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "label": "for aF", "type": "for", "loc": [88, 106], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L87_C12", "vector": [6, 4, 0.376, 0.0736, 4, 0.49, 0.0, 36, 7, 0, 0, 0, 0, 0, 9], "semantic": {"name": "aF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n results = self.reader.QueryEnvironment()\n if len(results) == 0:\n results = [[ '', -1 ]] # [[ tagid, rssi ], ...]\n #datum = [antennaName, '', -1]\n #[cF(datum) for cF in self.callbacks]\n arr = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L89_C20", "label": "antennaName = aF()", "type": "assigned_variable", "loc": [89, 89], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [14, 5, 0.345, 0.0039, 5, 0.58, 0.0, 713, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "antennaName", "arg_names": [], "import_names": [], "rhs_call_name": "aF", "annotation": ""}, "snippet": " antennaName = aF(self.reader) # let current antFunc make appropriate changes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L90_C20", "label": "results = QueryEnvironment()", "type": "assigned_variable", "loc": [90, 90], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [14, 5, 0.3488, 0.0039, 5, 0.58, 0.1111, 143, 3, 0, 0, 0, 496, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "QueryEnvironment", "annotation": ""}, "snippet": " results = self.reader.QueryEnvironment()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L91_C20", "label": "if", "type": "if", "loc": [91, 92], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [4, 5, 0.3547, 0.0078, 5, 0.58, 0.2222, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(results) == 0:\n results = [[ '', -1 ]] # [[ tagid, rssi ], ...]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L92_C24", "label": "results =", "type": "assigned_variable", "loc": [92, 92], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L91_C20", "vector": [14, 6, 0.3566, 0.0039, 6, 0.63, 0.0, 143, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " results = [[ '', -1 ]] # [[ tagid, rssi ], ...]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L95_C20", "label": "arr =", "type": "assigned_variable", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [14, 5, 0.3682, 0.0039, 5, 0.58, 0.3333, 395, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arr = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L96_C20", "label": "t_now = now()", "type": "assigned_variable", "loc": [96, 96], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [14, 5, 0.3721, 0.0039, 5, 0.58, 0.4444, 23, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "t_now", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " t_now = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "label": "for tagid, rssi", "type": "for", "loc": [97, 102], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [6, 5, 0.3857, 0.0233, 5, 0.58, 0.5556, 398, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "tagid, rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tagid, rssi in results:\n rv = RFIDread( None, antennaName, tagid, rssi )\n rv.header.stamp = t_now\n arr.append( rv )\n datum = [antennaName, tagid, rssi]\n [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L98_C24", "label": "rv = RFIDread()", "type": "assigned_variable", "loc": [98, 98], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "vector": [14, 6, 0.3798, 0.0039, 6, 0.94, 0.0, 222, 3, 4, 0, 0, 624, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "RFIDread", "annotation": ""}, "snippet": " rv = RFIDread( None, antennaName, tagid, rssi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L99_C24", "label": "rv.header.stamp =", "type": "assigned_variable", "loc": [99, 99], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "vector": [14, 6, 0.3837, 0.0039, 6, 0.94, 0.25, 13, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.header.stamp = t_now"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L100_C24", "label": "append()", "type": "expression", "loc": [100, 100], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "vector": [8, 6, 0.3876, 0.0039, 6, 0.94, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " arr.append( rv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L101_C24", "label": "datum =", "type": "assigned_variable", "loc": [101, 101], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "vector": [14, 6, 0.3915, 0.0039, 6, 0.94, 0.75, 975, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "datum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " datum = [antennaName, tagid, rssi]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L102_C24", "label": "expression", "type": "expression", "loc": [102, 102], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "vector": [8, 6, 0.3953, 0.0039, 6, 0.94, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L103_C20", "label": "rfid_arr = RFIDreadArr()", "type": "assigned_variable", "loc": [103, 103], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [14, 5, 0.3992, 0.0039, 5, 0.58, 0.6667, 272, 3, 0, 0, 0, 80, 10, 1], "semantic": {"name": "rfid_arr", "arg_names": [], "import_names": [], "rhs_call_name": "RFIDreadArr", "annotation": ""}, "snippet": " rfid_arr = RFIDreadArr()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L104_C20", "label": "rfid_arr.header.stamp =", "type": "assigned_variable", "loc": [104, 104], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [14, 5, 0.4031, 0.0039, 5, 0.58, 0.7778, 144, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rfid_arr.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rfid_arr.header.stamp = t_now"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L105_C20", "label": "rfid_arr.arr =", "type": "assigned_variable", "loc": [105, 105], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [14, 5, 0.407, 0.0039, 5, 0.58, 0.8889, 694, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rfid_arr.arr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rfid_arr.arr = arr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L106_C20", "label": "publish()", "type": "expression", "loc": [106, 106], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "vector": [8, 5, 0.4109, 0.0039, 5, 0.58, 1.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub_arr.publish( rfid_arr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L107_C12", "label": "if", "type": "if", "loc": [107, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L87_C12", "vector": [4, 4, 0.4457, 0.0659, 4, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.mode == self.TRACK_MODE:\n for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n tagid = self.tag_to_track\n rssi = self.reader.TrackSingleTag(tagid, timeout=50)\n t_now = rospy.Time.now()\n rv = RFIDread( None, antennaName, tagid, rssi )\n rv.header.stamp = t_now"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "label": "for aF", "type": "for", "loc": [108, 121], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L107_C12", "vector": [6, 5, 0.4438, 0.0543, 5, 0.05, 0.0, 36, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "aF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n tagid = self.tag_to_track\n rssi = self.reader.TrackSingleTag(tagid, timeout=50)\n t_now = rospy.Time.now()\n rv = RFIDread( None, antennaName, tagid, rssi )\n rv.header.stamp = t_now\n rfid_arr = RFIDreadArr()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L109_C20", "label": "antennaName = aF()", "type": "assigned_variable", "loc": [109, 109], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4225, 0.0039, 6, 0.41, 0.0, 713, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "antennaName", "arg_names": [], "import_names": [], "rhs_call_name": "aF", "annotation": ""}, "snippet": " antennaName = aF(self.reader) # let current antFunc make appropriate changes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L110_C20", "label": "tagid =", "type": "assigned_variable", "loc": [110, 110], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4264, 0.0039, 6, 0.41, 0.0909, 538, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tagid = self.tag_to_track"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L111_C20", "label": "rssi = TrackSingleTag()", "type": "assigned_variable", "loc": [111, 111], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4302, 0.0039, 6, 0.41, 0.1818, 906, 3, 2, 0, 0, 782, 10, 1], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "TrackSingleTag", "annotation": ""}, "snippet": " rssi = self.reader.TrackSingleTag(tagid, timeout=50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L112_C20", "label": "t_now = now()", "type": "assigned_variable", "loc": [112, 112], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4341, 0.0039, 6, 0.41, 0.2727, 23, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "t_now", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " t_now = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L113_C20", "label": "rv = RFIDread()", "type": "assigned_variable", "loc": [113, 113], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.438, 0.0039, 6, 0.41, 0.3636, 222, 3, 4, 0, 0, 624, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "RFIDread", "annotation": ""}, "snippet": " rv = RFIDread( None, antennaName, tagid, rssi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L114_C20", "label": "rv.header.stamp =", "type": "assigned_variable", "loc": [114, 114], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4419, 0.0039, 6, 0.41, 0.4545, 13, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv.header.stamp = t_now"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L115_C20", "label": "rfid_arr = RFIDreadArr()", "type": "assigned_variable", "loc": [115, 115], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4457, 0.0039, 6, 0.41, 0.5455, 272, 3, 0, 0, 0, 80, 10, 1], "semantic": {"name": "rfid_arr", "arg_names": [], "import_names": [], "rhs_call_name": "RFIDreadArr", "annotation": ""}, "snippet": " rfid_arr = RFIDreadArr()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L116_C20", "label": "rfid_arr.header.stamp =", "type": "assigned_variable", "loc": [116, 116], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4496, 0.0039, 6, 0.41, 0.6364, 144, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rfid_arr.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rfid_arr.header.stamp = t_now"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L117_C20", "label": "rfid_arr.arr =", "type": "assigned_variable", "loc": [117, 117], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4535, 0.0039, 6, 0.41, 0.7273, 694, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rfid_arr.arr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rfid_arr.arr = [rv]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L118_C20", "label": "publish()", "type": "expression", "loc": [118, 118], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [8, 6, 0.4574, 0.0039, 6, 0.41, 0.8182, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.pub_arr.publish( rfid_arr )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L120_C20", "label": "datum =", "type": "assigned_variable", "loc": [120, 120], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [14, 6, 0.4651, 0.0039, 6, 0.41, 0.9091, 975, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "datum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " datum = [antennaName, tagid, rssi]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L121_C20", "label": "expression", "type": "expression", "loc": [121, 121], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "vector": [8, 6, 0.469, 0.0039, 6, 0.41, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L123_C16", "label": "sleep()", "type": "expression", "loc": [123, 123], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L107_C12", "vector": [8, 5, 0.4767, 0.0039, 5, 0.05, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.005)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L125_C8", "label": "logout()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L85_C4", "vector": [8, 2, 0.4845, 0.0039, 2, 0.96, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Shutting down reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L127_C4", "label": "stop", "type": "function", "loc": [127, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "vector": [2, 1, 0.5, 0.0194, 1, 0.71, 0.6667, 343, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop( self ):\n self.should_run = False\n self.join(3)\n if (self.isAlive()):\n raise RuntimeError(\"ROS_M5e: unable to stop thread\") "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L128_C8", "label": "self.should_run =", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L127_C4", "vector": [14, 2, 0.4961, 0.0039, 2, 0.86, 0.0, 736, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.should_run", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.should_run = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L129_C8", "label": "join()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L127_C4", "vector": [8, 2, 0.5, 0.0039, 2, 0.86, 0.5, 933, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " self.join(3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L130_C8", "label": "if", "type": "if", "loc": [130, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L127_C4", "vector": [4, 2, 0.5058, 0.0078, 2, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.isAlive()):\n raise RuntimeError(\"ROS_M5e: unable to stop thread\") "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "label": "broadcast", "type": "function", "loc": [133, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "vector": [2, 1, 0.5233, 0.0194, 1, 0.71, 0.8333, 803, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "broadcast", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def broadcast(self, data):\n antName, tagid, rssi = data\n rv = RFIDread( None, antName, tagid, rssi )\n rv.header.stamp = rospy.Time.now()\n self.channel.publish( rv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L134_C8", "label": "antName, tagid, rssi =", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "vector": [14, 2, 0.5194, 0.0039, 2, 0.71, 0.0, 920, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "antName, tagid, rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " antName, tagid, rssi = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L135_C8", "label": "rv = RFIDread()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "vector": [14, 2, 0.5233, 0.0039, 2, 0.71, 0.3333, 222, 3, 4, 0, 0, 624, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "RFIDread", "annotation": ""}, "snippet": " rv = RFIDread( None, antName, tagid, rssi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L136_C8", "label": "rv.header.stamp = now()", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "vector": [14, 2, 0.5271, 0.0039, 2, 0.71, 0.6667, 13, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "rv.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " rv.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L137_C8", "label": "publish()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "vector": [8, 2, 0.531, 0.0039, 2, 0.71, 1.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.channel.publish( rv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L140_C4", "label": "_mode_service", "type": "function", "loc": [140, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "vector": [2, 1, 0.5814, 0.0814, 1, 0.71, 1.0, 436, 0, 2, 1, 0, 0, 0, 14], "semantic": {"name": "_mode_service", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _mode_service(self, data):\n val = data.data\n if len(val) == 0:\n rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )\n elif len(val) == 1:\n if val[0] == self.QUERY_MODE:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )\n self.mode = self.QUERY_MODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L141_C8", "label": "val =", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L140_C4", "vector": [14, 2, 0.5465, 0.0039, 2, 0.75, 0.0, 618, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " val = data.data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L142_C8", "label": "if", "type": "if", "loc": [142, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L140_C4", "vector": [4, 2, 0.5833, 0.0698, 2, 0.75, 0.5, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(val) == 0:\n rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )\n elif len(val) == 1:\n if val[0] == self.QUERY_MODE:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )\n self.mode = self.QUERY_MODE\n else:\n rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L143_C12", "label": "logout()", "type": "expression", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L142_C8", "vector": [8, 3, 0.5543, 0.0039, 3, 0.44, 0.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L144_C8", "label": "if", "type": "if", "loc": [144, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L142_C8", "vector": [4, 3, 0.5872, 0.062, 3, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(val) == 1:\n if val[0] == self.QUERY_MODE:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )\n self.mode = self.QUERY_MODE\n else:\n rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )\n self.mode = ''\n elif len(val) == 2:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "label": "if", "type": "if", "loc": [145, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L144_C8", "vector": [4, 4, 0.5717, 0.0233, 4, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val[0] == self.QUERY_MODE:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )\n self.mode = self.QUERY_MODE\n else:\n rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )\n self.mode = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L146_C16", "label": "logout()", "type": "expression", "loc": [146, 146], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "vector": [8, 5, 0.5659, 0.0039, 5, 0.59, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L147_C16", "label": "self.mode =", "type": "assigned_variable", "loc": [147, 147], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "vector": [14, 5, 0.5698, 0.0039, 5, 0.59, 0.3333, 474, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = self.QUERY_MODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L149_C16", "label": "logout()", "type": "expression", "loc": [149, 149], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "vector": [8, 5, 0.5775, 0.0039, 5, 0.59, 0.6667, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L150_C16", "label": "self.mode =", "type": "assigned_variable", "loc": [150, 150], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "vector": [14, 5, 0.5814, 0.0039, 5, 0.59, 1.0, 474, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L151_C8", "label": "if", "type": "if", "loc": [151, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L144_C8", "vector": [4, 4, 0.6008, 0.0349, 4, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(val) == 2:\n if val[0] == self.TRACK_MODE and len(val[1]) == 12:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Track Mode: ' + str(val[1]) )\n self.mode = self.TRACK_MODE\n self.tag_to_track = val[1]\n else:\n rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "label": "if", "type": "if", "loc": [152, 157], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L151_C8", "vector": [4, 5, 0.5988, 0.0233, 5, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val[0] == self.TRACK_MODE and len(val[1]) == 12:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Track Mode: ' + str(val[1]) )\n self.mode = self.TRACK_MODE\n self.tag_to_track = val[1]\n else:\n rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L153_C16", "label": "logout()", "type": "expression", "loc": [153, 153], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "vector": [8, 6, 0.593, 0.0039, 6, 0.69, 0.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Entering Track Mode: ' + str(val[1]) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L154_C16", "label": "self.mode =", "type": "assigned_variable", "loc": [154, 154], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "vector": [14, 6, 0.5969, 0.0039, 6, 0.69, 0.3333, 474, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = self.TRACK_MODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L155_C16", "label": "self.tag_to_track =", "type": "assigned_variable", "loc": [155, 155], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "vector": [14, 6, 0.6008, 0.0039, 6, 0.69, 0.6667, 131, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.tag_to_track", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tag_to_track = val[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L157_C16", "label": "logout()", "type": "expression", "loc": [157, 157], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "vector": [8, 6, 0.6085, 0.0039, 6, 0.69, 1.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L159_C12", "label": "logout()", "type": "expression", "loc": [159, 159], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L151_C8", "vector": [8, 5, 0.6163, 0.0039, 5, 0.51, 1.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L140_C4", "vector": [13, 2, 0.6202, 0.0039, 2, 0.75, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L168_C0", "label": "EleLeftEar", "type": "function", "loc": [168, 171], "level": 0, "parent": null, "vector": [2, 0, 0.657, 0.0155, 0, 0.66, 0.5882, 578, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "EleLeftEar", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def EleLeftEar(M5e):\n M5e.ChangeAntennaPorts(1,1)\n time.sleep(0.010)\n return 'EleLeftEar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L169_C4", "label": "ChangeAntennaPorts()", "type": "expression", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L168_C0", "vector": [8, 1, 0.655, 0.0039, 1, 0.1, 0.0, 901, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ChangeAntennaPorts", "arg_names": [], "import_names": [], "rhs_call_name": "ChangeAntennaPorts", "annotation": ""}, "snippet": " M5e.ChangeAntennaPorts(1,1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L170_C4", "label": "sleep()", "type": "expression", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L168_C0", "vector": [8, 1, 0.6589, 0.0039, 1, 0.1, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.010)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L171_C4", "label": "return", "type": "return", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L168_C0", "vector": [13, 1, 0.6628, 0.0039, 1, 0.1, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'EleLeftEar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L173_C0", "label": "EleRightEar", "type": "function", "loc": [173, 176], "level": 0, "parent": null, "vector": [2, 0, 0.6764, 0.0155, 0, 0.66, 0.6471, 801, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "EleRightEar", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def EleRightEar(M5e):\n M5e.ChangeAntennaPorts(2,2)\n time.sleep(0.010)\n return 'EleRightEar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L174_C4", "label": "ChangeAntennaPorts()", "type": "expression", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L173_C0", "vector": [8, 1, 0.6744, 0.0039, 1, 0.12, 0.0, 901, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ChangeAntennaPorts", "arg_names": [], "import_names": [], "rhs_call_name": "ChangeAntennaPorts", "annotation": ""}, "snippet": " M5e.ChangeAntennaPorts(2,2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L175_C4", "label": "sleep()", "type": "expression", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L173_C0", "vector": [8, 1, 0.6783, 0.0039, 1, 0.12, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.010)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L176_C4", "label": "return", "type": "return", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L173_C0", "vector": [13, 1, 0.6822, 0.0039, 1, 0.12, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'EleRightEar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "label": "Hand_Right_1", "type": "function", "loc": [178, 184], "level": 0, "parent": null, "vector": [2, 0, 0.7016, 0.0271, 0, 0.66, 0.7059, 490, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "Hand_Right_1", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Hand_Right_1(M5e):\n # GPIO1 = 1, GPIO2 = 0\n M5e.TransmitCommand('\\x02\\x96\\x01\\x01')\n M5e.ReceiveResponse()\n M5e.TransmitCommand('\\x02\\x96\\x02\\x00')\n M5e.ReceiveResponse()\n return 'Hand_Right_1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L180_C4", "label": "TransmitCommand()", "type": "expression", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "vector": [8, 1, 0.6977, 0.0039, 1, 0.35, 0.0, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x01\\x01')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L181_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [181, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "vector": [8, 1, 0.7016, 0.0039, 1, 0.35, 0.25, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L182_C4", "label": "TransmitCommand()", "type": "expression", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "vector": [8, 1, 0.7054, 0.0039, 1, 0.35, 0.5, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x02\\x00')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L183_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "vector": [8, 1, 0.7093, 0.0039, 1, 0.35, 0.75, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L184_C4", "label": "return", "type": "return", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "vector": [13, 1, 0.7132, 0.0039, 1, 0.35, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Hand_Right_1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "label": "Hand_Right_2", "type": "function", "loc": [186, 192], "level": 0, "parent": null, "vector": [2, 0, 0.7326, 0.0271, 0, 0.66, 0.7647, 943, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "Hand_Right_2", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Hand_Right_2(M5e):\n # GPIO1 = 1, GPIO2 = 1\n M5e.TransmitCommand('\\x02\\x96\\x01\\x01')\n M5e.ReceiveResponse()\n M5e.TransmitCommand('\\x02\\x96\\x02\\x01')\n M5e.ReceiveResponse()\n return 'Hand_Right_2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L188_C4", "label": "TransmitCommand()", "type": "expression", "loc": [188, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "vector": [8, 1, 0.7287, 0.0039, 1, 0.09, 0.0, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x01\\x01')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L189_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [189, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "vector": [8, 1, 0.7326, 0.0039, 1, 0.09, 0.25, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L190_C4", "label": "TransmitCommand()", "type": "expression", "loc": [190, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "vector": [8, 1, 0.7364, 0.0039, 1, 0.09, 0.5, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x02\\x01')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L191_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [191, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "vector": [8, 1, 0.7403, 0.0039, 1, 0.09, 0.75, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L192_C4", "label": "return", "type": "return", "loc": [192, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "vector": [13, 1, 0.7442, 0.0039, 1, 0.09, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Hand_Right_2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "label": "Hand_Left_1", "type": "function", "loc": [194, 200], "level": 0, "parent": null, "vector": [2, 0, 0.7636, 0.0271, 0, 0.66, 0.8235, 666, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "Hand_Left_1", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Hand_Left_1(M5e):\n # GPIO1 = 0, GPIO2 = 0\n M5e.TransmitCommand('\\x02\\x96\\x01\\x00')\n M5e.ReceiveResponse()\n M5e.TransmitCommand('\\x02\\x96\\x02\\x00')\n M5e.ReceiveResponse()\n return 'Hand_Left_1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L196_C4", "label": "TransmitCommand()", "type": "expression", "loc": [196, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "vector": [8, 1, 0.7597, 0.0039, 1, 0.45, 0.0, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x01\\x00')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L197_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "vector": [8, 1, 0.7636, 0.0039, 1, 0.45, 0.25, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L198_C4", "label": "TransmitCommand()", "type": "expression", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "vector": [8, 1, 0.7674, 0.0039, 1, 0.45, 0.5, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x02\\x00')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L199_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "vector": [8, 1, 0.7713, 0.0039, 1, 0.45, 0.75, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L200_C4", "label": "return", "type": "return", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "vector": [13, 1, 0.7752, 0.0039, 1, 0.45, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Hand_Left_1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "label": "Hand_Left_2", "type": "function", "loc": [202, 208], "level": 0, "parent": null, "vector": [2, 0, 0.7946, 0.0271, 0, 0.66, 0.8824, 308, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "Hand_Left_2", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Hand_Left_2(M5e):\n # GPIO1 = 0, GPIO2 = 1\n M5e.TransmitCommand('\\x02\\x96\\x01\\x00')\n M5e.ReceiveResponse()\n M5e.TransmitCommand('\\x02\\x96\\x02\\x01')\n M5e.ReceiveResponse()\n return 'Hand_Left_2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L204_C4", "label": "TransmitCommand()", "type": "expression", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "vector": [8, 1, 0.7907, 0.0039, 1, 0.14, 0.0, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x01\\x00')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L205_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [205, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "vector": [8, 1, 0.7946, 0.0039, 1, 0.14, 0.25, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L206_C4", "label": "TransmitCommand()", "type": "expression", "loc": [206, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "vector": [8, 1, 0.7984, 0.0039, 1, 0.14, 0.5, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x02\\x01')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L207_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [207, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "vector": [8, 1, 0.8023, 0.0039, 1, 0.14, 0.75, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L208_C4", "label": "return", "type": "return", "loc": [208, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "vector": [13, 1, 0.8062, 0.0039, 1, 0.14, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Hand_Left_2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L210_C0", "label": "PrintDatum", "type": "function", "loc": [210, 212], "level": 0, "parent": null, "vector": [2, 0, 0.8178, 0.0116, 0, 0.66, 0.9412, 369, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "PrintDatum", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PrintDatum(data):\n ant, ids, rssi = data\n print(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L211_C4", "label": "ant, ids, rssi =", "type": "assigned_variable", "loc": [211, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L210_C0", "vector": [14, 1, 0.8178, 0.0039, 1, 0.62, 0.0, 269, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ant, ids, rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ant, ids, rssi = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L212_C4", "label": "print()", "type": "expression", "loc": [212, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L210_C0", "vector": [8, 1, 0.8217, 0.0039, 1, 0.62, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "label": "if", "type": "if", "loc": [214, 256], "level": 0, "parent": null, "vector": [4, 0, 0.9109, 0.1667, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n\n p = optparse.OptionParser()\n p.add_option('-d', action='store', type='string', dest='device',\n help='Which RFID device to initialize.')\n p.add_option('-p', action='store', type='int', dest='power', default=3000,\n help='Which RFID device to initialize.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Import_L215_C4", "label": "optparse import optparse", "type": "import", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "vector": [1, 1, 0.8333, 0.0039, 1, 0.73, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L217_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "vector": [14, 1, 0.8411, 0.0039, 1, 0.73, 0.1429, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L218_C4", "label": "add_option()", "type": "expression", "loc": [218, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "vector": [8, 1, 0.8469, 0.0078, 1, 0.73, 0.2857, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-d', action='store', type='string', dest='device',\n help='Which RFID device to initialize.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L220_C4", "label": "add_option()", "type": "expression", "loc": [220, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "vector": [8, 1, 0.8547, 0.0078, 1, 0.73, 0.4286, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-p', action='store', type='int', dest='power', default=3000,\n help='Which RFID device to initialize.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L222_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "vector": [14, 1, 0.8605, 0.0039, 1, 0.73, 0.5714, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "label": "if", "type": "if", "loc": [224, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "vector": [4, 1, 0.8818, 0.031, 1, 0.73, 0.7143, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.device == 'ears':\n print('Starting Ears RFID Services')\n ros_rfid = ROS_M5e( name = 'ears', readPwr = opt.power,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [EleLeftEar, EleRightEar],\n callbacks = [] )\n rospy.spin()\n ros_rfid.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L225_C8", "label": "print()", "type": "expression", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "vector": [8, 2, 0.8721, 0.0039, 2, 0.55, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting Ears RFID Services')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L226_C8", "label": "ros_rfid = ROS_M5e()", "type": "assigned_variable", "loc": [226, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "vector": [14, 2, 0.8818, 0.0155, 2, 0.55, 0.3333, 68, 3, 5, 0, 0, 65, 10, 1], "semantic": {"name": "ros_rfid", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_M5e", "annotation": ""}, "snippet": " ros_rfid = ROS_M5e( name = 'ears', readPwr = opt.power,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [EleLeftEar, EleRightEar],\n callbacks = [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L230_C8", "label": "spin()", "type": "expression", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "vector": [8, 2, 0.8915, 0.0039, 2, 0.55, 0.6667, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L231_C8", "label": "stop()", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "vector": [8, 2, 0.8953, 0.0039, 2, 0.55, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " ros_rfid.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "label": "if", "type": "if", "loc": [233, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "vector": [4, 1, 0.9186, 0.0349, 1, 0.73, 0.8571, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.device == 'inhand':\n print('Starting Inhand RFID Services')\n ros_rfid = ROS_M5e( name = 'inhand', readPwr = opt.power,\n portStr = '/dev/robot/inHandReader',\n antFuncs = [Hand_Right_1, Hand_Right_2,\n Hand_Left_1, Hand_Left_2 ],\n callbacks = [] )\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L234_C8", "label": "print()", "type": "expression", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "vector": [8, 2, 0.907, 0.0039, 2, 0.8, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting Inhand RFID Services')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L235_C8", "label": "ros_rfid = ROS_M5e()", "type": "assigned_variable", "loc": [235, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "vector": [14, 2, 0.9186, 0.0194, 2, 0.8, 0.3333, 68, 3, 5, 0, 0, 65, 10, 1], "semantic": {"name": "ros_rfid", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_M5e", "annotation": ""}, "snippet": " ros_rfid = ROS_M5e( name = 'inhand', readPwr = opt.power,\n portStr = '/dev/robot/inHandReader',\n antFuncs = [Hand_Right_1, Hand_Right_2,\n Hand_Left_1, Hand_Left_2 ],\n callbacks = [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L240_C8", "label": "spin()", "type": "expression", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "vector": [8, 2, 0.9302, 0.0039, 2, 0.8, 0.6667, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L241_C8", "label": "stop()", "type": "expression", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "vector": [8, 2, 0.9341, 0.0039, 2, 0.8, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " ros_rfid.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "label": "if", "type": "if", "loc": [243, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "vector": [4, 1, 0.9671, 0.0543, 1, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.device == 'head':\n print('Starting PR2 Head RFID Services')\n\n def PR2_Head(M5e):\n M5e.ChangeAntennaPorts(1,1)\n time.sleep(0.010)\n return 'PR2_Head'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L244_C8", "label": "print()", "type": "expression", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "vector": [8, 2, 0.9457, 0.0039, 2, 0.66, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting PR2 Head RFID Services')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L246_C8", "label": "PR2_Head", "type": "function", "loc": [246, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "vector": [2, 2, 0.9593, 0.0155, 2, 0.66, 0.25, 786, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "PR2_Head", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def PR2_Head(M5e):\n M5e.ChangeAntennaPorts(1,1)\n time.sleep(0.010)\n return 'PR2_Head'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L247_C12", "label": "ChangeAntennaPorts()", "type": "expression", "loc": [247, 247], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L246_C8", "vector": [8, 3, 0.9574, 0.0039, 3, 0.81, 0.0, 901, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ChangeAntennaPorts", "arg_names": [], "import_names": [], "rhs_call_name": "ChangeAntennaPorts", "annotation": ""}, "snippet": " M5e.ChangeAntennaPorts(1,1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L248_C12", "label": "sleep()", "type": "expression", "loc": [248, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L246_C8", "vector": [8, 3, 0.9612, 0.0039, 3, 0.81, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.010)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L249_C12", "label": "return", "type": "return", "loc": [249, 249], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L246_C8", "vector": [13, 3, 0.9651, 0.0039, 3, 0.81, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'PR2_Head'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L251_C8", "label": "ros_rfid = ROS_M5e()", "type": "assigned_variable", "loc": [251, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "vector": [14, 2, 0.9787, 0.0155, 2, 0.66, 0.5, 68, 3, 5, 0, 0, 65, 10, 1], "semantic": {"name": "ros_rfid", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_M5e", "annotation": ""}, "snippet": " ros_rfid = ROS_M5e( name = 'head', readPwr = opt.power,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [PR2_Head],\n callbacks = [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L255_C8", "label": "spin()", "type": "expression", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "vector": [8, 2, 0.9884, 0.0039, 2, 0.66, 0.75, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L256_C8", "label": "stop()", "type": "expression", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "vector": [8, 2, 0.9922, 0.0039, 2, 0.66, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " ros_rfid.stop()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Try_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:Try_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L69_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:While_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:While_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L87_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L89_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L90_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L91_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L91_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L92_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L95_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L96_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L98_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L99_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L100_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L101_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L102_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L103_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L104_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L105_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L106_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L87_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L107_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L109_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L110_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L111_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L112_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L113_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L114_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L115_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L116_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L117_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L118_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L120_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:For_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L121_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L107_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L123_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L144_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L146_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L147_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L149_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L145_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L150_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L144_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L153_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L154_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L155_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L152_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L157_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L168_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L168_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L168_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L186_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Import_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:FunctionDef_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Return_L249_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99453:If_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99453:Expr_L256_C8"}] |
#!/usr/bin/python
import roslib; roslib.load_manifest('hrl_lib'); import rospy
# from hrl_lib.msg import String
# from hrl_lib.msg import RFID_Interface
import hrl_lib.util as ut
import hrl_lib.rutils as ru
import time
import pygame
import pygame.display
import pygame.locals
import pygame.transform
import numpy as np, math
class ROS_UI_Robot():
def __init__(self, init=True):
if init:
try:
print 'Initializing RFID UI on Robot'
rospy.init_node('RFID_UI_Robot',anonymous=True)
except rospy.ROSException:
pass
self.tag_pub = rospy.Publisher('/hrl/ele/UI_Robot',RFID_Interface)
print 'RFID UI on Robot Running'
print 'Connecting to RFID UI on PC'
self.selected_tag = ''
self.selection = []
rospy.Subscriber('/hrl/ele/UI_PC_Selection', RFID_Interface, self.selection_cb, None, 1)
# def publish_tag_ids(self, tagIDs):
# ''' tagIDs is a list of strings '''
# for tag in tagIDs:
# rt = String()
# rt.data = tag
# self.tag_pub.publish( rt )
# time.sleep(0.2)
# rt.data = '-1'
# self.tag_pub.publish( rt )
# time.sleep(0.002)
def publish_tag_ids(self, tagIDs):
pub_msg = RFID_Interface()
pub_msg.tagIDs = tagIDs
pub_msg.humanread = []
pub_msg.actions = []
self.tag_pub.publish( pub_msg )
time.sleep(0.002)
# def selection_cb(self, pc_msg):
# self.selected_tag = pc_msg.data
# print 'Received tag selection from UI: ', self.selected_tag
# return self.selected_tag
def selection_cb(self, rfid_msg):
tagID = rfid_msg.tagIDs[0]
action = rfid_msg.actions[0]
humanread = rfid_msg.humanread[0]
self.selection = [tagID, humanread, action]
#print 'Received selection from UI: ', self.selection
def receive_response(self):
while self.selection == []:
time.sleep(0.02)
rv = self.selection
self.selection = []
return rv
# def receive_response(self):
# rt = String()
# rt = self.listener.read()
# return rt.data
class ROS_UI_PC():
def __init__(self, init=True, graphical=False):
if init:
try:
print 'Initializing RFID UI on PC'
rospy.init_node('RFID_UI_PC',anonymous=True)
except rospy.ROSException:
pass
#self.tag_pub = rospy.Publisher('/hrl/ele/UI_PC',String)
self.ui_selection = rospy.Publisher('/hrl/ele/UI_PC_Selection',RFID_Interface)
print 'RFID UI on PC Running'
print 'Connecting to RFID UI on Robot'
#rospy.Subscriber('/hrl/ele/UI_Robot', String, self.selection_cb, None, 1)
rospy.Subscriber('/hrl/ele/UI_Robot', RFID_Interface, self.process_robot_request, None, 1)
# self.listener = ru.GenericListener('RFID_UI_Robot', String,
# '/hrl/ele/UI_Robot', 20)
self.ids = []
self.ids_done = False
self.graphical = graphical
self.images_db = '/home/travis/svn/robot1/src/projects/08_03_dog_commands/images_db/'
self.pps_db = ut.load_pickle('/home/travis/svn/robot1/src/projects/08_03_dog_commands/ele_rfid.pickle')
def process_robot_request(self, rfid_interface_msg):
msg = rfid_interface_msg
# Get data out of msg to prevent overwriting!
# From the robot, msg: tagIDs = ['id1','id2',...], humanread = [], actions = []
tagIDs = msg.tagIDs
humanread = []
actions = []
# Remote interface is responsible for populating other categories
ids_in_pps = []
for i, tag in enumerate( tagIDs ):
if self.pps_db.has_key( tag ):
ids_in_pps.append( tag )
humanread.append( self.pps_db[tag]['properties']['name'] )
acts = self.pps_db[tag]['actions'].keys()
actions.append( acts )
# else:
# humanread.append( tag )
# actions.append( ['fetch'] )
# Get the selection (returned as RFID_Interface message)
if self.graphical:
selection = self.get_selection_graphical( ids_in_pps, humanread, actions )
else:
selection = self.get_selection_text( ids_in_pps, humanread, actions )
# Publish the message
self.ui_selection.publish( selection )
print '\n\n Waiting for next request... \n\n'
def get_selection_text( self, tagIDs, humanread, actions ):
print '\n\nSelect a tag:'
if len(tagIDs) == 1:
print '\tOnly one option available: ', humanread[0]
tag_ind = 0
else:
for i, tag in enumerate( tagIDs ):
print '\t(%d) %s' % (i, humanread[i])
tag_ind = int(raw_input())
print 'Select an action for that tag:'
if len( actions[tag_ind] ) == 1:
print '\tOnly one option available: ', actions[tag_ind][0]
act_ind = 0
else:
for i, act in enumerate( actions[tag_ind] ):
print '\t(%d) %s' % (i, actions[tag_ind][i])
act_ind = int(raw_input())
retmsg = RFID_Interface()
retmsg.tagIDs = [ tagIDs[tag_ind] ]
retmsg.humanread = [ humanread[tag_ind] ]
retmsg.actions = [ actions[tag_ind][act_ind] ]
return retmsg
def smart_scale(self, image):
ims = np.array(image.get_size(),dtype='float')
scale = self.imheight / np.max(ims)
return pygame.transform.scale(image, tuple(ims*scale))
def calc_blit_loc(self, image, center_pos):
ims = np.array(image.get_size(), dtype='float')
horiz = center_pos[0] - self.imheight/2 + (self.imheight - ims[0]) / 2.
vert = center_pos[1] - self.imheight/2 + (self.imheight - ims[1]) / 2.
return (horiz, vert)
def get_selection_graphical(self, tagIDs, humanread, actions):
pygame.init()
self.s_width = 600
self.s_height = 700
srf = pygame.display.set_mode((self.s_width,self.s_height))
fps = 100
loopFlag = True
clk = pygame.time.Clock()
obj = [srf, fps, clk]
self.imheight = 175.
w = self.s_width * 1.0
h = self.s_height * 1.0
blit_pos = [[ w/3-w/6, h/3-h/6],
[ w/3-w/6+w/3, h/3-h/6],
[ w/3-w/6+2*w/3, h/3-h/6],
[ w/3-w/6, h/3-h/6+h/3],
[ w/3-w/6+w/3, h/3-h/6+h/3],
[ w/3-w/6+2*w/3, h/3-h/6+h/3],
[ w/3-w/6, h/3-h/6+2*h/3],
[ w/3-w/6+w/3, h/3-h/6+2*h/3],
[ w/3-w/6+2*w/3, h/3-h/6+2*h/3]]
tag_images = []
tag_surfaces = []
blit_loc = []
for i, tag in enumerate(tagIDs):
print 'Loading image for tag ', tag
tag_image = pygame.image.load(self.images_db + tag + '.jpg').convert()
tag_image = self.smart_scale(tag_image)
tag_images.append( tag_image )
blit_loc.append( blit_pos[i] )
#pygame.display.set_mode(tag_images[i].get_size())
#tag_surfaces.append(pygame.display.get_surface())
srf.blit(tag_image, self.calc_blit_loc(tag_image,blit_loc[i]))
tag_ind = self.get_selection( obj, tag_images, humanread, blit_loc )
print 'Selected tag ', tag_ind, ': ', humanread[tag_ind]
act_images = []
act_surfaces = []
blit_loc = []
for i, act in enumerate(actions[tag_ind]):
print 'Loading image for act ', act
act_image = pygame.image.load(self.images_db + tag + act + '.jpg').convert()
act_image = self.smart_scale(act_image)
act_images.append( act_image )
blit_loc.append( blit_pos[i] )
#pygame.display.set_mode(tag_images[i].get_size())
#tag_surfaces.append(pygame.display.get_surface())
srf.blit(act_image, self.calc_blit_loc(tag_image,blit_loc[i]))
act_ind = self.get_selection( obj, act_images, actions[tag_ind], blit_loc )
print 'Selected action ', act_ind, ': ', actions[tag_ind][act_ind]
retmsg = RFID_Interface()
retmsg.tagIDs = [ tagIDs[tag_ind] ]
retmsg.humanread = [ humanread[tag_ind] ]
retmsg.actions = [ actions[tag_ind][act_ind] ]
return retmsg
def put_bottom_text( self, srf, text ):
font = pygame.font.Font(None, 25)
box = font.render(text, 1,(10, 10, 10, 0))
ts = box.get_size()
horiz = self.s_width / 2.0 - ts[0]/2.0
vt = self.s_height - 50.0 - ts[1]/2.0
srf.blit(box, (horiz, vt))
return True
def draw_rect(self, srf, blit_loc):
width = self.imheight * 1.10
height = self.imheight *1.10
horiz = blit_loc[0] - width / 2.0
vert = blit_loc[1] - height / 2.0
pygame.draw.rect(srf, (255, 0, 0), (horiz, vert, width, height))
width = self.imheight * 1.01
height = self.imheight *1.01
horiz = blit_loc[0] - width / 2.0
vert = blit_loc[1] - height / 2.0
pygame.draw.rect(srf, (255, 255, 255), (horiz, vert, width, height))
return True
def get_selection( self, obj, images, humanread, blit_loc ):
[srf, fps, clk] = obj
loopFlag = True
ind = 0
pos = (0,0)
while loopFlag:
# Clear the screen
srf.fill((255,255,255))
diffs = np.array(blit_loc) - np.array(pos)
ind = np.argmin( ut.norm( diffs.T ))
self.put_bottom_text( srf, humanread[ind] )
self.draw_rect(srf, blit_loc[ind])
for i, image in enumerate(images):
srf.blit(image, self.calc_blit_loc(image,blit_loc[i]))
#print 'going'
pygame.display.flip()
events = pygame.event.get()
for e in events:
if e.type==pygame.locals.QUIT:
loopFlag=False
if e.type==pygame.locals.KEYDOWN:
if e.key == 27: # Esc
loopFlag=False
if e.type == pygame.locals.MOUSEMOTION:
pos = e.pos
if e.type==pygame.locals.MOUSEBUTTONDOWN:
if e.button == 1:
# left button
pos = e.pos
diffs = np.array(blit_loc) - np.array(pos)
ind = np.argmin( ut.norm( diffs.T ))
loopFlag = False
clk.tick(fps)
srf.fill((255,255,255))
pygame.display.flip()
clk.tick(fps)
return ind
# pc = ROS_UI_PC(init = False, graphical = True)
# pc.get_selection_graphical(['LightSwitch1','LightSwitch1'],
# ['lightswitch','LightSwitch1'],
# [['on','off'],['on','off']])
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('-d', action='store_true', dest='graphical',
help='Use a graphical display.')
p.add_option('-g', action='store_true', dest='client',
help='Build Client?', default=False)
opt, args = p.parse_args()
if opt.client:
pc = ROS_UI_PC(graphical = opt.graphical)
pc.get_selection_graphical( ['person '
rospy.spin()
else:
ro = ROS_UI_Robot()
ro.publish_tag_ids([ 'one', 'two', 'hello' ])
ro.receive_response()
# while True:
# print 'Waiting for robot action(s)...\n'
# pc.publish_selected_id()
# pc.ids = []
# pc.ids_done = False
# On the Robot's side:
# ro = ROS_UI_Robot()
# ro.publish_tag_ids(['one','two','hello'])
# ro.receive_response()
| ajibawa-2023/Python-Code-Large/train/row_99455 | 210 | 326 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0031, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_lib'); import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L3_C15", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0092, 0.0031, 0, 0.66, 0.0769, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_lib'); import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L3_C48", "label": "rospy import rospy", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0031, 0, 0.66, 0.1538, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_lib'); import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L6_C0", "label": "hrl_lib.util import ut", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0184, 0.0031, 0, 0.66, 0.2308, 775, 0, 1, 0, 0, 775, 0, 0], "semantic": {"name": "hrl_lib.util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.util as ut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L7_C0", "label": "hrl_lib.rutils import ru", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0215, 0.0031, 0, 0.66, 0.3077, 847, 0, 1, 0, 0, 847, 0, 0], "semantic": {"name": "hrl_lib.rutils", "arg_names": [], "import_names": ["ru"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.rutils as ru"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L8_C0", "label": "time import time", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0245, 0.0031, 0, 0.66, 0.3846, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L9_C0", "label": "pygame import pygame", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0276, 0.0031, 0, 0.66, 0.4615, 87, 0, 1, 0, 0, 87, 0, 0], "semantic": {"name": "pygame", "arg_names": [], "import_names": ["pygame"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pygame"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L10_C0", "label": "pygame.display import pygame.display", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0307, 0.0031, 0, 0.66, 0.5385, 724, 0, 1, 0, 0, 724, 0, 0], "semantic": {"name": "pygame.display", "arg_names": [], "import_names": ["pygame.display"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pygame.display"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L11_C0", "label": "pygame.locals import pygame.locals", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0337, 0.0031, 0, 0.66, 0.6154, 515, 0, 1, 0, 0, 515, 0, 0], "semantic": {"name": "pygame.locals", "arg_names": [], "import_names": ["pygame.locals"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pygame.locals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L12_C0", "label": "pygame.transform import pygame.transform", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0368, 0.0031, 0, 0.66, 0.6923, 35, 0, 1, 0, 0, 35, 0, 0], "semantic": {"name": "pygame.transform", "arg_names": [], "import_names": ["pygame.transform"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pygame.transform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L13_C0", "label": "numpy import np, math", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0399, 0.0031, 0, 0.66, 0.7692, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "label": "ROS_UI_Robot", "type": "class", "loc": [16, 67], "level": 0, "parent": null, "vector": [3, 0, 0.1273, 0.1595, 0, 0.66, 0.8462, 953, 0, 4, 0, 0, 0, 0, 10], "semantic": {"name": "ROS_UI_Robot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ROS_UI_Robot():\n def __init__(self, init=True):\n if init:\n try:\n print('Initializing RFID UI on Robot')\n rospy.init_node('RFID_UI_Robot',anonymous=True)\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "label": "__init__", "type": "function", "loc": [17, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "vector": [2, 1, 0.0721, 0.0429, 1, 0.94, 0.0, 555, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "init"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, init=True):\n if init:\n try:\n print('Initializing RFID UI on Robot')\n rospy.init_node('RFID_UI_Robot',anonymous=True)\n except rospy.ROSException:\n pass\n self.tag_pub = rospy.Publisher('/hrl/ele/UI_Robot',RFID_Interface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L18_C8", "label": "if", "type": "if", "loc": [18, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "vector": [4, 2, 0.0629, 0.0184, 2, 0.84, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if init:\n try:\n print('Initializing RFID UI on Robot')\n rospy.init_node('RFID_UI_Robot',anonymous=True)\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L19_C12", "label": "try", "type": "try", "loc": [19, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L18_C8", "vector": [7, 3, 0.0644, 0.0153, 3, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n print('Initializing RFID UI on Robot')\n rospy.init_node('RFID_UI_Robot',anonymous=True)\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L20_C16", "label": "print()", "type": "expression", "loc": [20, 20], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L19_C12", "vector": [8, 4, 0.0613, 0.0031, 4, 0.45, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Initializing RFID UI on Robot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L21_C16", "label": "init_node()", "type": "expression", "loc": [21, 21], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L19_C12", "vector": [8, 4, 0.0644, 0.0031, 4, 0.45, 1.0, 463, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('RFID_UI_Robot',anonymous=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L24_C8", "label": "self.tag_pub = Publisher()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "vector": [14, 2, 0.0736, 0.0031, 2, 0.84, 0.1667, 716, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.tag_pub", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.tag_pub = rospy.Publisher('/hrl/ele/UI_Robot',RFID_Interface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L25_C8", "label": "print()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "vector": [8, 2, 0.0767, 0.0031, 2, 0.84, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('RFID UI on Robot Running')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L27_C8", "label": "print()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "vector": [8, 2, 0.0828, 0.0031, 2, 0.84, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Connecting to RFID UI on PC')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L28_C8", "label": "self.selected_tag =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "vector": [14, 2, 0.0859, 0.0031, 2, 0.84, 0.6667, 877, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.selected_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.selected_tag = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L29_C8", "label": "self.selection =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "vector": [14, 2, 0.089, 0.0031, 2, 0.84, 0.8333, 779, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.selection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.selection = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L30_C8", "label": "Subscriber()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "vector": [8, 2, 0.092, 0.0031, 2, 0.84, 1.0, 455, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber('/hrl/ele/UI_PC_Selection', RFID_Interface, self.selection_cb, None, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "label": "publish_tag_ids", "type": "function", "loc": [42, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "vector": [2, 1, 0.1396, 0.0245, 1, 0.94, 0.3333, 891, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "publish_tag_ids", "arg_names": ["self", "tagIDs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def publish_tag_ids(self, tagIDs):\n pub_msg = RFID_Interface()\n pub_msg.tagIDs = tagIDs\n pub_msg.humanread = []\n pub_msg.actions = []\n\n self.tag_pub.publish( pub_msg )\n time.sleep(0.002)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L43_C8", "label": "pub_msg = RFID_Interface()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "vector": [14, 2, 0.1319, 0.0031, 2, 0.92, 0.0, 787, 3, 0, 0, 0, 197, 10, 1], "semantic": {"name": "pub_msg", "arg_names": [], "import_names": [], "rhs_call_name": "RFID_Interface", "annotation": ""}, "snippet": " pub_msg = RFID_Interface()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L44_C8", "label": "pub_msg.tagIDs =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "vector": [14, 2, 0.135, 0.0031, 2, 0.92, 0.2, 387, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pub_msg.tagIDs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pub_msg.tagIDs = tagIDs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L45_C8", "label": "pub_msg.humanread =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "vector": [14, 2, 0.138, 0.0031, 2, 0.92, 0.4, 878, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pub_msg.humanread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pub_msg.humanread = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L46_C8", "label": "pub_msg.actions =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "vector": [14, 2, 0.1411, 0.0031, 2, 0.92, 0.6, 739, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pub_msg.actions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pub_msg.actions = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L48_C8", "label": "publish()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "vector": [8, 2, 0.1472, 0.0031, 2, 0.92, 0.8, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.tag_pub.publish( pub_msg )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L49_C8", "label": "sleep()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "vector": [8, 2, 0.1503, 0.0031, 2, 0.92, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.002)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "label": "selection_cb", "type": "function", "loc": [55, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "vector": [2, 1, 0.1748, 0.0153, 1, 0.94, 0.6667, 748, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "selection_cb", "arg_names": ["self", "rfid_msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def selection_cb(self, rfid_msg):\n tagID = rfid_msg.tagIDs[0]\n action = rfid_msg.actions[0]\n humanread = rfid_msg.humanread[0]\n self.selection = [tagID, humanread, action]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L56_C8", "label": "tagID =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "vector": [14, 2, 0.1718, 0.0031, 2, 0.4, 0.0, 904, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tagID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tagID = rfid_msg.tagIDs[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L57_C8", "label": "action =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "vector": [14, 2, 0.1748, 0.0031, 2, 0.4, 0.3333, 422, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "action", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " action = rfid_msg.actions[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L58_C8", "label": "humanread =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "vector": [14, 2, 0.1779, 0.0031, 2, 0.4, 0.6667, 351, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "humanread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " humanread = rfid_msg.humanread[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L59_C8", "label": "self.selection =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "vector": [14, 2, 0.181, 0.0031, 2, 0.4, 1.0, 779, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.selection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.selection = [tagID, humanread, action]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "label": "receive_response", "type": "function", "loc": [62, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "vector": [2, 1, 0.1979, 0.0184, 1, 0.94, 1.0, 13, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "receive_response", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def receive_response(self):\n while self.selection == []:\n time.sleep(0.02)\n rv = self.selection\n self.selection = []\n return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L63_C8", "label": "while", "type": "while", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "vector": [5, 2, 0.1948, 0.0061, 2, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.selection == []:\n time.sleep(0.02)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L64_C12", "label": "sleep()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L63_C8", "vector": [8, 3, 0.1963, 0.0031, 3, 0.5, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.02)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L65_C8", "label": "rv =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "vector": [14, 2, 0.1994, 0.0031, 2, 0.16, 0.3333, 222, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rv = self.selection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L66_C8", "label": "self.selection =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "vector": [14, 2, 0.2025, 0.0031, 2, 0.16, 0.6667, 779, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.selection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.selection = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "vector": [13, 2, 0.2055, 0.0031, 2, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "label": "ROS_UI_PC", "type": "class", "loc": [74, 289], "level": 0, "parent": null, "vector": [3, 0, 0.5567, 0.6626, 0, 0.66, 0.9231, 256, 0, 9, 0, 0, 0, 0, 91], "semantic": {"name": "ROS_UI_PC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ROS_UI_PC():\n def __init__(self, init=True, graphical=False):\n if init:\n try:\n print('Initializing RFID UI on PC')\n rospy.init_node('RFID_UI_PC',anonymous=True)\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "label": "__init__", "type": "function", "loc": [75, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.2607, 0.0644, 1, 0.83, 0.0, 555, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "init", "graphical"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, init=True, graphical=False):\n if init:\n try:\n print('Initializing RFID UI on PC')\n rospy.init_node('RFID_UI_PC',anonymous=True)\n except rospy.ROSException:\n pass\n #self.tag_pub = rospy.Publisher('/hrl/ele/UI_PC',String)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L76_C8", "label": "if", "type": "if", "loc": [76, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [4, 2, 0.2408, 0.0184, 2, 0.34, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if init:\n try:\n print('Initializing RFID UI on PC')\n rospy.init_node('RFID_UI_PC',anonymous=True)\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L77_C12", "label": "try", "type": "try", "loc": [77, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L76_C8", "vector": [7, 3, 0.2423, 0.0153, 3, 0.82, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n print('Initializing RFID UI on PC')\n rospy.init_node('RFID_UI_PC',anonymous=True)\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L78_C16", "label": "print()", "type": "expression", "loc": [78, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L77_C12", "vector": [8, 4, 0.2393, 0.0031, 4, 0.65, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Initializing RFID UI on PC')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L79_C16", "label": "init_node()", "type": "expression", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L77_C12", "vector": [8, 4, 0.2423, 0.0031, 4, 0.65, 1.0, 463, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('RFID_UI_PC',anonymous=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L83_C8", "label": "self.ui_selection = Publisher()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [14, 2, 0.2546, 0.0031, 2, 0.34, 0.1111, 319, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.ui_selection", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.ui_selection = rospy.Publisher('/hrl/ele/UI_PC_Selection',RFID_Interface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L84_C8", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [8, 2, 0.2577, 0.0031, 2, 0.34, 0.2222, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('RFID UI on PC Running')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L86_C8", "label": "print()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [8, 2, 0.2638, 0.0031, 2, 0.34, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Connecting to RFID UI on Robot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L88_C8", "label": "Subscriber()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [8, 2, 0.2699, 0.0031, 2, 0.34, 0.4444, 455, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber('/hrl/ele/UI_Robot', RFID_Interface, self.process_robot_request, None, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L91_C8", "label": "self.ids =", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [14, 2, 0.2791, 0.0031, 2, 0.34, 0.5556, 806, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ids = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L92_C8", "label": "self.ids_done =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [14, 2, 0.2822, 0.0031, 2, 0.34, 0.6667, 60, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.ids_done", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ids_done = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L93_C8", "label": "self.graphical =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [14, 2, 0.2853, 0.0031, 2, 0.34, 0.7778, 482, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.graphical", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.graphical = graphical"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L94_C8", "label": "self.images_db =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [14, 2, 0.2883, 0.0031, 2, 0.34, 0.8889, 59, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.images_db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.images_db = '/home/travis/svn/robot1/src/projects/08_03_dog_commands/images_db/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L95_C8", "label": "self.pps_db = load_pickle()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "vector": [14, 2, 0.2914, 0.0031, 2, 0.34, 1.0, 893, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "self.pps_db", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " self.pps_db = ut.load_pickle('/home/travis/svn/robot1/src/projects/08_03_dog_commands/ele_rfid.pickle')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "label": "process_robot_request", "type": "function", "loc": [97, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.3451, 0.0982, 1, 0.83, 0.125, 177, 0, 2, 0, 0, 0, 0, 10], "semantic": {"name": "process_robot_request", "arg_names": ["self", "rfid_interface_msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_robot_request(self, rfid_interface_msg):\n msg = rfid_interface_msg\n\n # Get data out of msg to prevent overwriting!\n # From the robot, msg: tagIDs = ['id1','id2',...], humanread = [], actions = []\n tagIDs = msg.tagIDs\n humanread = []\n actions = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L98_C8", "label": "msg =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [14, 2, 0.3006, 0.0031, 2, 0.79, 0.0, 712, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = rfid_interface_msg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L102_C8", "label": "tagIDs =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [14, 2, 0.3129, 0.0031, 2, 0.79, 0.125, 572, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tagIDs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tagIDs = msg.tagIDs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L103_C8", "label": "humanread =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [14, 2, 0.316, 0.0031, 2, 0.79, 0.25, 351, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "humanread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " humanread = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L104_C8", "label": "actions =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [14, 2, 0.319, 0.0031, 2, 0.79, 0.375, 317, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "actions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " actions = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L109_C8", "label": "ids_in_pps =", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [14, 2, 0.3344, 0.0031, 2, 0.79, 0.5, 251, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ids_in_pps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ids_in_pps = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L110_C8", "label": "for i, tag", "type": "for", "loc": [110, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [6, 2, 0.3451, 0.0184, 2, 0.79, 0.625, 592, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i, tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, tag in enumerate( tagIDs ):\n if self.pps_db.has_key( tag ):\n ids_in_pps.append( tag )\n humanread.append( self.pps_db[tag]['properties']['name'] )\n acts = self.pps_db[tag]['actions'].keys()\n actions.append( acts )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "label": "if", "type": "if", "loc": [111, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L110_C8", "vector": [4, 3, 0.3466, 0.0153, 3, 0.52, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.pps_db.has_key( tag ):\n ids_in_pps.append( tag )\n humanread.append( self.pps_db[tag]['properties']['name'] )\n acts = self.pps_db[tag]['actions'].keys()\n actions.append( acts )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L112_C16", "label": "append()", "type": "expression", "loc": [112, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "vector": [8, 4, 0.3436, 0.0031, 4, 0.65, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ids_in_pps.append( tag )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L113_C16", "label": "append()", "type": "expression", "loc": [113, 113], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "vector": [8, 4, 0.3466, 0.0031, 4, 0.65, 0.3333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " humanread.append( self.pps_db[tag]['properties']['name'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L114_C16", "label": "acts = keys()", "type": "assigned_variable", "loc": [114, 114], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "vector": [14, 4, 0.3497, 0.0031, 4, 0.65, 0.6667, 329, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "acts", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " acts = self.pps_db[tag]['actions'].keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L115_C16", "label": "append()", "type": "expression", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "vector": [8, 4, 0.3528, 0.0031, 4, 0.65, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " actions.append( acts )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L121_C8", "label": "if", "type": "if", "loc": [121, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [4, 2, 0.3758, 0.0123, 2, 0.79, 0.75, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.graphical:\n selection = self.get_selection_graphical( ids_in_pps, humanread, actions )\n else:\n selection = self.get_selection_text( ids_in_pps, humanread, actions )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L122_C12", "label": "selection = get_selection_graphical()", "type": "assigned_variable", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L121_C8", "vector": [14, 3, 0.3742, 0.0031, 3, 0.88, 0.0, 441, 3, 3, 0, 0, 653, 10, 1], "semantic": {"name": "selection", "arg_names": [], "import_names": [], "rhs_call_name": "get_selection_graphical", "annotation": ""}, "snippet": " selection = self.get_selection_graphical( ids_in_pps, humanread, actions )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L124_C12", "label": "selection = get_selection_text()", "type": "assigned_variable", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L121_C8", "vector": [14, 3, 0.3804, 0.0031, 3, 0.88, 1.0, 441, 3, 3, 0, 0, 935, 10, 1], "semantic": {"name": "selection", "arg_names": [], "import_names": [], "rhs_call_name": "get_selection_text", "annotation": ""}, "snippet": " selection = self.get_selection_text( ids_in_pps, humanread, actions )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L127_C8", "label": "publish()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [8, 2, 0.3896, 0.0031, 2, 0.79, 0.875, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.ui_selection.publish( selection )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L128_C8", "label": "print()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "vector": [8, 2, 0.3926, 0.0031, 2, 0.79, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\n\\n Waiting for next request... \\n\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "label": "get_selection_text", "type": "function", "loc": [131, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.4371, 0.0736, 1, 0.83, 0.25, 935, 0, 4, 1, 0, 0, 0, 15], "semantic": {"name": "get_selection_text", "arg_names": ["self", "tagIDs", "humanread", "actions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_selection_text( self, tagIDs, humanread, actions ):\n print('\\n\\nSelect a tag:')\n if len(tagIDs) == 1:\n print('\\tOnly one option available: ', humanread[0])\n tag_ind = 0\n else:\n for i, tag in enumerate( tagIDs ):\n print('\\t(%d) %s' % (i, humanread[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L132_C8", "label": "print()", "type": "expression", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [8, 2, 0.4049, 0.0031, 2, 0.54, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\n\\nSelect a tag:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "label": "if", "type": "if", "loc": [133, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [4, 2, 0.4172, 0.0215, 2, 0.54, 0.125, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(tagIDs) == 1:\n print('\\tOnly one option available: ', humanread[0])\n tag_ind = 0\n else:\n for i, tag in enumerate( tagIDs ):\n print('\\t(%d) %s' % (i, humanread[i]))\n tag_ind = int(raw_input())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L134_C12", "label": "print()", "type": "expression", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "vector": [8, 3, 0.411, 0.0031, 3, 0.49, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tOnly one option available: ', humanread[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L135_C12", "label": "tag_ind =", "type": "assigned_variable", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "vector": [14, 3, 0.4141, 0.0031, 3, 0.49, 0.3333, 373, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tag_ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag_ind = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L137_C12", "label": "for i, tag", "type": "for", "loc": [137, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "vector": [6, 3, 0.4218, 0.0061, 3, 0.49, 0.6667, 592, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i, tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, tag in enumerate( tagIDs ):\n print('\\t(%d) %s' % (i, humanread[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L138_C16", "label": "print()", "type": "expression", "loc": [138, 138], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L137_C12", "vector": [8, 4, 0.4233, 0.0031, 4, 0.24, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\t(%d) %s' % (i, humanread[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L139_C12", "label": "tag_ind = int()", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "vector": [14, 3, 0.4264, 0.0031, 3, 0.49, 1.0, 373, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "tag_ind", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " tag_ind = int(raw_input())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L141_C8", "label": "print()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [8, 2, 0.4325, 0.0031, 2, 0.54, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Select an action for that tag:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "label": "if", "type": "if", "loc": [142, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [4, 2, 0.4448, 0.0215, 2, 0.54, 0.375, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len( actions[tag_ind] ) == 1:\n print('\\tOnly one option available: ', actions[tag_ind][0])\n act_ind = 0\n else:\n for i, act in enumerate( actions[tag_ind] ):\n print('\\t(%d) %s' % (i, actions[tag_ind][i]))\n act_ind = int(raw_input())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L143_C12", "label": "print()", "type": "expression", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "vector": [8, 3, 0.4387, 0.0031, 3, 0.93, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\tOnly one option available: ', actions[tag_ind][0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L144_C12", "label": "act_ind =", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "vector": [14, 3, 0.4417, 0.0031, 3, 0.93, 0.3333, 841, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "act_ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " act_ind = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L146_C12", "label": "for i, act", "type": "for", "loc": [146, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "vector": [6, 3, 0.4494, 0.0061, 3, 0.93, 0.6667, 879, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i, act", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, act in enumerate( actions[tag_ind] ):\n print('\\t(%d) %s' % (i, actions[tag_ind][i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L147_C16", "label": "print()", "type": "expression", "loc": [147, 147], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L146_C12", "vector": [8, 4, 0.4509, 0.0031, 4, 0.15, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\t(%d) %s' % (i, actions[tag_ind][i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L148_C12", "label": "act_ind = int()", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "vector": [14, 3, 0.454, 0.0031, 3, 0.93, 1.0, 841, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "act_ind", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " act_ind = int(raw_input())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L150_C8", "label": "retmsg = RFID_Interface()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [14, 2, 0.4601, 0.0031, 2, 0.54, 0.5, 422, 3, 0, 0, 0, 197, 10, 1], "semantic": {"name": "retmsg", "arg_names": [], "import_names": [], "rhs_call_name": "RFID_Interface", "annotation": ""}, "snippet": " retmsg = RFID_Interface()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L151_C8", "label": "retmsg.tagIDs =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [14, 2, 0.4632, 0.0031, 2, 0.54, 0.625, 995, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "retmsg.tagIDs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " retmsg.tagIDs = [ tagIDs[tag_ind] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L152_C8", "label": "retmsg.humanread =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [14, 2, 0.4663, 0.0031, 2, 0.54, 0.75, 869, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "retmsg.humanread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " retmsg.humanread = [ humanread[tag_ind] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L153_C8", "label": "retmsg.actions =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [14, 2, 0.4693, 0.0031, 2, 0.54, 0.875, 821, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "retmsg.actions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " retmsg.actions = [ actions[tag_ind][act_ind] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L154_C8", "label": "return", "type": "return", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "vector": [13, 2, 0.4724, 0.0031, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return retmsg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L156_C4", "label": "smart_scale", "type": "function", "loc": [156, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.4831, 0.0123, 1, 0.83, 0.375, 642, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "smart_scale", "arg_names": ["self", "image"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def smart_scale(self, image):\n ims = np.array(image.get_size(),dtype='float')\n scale = self.imheight / np.max(ims)\n return pygame.transform.scale(image, tuple(ims*scale))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L157_C8", "label": "ims = array()", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L156_C4", "vector": [14, 2, 0.4816, 0.0031, 2, 0.31, 0.0, 526, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "ims", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " ims = np.array(image.get_size(),dtype='float')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L158_C8", "label": "scale =", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L156_C4", "vector": [14, 2, 0.4847, 0.0031, 2, 0.31, 0.5, 18, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "scale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scale = self.imheight / np.max(ims)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L159_C8", "label": "return", "type": "return", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L156_C4", "vector": [13, 2, 0.4877, 0.0031, 2, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pygame.transform.scale(image, tuple(ims*scale))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "label": "calc_blit_loc", "type": "function", "loc": [161, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.5, 0.0153, 1, 0.83, 0.5, 445, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "calc_blit_loc", "arg_names": ["self", "image", "center_pos"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def calc_blit_loc(self, image, center_pos):\n ims = np.array(image.get_size(), dtype='float')\n horiz = center_pos[0] - self.imheight/2 + (self.imheight - ims[0]) / 2.\n vert = center_pos[1] - self.imheight/2 + (self.imheight - ims[1]) / 2.\n return (horiz, vert)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L162_C8", "label": "ims = array()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "vector": [14, 2, 0.4969, 0.0031, 2, 0.77, 0.0, 526, 3, 2, 0, 0, 80, 10, 2], "semantic": {"name": "ims", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " ims = np.array(image.get_size(), dtype='float')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L163_C8", "label": "horiz =", "type": "assigned_variable", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "vector": [14, 2, 0.5, 0.0031, 2, 0.77, 0.3333, 492, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "horiz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " horiz = center_pos[0] - self.imheight/2 + (self.imheight - ims[0]) / 2."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L164_C8", "label": "vert =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "vector": [14, 2, 0.5031, 0.0031, 2, 0.77, 0.6667, 128, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vert", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vert = center_pos[1] - self.imheight/2 + (self.imheight - ims[1]) / 2."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L165_C8", "label": "return", "type": "return", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "vector": [13, 2, 0.5061, 0.0031, 2, 0.77, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (horiz, vert)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "label": "get_selection_graphical", "type": "function", "loc": [167, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.5982, 0.1748, 1, 0.83, 0.625, 653, 0, 4, 1, 0, 0, 0, 26], "semantic": {"name": "get_selection_graphical", "arg_names": ["self", "tagIDs", "humanread", "actions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_selection_graphical(self, tagIDs, humanread, actions):\n pygame.init()\n self.s_width = 600\n self.s_height = 700\n srf = pygame.display.set_mode((self.s_width,self.s_height))\n fps = 100\n loopFlag = True\n clk = pygame.time.Clock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L168_C8", "label": "init()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [8, 2, 0.5153, 0.0031, 2, 0.32, 0.0, 319, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init", "arg_names": [], "import_names": [], "rhs_call_name": "init", "annotation": ""}, "snippet": " pygame.init()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L169_C8", "label": "self.s_width =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5184, 0.0031, 2, 0.32, 0.0357, 540, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.s_width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.s_width = 600"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L170_C8", "label": "self.s_height =", "type": "assigned_variable", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5215, 0.0031, 2, 0.32, 0.0714, 50, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.s_height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.s_height = 700"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L171_C8", "label": "srf = set_mode()", "type": "assigned_variable", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5245, 0.0031, 2, 0.32, 0.1071, 820, 3, 1, 0, 0, 255, 10, 1], "semantic": {"name": "srf", "arg_names": [], "import_names": [], "rhs_call_name": "set_mode", "annotation": ""}, "snippet": " srf = pygame.display.set_mode((self.s_width,self.s_height))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L172_C8", "label": "fps =", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5276, 0.0031, 2, 0.32, 0.1429, 376, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "fps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fps = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L173_C8", "label": "loopFlag =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5307, 0.0031, 2, 0.32, 0.1786, 143, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "loopFlag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loopFlag = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L174_C8", "label": "clk = Clock()", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5337, 0.0031, 2, 0.32, 0.2143, 134, 3, 0, 0, 0, 725, 10, 1], "semantic": {"name": "clk", "arg_names": [], "import_names": [], "rhs_call_name": "Clock", "annotation": ""}, "snippet": " clk = pygame.time.Clock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L175_C8", "label": "obj =", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5368, 0.0031, 2, 0.32, 0.25, 505, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj = [srf, fps, clk]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L176_C8", "label": "self.imheight =", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5399, 0.0031, 2, 0.32, 0.2857, 794, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.imheight", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.imheight = 175."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L178_C8", "label": "w =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.546, 0.0031, 2, 0.32, 0.3214, 549, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.s_width * 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L179_C8", "label": "h =", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5491, 0.0031, 2, 0.32, 0.3571, 686, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h = self.s_height * 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L180_C8", "label": "blit_pos =", "type": "assigned_variable", "loc": [180, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5644, 0.0276, 2, 0.32, 0.3929, 600, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "blit_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blit_pos = [[ w/3-w/6, h/3-h/6],\n [ w/3-w/6+w/3, h/3-h/6],\n [ w/3-w/6+2*w/3, h/3-h/6],\n [ w/3-w/6, h/3-h/6+h/3],\n [ w/3-w/6+w/3, h/3-h/6+h/3],\n [ w/3-w/6+2*w/3, h/3-h/6+h/3],\n [ w/3-w/6, h/3-h/6+2*h/3],\n [ w/3-w/6+w/3, h/3-h/6+2*h/3],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L189_C8", "label": "tag_images =", "type": "assigned_variable", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5798, 0.0031, 2, 0.32, 0.4286, 774, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "tag_images", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag_images = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L190_C8", "label": "tag_surfaces =", "type": "assigned_variable", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5828, 0.0031, 2, 0.32, 0.4643, 654, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "tag_surfaces", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag_surfaces = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L191_C8", "label": "blit_loc =", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.5859, 0.0031, 2, 0.32, 0.5, 210, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "blit_loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blit_loc = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "label": "for i, tag", "type": "for", "loc": [192, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [6, 2, 0.6012, 0.0276, 2, 0.32, 0.5357, 592, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "i, tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, tag in enumerate(tagIDs):\n print('Loading image for tag ', tag)\n tag_image = pygame.image.load(self.images_db + tag + '.jpg').convert()\n tag_image = self.smart_scale(tag_image)\n tag_images.append( tag_image )\n blit_loc.append( blit_pos[i] )\n #pygame.display.set_mode(tag_images[i].get_size())\n #tag_surfaces.append(pygame.display.get_surface())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L193_C12", "label": "print()", "type": "expression", "loc": [193, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "vector": [8, 3, 0.592, 0.0031, 3, 0.57, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading image for tag ', tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L194_C12", "label": "tag_image = convert()", "type": "assigned_variable", "loc": [194, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "vector": [14, 3, 0.5951, 0.0031, 3, 0.57, 0.2, 424, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "tag_image", "arg_names": [], "import_names": [], "rhs_call_name": "convert", "annotation": ""}, "snippet": " tag_image = pygame.image.load(self.images_db + tag + '.jpg').convert()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L195_C12", "label": "tag_image = smart_scale()", "type": "assigned_variable", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "vector": [14, 3, 0.5982, 0.0031, 3, 0.57, 0.4, 424, 3, 1, 0, 0, 642, 10, 1], "semantic": {"name": "tag_image", "arg_names": [], "import_names": [], "rhs_call_name": "smart_scale", "annotation": ""}, "snippet": " tag_image = self.smart_scale(tag_image)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L196_C12", "label": "append()", "type": "expression", "loc": [196, 196], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "vector": [8, 3, 0.6012, 0.0031, 3, 0.57, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " tag_images.append( tag_image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L197_C12", "label": "append()", "type": "expression", "loc": [197, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "vector": [8, 3, 0.6043, 0.0031, 3, 0.57, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blit_loc.append( blit_pos[i] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L200_C12", "label": "blit()", "type": "expression", "loc": [200, 200], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "vector": [8, 3, 0.6135, 0.0031, 3, 0.57, 1.0, 951, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "blit", "arg_names": [], "import_names": [], "rhs_call_name": "blit", "annotation": ""}, "snippet": " srf.blit(tag_image, self.calc_blit_loc(tag_image,blit_loc[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L201_C8", "label": "tag_ind = get_selection()", "type": "assigned_variable", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.6166, 0.0031, 2, 0.32, 0.5714, 373, 3, 4, 0, 0, 365, 10, 1], "semantic": {"name": "tag_ind", "arg_names": [], "import_names": [], "rhs_call_name": "get_selection", "annotation": ""}, "snippet": " tag_ind = self.get_selection( obj, tag_images, humanread, blit_loc )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L202_C8", "label": "print()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [8, 2, 0.6196, 0.0031, 2, 0.32, 0.6071, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Selected tag ', tag_ind, ': ', humanread[tag_ind])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L204_C8", "label": "act_images =", "type": "assigned_variable", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.6258, 0.0031, 2, 0.32, 0.6429, 483, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "act_images", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " act_images = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L205_C8", "label": "act_surfaces =", "type": "assigned_variable", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.6288, 0.0031, 2, 0.32, 0.6786, 903, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "act_surfaces", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " act_surfaces = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L206_C8", "label": "blit_loc =", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.6319, 0.0031, 2, 0.32, 0.7143, 210, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "blit_loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blit_loc = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "label": "for i, act", "type": "for", "loc": [207, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [6, 2, 0.6472, 0.0276, 2, 0.32, 0.75, 879, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "i, act", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, act in enumerate(actions[tag_ind]):\n print('Loading image for act ', act)\n act_image = pygame.image.load(self.images_db + tag + act + '.jpg').convert()\n act_image = self.smart_scale(act_image)\n act_images.append( act_image )\n blit_loc.append( blit_pos[i] )\n #pygame.display.set_mode(tag_images[i].get_size())\n #tag_surfaces.append(pygame.display.get_surface())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L208_C12", "label": "print()", "type": "expression", "loc": [208, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "vector": [8, 3, 0.638, 0.0031, 3, 0.62, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Loading image for act ', act)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L209_C12", "label": "act_image = convert()", "type": "assigned_variable", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "vector": [14, 3, 0.6411, 0.0031, 3, 0.62, 0.2, 777, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "act_image", "arg_names": [], "import_names": [], "rhs_call_name": "convert", "annotation": ""}, "snippet": " act_image = pygame.image.load(self.images_db + tag + act + '.jpg').convert()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L210_C12", "label": "act_image = smart_scale()", "type": "assigned_variable", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "vector": [14, 3, 0.6442, 0.0031, 3, 0.62, 0.4, 777, 3, 1, 0, 0, 642, 10, 1], "semantic": {"name": "act_image", "arg_names": [], "import_names": [], "rhs_call_name": "smart_scale", "annotation": ""}, "snippet": " act_image = self.smart_scale(act_image)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L211_C12", "label": "append()", "type": "expression", "loc": [211, 211], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "vector": [8, 3, 0.6472, 0.0031, 3, 0.62, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " act_images.append( act_image )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L212_C12", "label": "append()", "type": "expression", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "vector": [8, 3, 0.6503, 0.0031, 3, 0.62, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blit_loc.append( blit_pos[i] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L215_C12", "label": "blit()", "type": "expression", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "vector": [8, 3, 0.6595, 0.0031, 3, 0.62, 1.0, 951, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "blit", "arg_names": [], "import_names": [], "rhs_call_name": "blit", "annotation": ""}, "snippet": " srf.blit(act_image, self.calc_blit_loc(tag_image,blit_loc[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L216_C8", "label": "act_ind = get_selection()", "type": "assigned_variable", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.6626, 0.0031, 2, 0.32, 0.7857, 841, 3, 4, 0, 0, 365, 10, 1], "semantic": {"name": "act_ind", "arg_names": [], "import_names": [], "rhs_call_name": "get_selection", "annotation": ""}, "snippet": " act_ind = self.get_selection( obj, act_images, actions[tag_ind], blit_loc )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L217_C8", "label": "print()", "type": "expression", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [8, 2, 0.6656, 0.0031, 2, 0.32, 0.8214, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Selected action ', act_ind, ': ', actions[tag_ind][act_ind])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L219_C8", "label": "retmsg = RFID_Interface()", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.6718, 0.0031, 2, 0.32, 0.8571, 422, 3, 0, 0, 0, 197, 10, 1], "semantic": {"name": "retmsg", "arg_names": [], "import_names": [], "rhs_call_name": "RFID_Interface", "annotation": ""}, "snippet": " retmsg = RFID_Interface()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L220_C8", "label": "retmsg.tagIDs =", "type": "assigned_variable", "loc": [220, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.6748, 0.0031, 2, 0.32, 0.8929, 995, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "retmsg.tagIDs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " retmsg.tagIDs = [ tagIDs[tag_ind] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L221_C8", "label": "retmsg.humanread =", "type": "assigned_variable", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.6779, 0.0031, 2, 0.32, 0.9286, 869, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "retmsg.humanread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " retmsg.humanread = [ humanread[tag_ind] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L222_C8", "label": "retmsg.actions =", "type": "assigned_variable", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [14, 2, 0.681, 0.0031, 2, 0.32, 0.9643, 821, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "retmsg.actions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " retmsg.actions = [ actions[tag_ind][act_ind] ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L223_C8", "label": "return", "type": "return", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "vector": [13, 2, 0.684, 0.0031, 2, 0.32, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return retmsg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "label": "put_bottom_text", "type": "function", "loc": [225, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.7009, 0.0245, 1, 0.83, 0.75, 876, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "put_bottom_text", "arg_names": ["self", "srf", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def put_bottom_text( self, srf, text ):\n font = pygame.font.Font(None, 25)\n box = font.render(text, 1,(10, 10, 10, 0))\n ts = box.get_size()\n horiz = self.s_width / 2.0 - ts[0]/2.0\n vt = self.s_height - 50.0 - ts[1]/2.0\n srf.blit(box, (horiz, vt))\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L226_C8", "label": "font = Font()", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "vector": [14, 2, 0.6933, 0.0031, 2, 0.2, 0.0, 768, 3, 2, 0, 0, 69, 10, 1], "semantic": {"name": "font", "arg_names": [], "import_names": [], "rhs_call_name": "Font", "annotation": ""}, "snippet": " font = pygame.font.Font(None, 25)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L227_C8", "label": "box = render()", "type": "assigned_variable", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "vector": [14, 2, 0.6963, 0.0031, 2, 0.2, 0.1667, 918, 3, 3, 0, 0, 24, 10, 1], "semantic": {"name": "box", "arg_names": [], "import_names": [], "rhs_call_name": "render", "annotation": ""}, "snippet": " box = font.render(text, 1,(10, 10, 10, 0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L228_C8", "label": "ts = get_size()", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "vector": [14, 2, 0.6994, 0.0031, 2, 0.2, 0.3333, 278, 3, 0, 0, 0, 932, 10, 1], "semantic": {"name": "ts", "arg_names": [], "import_names": [], "rhs_call_name": "get_size", "annotation": ""}, "snippet": " ts = box.get_size()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L229_C8", "label": "horiz =", "type": "assigned_variable", "loc": [229, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "vector": [14, 2, 0.7025, 0.0031, 2, 0.2, 0.5, 492, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "horiz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " horiz = self.s_width / 2.0 - ts[0]/2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L230_C8", "label": "vt =", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "vector": [14, 2, 0.7055, 0.0031, 2, 0.2, 0.6667, 360, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vt = self.s_height - 50.0 - ts[1]/2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L231_C8", "label": "blit()", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "vector": [8, 2, 0.7086, 0.0031, 2, 0.2, 0.8333, 951, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "blit", "arg_names": [], "import_names": [], "rhs_call_name": "blit", "annotation": ""}, "snippet": " srf.blit(box, (horiz, vt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L232_C8", "label": "return", "type": "return", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "vector": [13, 2, 0.7117, 0.0031, 2, 0.2, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "label": "draw_rect", "type": "function", "loc": [234, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.7347, 0.0368, 1, 0.83, 0.875, 177, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "draw_rect", "arg_names": ["self", "srf", "blit_loc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def draw_rect(self, srf, blit_loc):\n width = self.imheight * 1.10\n height = self.imheight *1.10\n horiz = blit_loc[0] - width / 2.0\n vert = blit_loc[1] - height / 2.0\n pygame.draw.rect(srf, (255, 0, 0), (horiz, vert, width, height))\n width = self.imheight * 1.01\n height = self.imheight *1.01"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L235_C8", "label": "width =", "type": "assigned_variable", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [14, 2, 0.7209, 0.0031, 2, 0.75, 0.0, 989, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width = self.imheight * 1.10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L236_C8", "label": "height =", "type": "assigned_variable", "loc": [236, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [14, 2, 0.7239, 0.0031, 2, 0.75, 0.1, 751, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " height = self.imheight *1.10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L237_C8", "label": "horiz =", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [14, 2, 0.727, 0.0031, 2, 0.75, 0.2, 492, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "horiz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " horiz = blit_loc[0] - width / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L238_C8", "label": "vert =", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [14, 2, 0.7301, 0.0031, 2, 0.75, 0.3, 128, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vert", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vert = blit_loc[1] - height / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L239_C8", "label": "rect()", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [8, 2, 0.7331, 0.0031, 2, 0.75, 0.4, 902, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "rect", "arg_names": [], "import_names": [], "rhs_call_name": "rect", "annotation": ""}, "snippet": " pygame.draw.rect(srf, (255, 0, 0), (horiz, vert, width, height))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L240_C8", "label": "width =", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [14, 2, 0.7362, 0.0031, 2, 0.75, 0.5, 989, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width = self.imheight * 1.01"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L241_C8", "label": "height =", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [14, 2, 0.7393, 0.0031, 2, 0.75, 0.6, 751, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " height = self.imheight *1.01"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L242_C8", "label": "horiz =", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [14, 2, 0.7423, 0.0031, 2, 0.75, 0.7, 492, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "horiz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " horiz = blit_loc[0] - width / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L243_C8", "label": "vert =", "type": "assigned_variable", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [14, 2, 0.7454, 0.0031, 2, 0.75, 0.8, 128, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vert", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vert = blit_loc[1] - height / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L244_C8", "label": "rect()", "type": "expression", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [8, 2, 0.7485, 0.0031, 2, 0.75, 0.9, 902, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "rect", "arg_names": [], "import_names": [], "rhs_call_name": "rect", "annotation": ""}, "snippet": " pygame.draw.rect(srf, (255, 255, 255), (horiz, vert, width, height))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L245_C8", "label": "return", "type": "return", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "vector": [13, 2, 0.7515, 0.0031, 2, 0.75, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "label": "get_selection", "type": "function", "loc": [247, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "vector": [2, 1, 0.8221, 0.1319, 1, 0.83, 1.0, 365, 0, 5, 1, 0, 0, 0, 20], "semantic": {"name": "get_selection", "arg_names": ["self", "obj", "images", "humanread", "blit_loc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_selection( self, obj, images, humanread, blit_loc ):\n [srf, fps, clk] = obj\n loopFlag = True\n ind = 0\n pos = (0,0)\n while loopFlag:\n # Clear the screen\n srf.fill((255,255,255))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L248_C8", "label": "assign", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [14, 2, 0.7607, 0.0031, 2, 0.36, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [srf, fps, clk] = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L249_C8", "label": "loopFlag =", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [14, 2, 0.7638, 0.0031, 2, 0.36, 0.125, 143, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "loopFlag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loopFlag = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L250_C8", "label": "ind =", "type": "assigned_variable", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [14, 2, 0.7669, 0.0031, 2, 0.36, 0.25, 680, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L251_C8", "label": "pos =", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [14, 2, 0.7699, 0.0031, 2, 0.36, 0.375, 627, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = (0,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "label": "while", "type": "while", "loc": [252, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [5, 2, 0.8236, 0.1043, 2, 0.36, 0.5, 0, 2, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while loopFlag:\n # Clear the screen\n srf.fill((255,255,255))\n \n diffs = np.array(blit_loc) - np.array(pos)\n ind = np.argmin( ut.norm( diffs.T ))\n self.put_bottom_text( srf, humanread[ind] )\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L254_C12", "label": "fill()", "type": "expression", "loc": [254, 254], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [8, 3, 0.7791, 0.0031, 3, 0.28, 0.0, 346, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "fill", "arg_names": [], "import_names": [], "rhs_call_name": "fill", "annotation": ""}, "snippet": " srf.fill((255,255,255))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L256_C12", "label": "diffs =", "type": "assigned_variable", "loc": [256, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [14, 3, 0.7853, 0.0031, 3, 0.28, 0.1111, 809, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "diffs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diffs = np.array(blit_loc) - np.array(pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L257_C12", "label": "ind = argmin()", "type": "assigned_variable", "loc": [257, 257], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [14, 3, 0.7883, 0.0031, 3, 0.28, 0.2222, 680, 3, 1, 0, 0, 879, 10, 2], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "argmin", "annotation": ""}, "snippet": " ind = np.argmin( ut.norm( diffs.T ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L258_C12", "label": "put_bottom_text()", "type": "expression", "loc": [258, 258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [8, 3, 0.7914, 0.0031, 3, 0.28, 0.3333, 876, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "put_bottom_text", "arg_names": [], "import_names": [], "rhs_call_name": "put_bottom_text", "annotation": ""}, "snippet": " self.put_bottom_text( srf, humanread[ind] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L260_C12", "label": "draw_rect()", "type": "expression", "loc": [260, 260], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [8, 3, 0.7975, 0.0031, 3, 0.28, 0.4444, 177, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "draw_rect", "arg_names": [], "import_names": [], "rhs_call_name": "draw_rect", "annotation": ""}, "snippet": " self.draw_rect(srf, blit_loc[ind])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L262_C12", "label": "for i, image", "type": "for", "loc": [262, 263], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [6, 3, 0.8052, 0.0061, 3, 0.28, 0.5556, 693, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, image", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, image in enumerate(images):\n srf.blit(image, self.calc_blit_loc(image,blit_loc[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L263_C16", "label": "blit()", "type": "expression", "loc": [263, 263], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L262_C12", "vector": [8, 4, 0.8067, 0.0031, 4, 0.18, 0.0, 951, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "blit", "arg_names": [], "import_names": [], "rhs_call_name": "blit", "annotation": ""}, "snippet": " srf.blit(image, self.calc_blit_loc(image,blit_loc[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L266_C12", "label": "flip()", "type": "expression", "loc": [266, 266], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [8, 3, 0.816, 0.0031, 3, 0.28, 0.6667, 677, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flip", "arg_names": [], "import_names": [], "rhs_call_name": "flip", "annotation": ""}, "snippet": " pygame.display.flip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L268_C12", "label": "events = get()", "type": "assigned_variable", "loc": [268, 268], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [14, 3, 0.8221, 0.0031, 3, 0.28, 0.7778, 830, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "events", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " events = pygame.event.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "label": "for e", "type": "for", "loc": [269, 283], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [6, 3, 0.8466, 0.046, 3, 0.28, 0.8889, 175, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in events:\n if e.type==pygame.locals.QUIT:\n loopFlag=False\n if e.type==pygame.locals.KEYDOWN:\n if e.key == 27: # Esc\n loopFlag=False\n if e.type == pygame.locals.MOUSEMOTION:\n pos = e.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L270_C16", "label": "if", "type": "if", "loc": [270, 271], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "vector": [4, 4, 0.8298, 0.0061, 4, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if e.type==pygame.locals.QUIT:\n loopFlag=False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L271_C20", "label": "loopFlag =", "type": "assigned_variable", "loc": [271, 271], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L270_C16", "vector": [14, 5, 0.8313, 0.0031, 5, 0.45, 0.0, 143, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "loopFlag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loopFlag=False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L272_C16", "label": "if", "type": "if", "loc": [272, 274], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "vector": [4, 4, 0.8374, 0.0092, 4, 0.65, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if e.type==pygame.locals.KEYDOWN:\n if e.key == 27: # Esc\n loopFlag=False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L273_C20", "label": "if", "type": "if", "loc": [273, 274], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L272_C16", "vector": [4, 5, 0.839, 0.0061, 5, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if e.key == 27: # Esc\n loopFlag=False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L274_C24", "label": "loopFlag =", "type": "assigned_variable", "loc": [274, 274], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L273_C20", "vector": [14, 6, 0.8405, 0.0031, 6, 0.03, 0.0, 143, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "loopFlag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loopFlag=False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L275_C16", "label": "if", "type": "if", "loc": [275, 276], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "vector": [4, 4, 0.8451, 0.0061, 4, 0.65, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if e.type == pygame.locals.MOUSEMOTION:\n pos = e.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L276_C20", "label": "pos =", "type": "assigned_variable", "loc": [276, 276], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L275_C16", "vector": [14, 5, 0.8466, 0.0031, 5, 0.4, 0.0, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = e.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L277_C16", "label": "if", "type": "if", "loc": [277, 283], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "vector": [4, 4, 0.8589, 0.0215, 4, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if e.type==pygame.locals.MOUSEBUTTONDOWN:\n if e.button == 1:\n # left button\n pos = e.pos\n diffs = np.array(blit_loc) - np.array(pos)\n ind = np.argmin( ut.norm( diffs.T ))\n loopFlag = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "label": "if", "type": "if", "loc": [278, 283], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L277_C16", "vector": [4, 5, 0.8604, 0.0184, 5, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if e.button == 1:\n # left button\n pos = e.pos\n diffs = np.array(blit_loc) - np.array(pos)\n ind = np.argmin( ut.norm( diffs.T ))\n loopFlag = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L280_C24", "label": "pos =", "type": "assigned_variable", "loc": [280, 280], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "vector": [14, 6, 0.8589, 0.0031, 6, 0.84, 0.0, 627, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = e.pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L281_C24", "label": "diffs =", "type": "assigned_variable", "loc": [281, 281], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "vector": [14, 6, 0.862, 0.0031, 6, 0.84, 0.3333, 809, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "diffs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diffs = np.array(blit_loc) - np.array(pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L282_C24", "label": "ind = argmin()", "type": "assigned_variable", "loc": [282, 282], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "vector": [14, 6, 0.865, 0.0031, 6, 0.84, 0.6667, 680, 3, 1, 0, 0, 879, 10, 2], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "argmin", "annotation": ""}, "snippet": " ind = np.argmin( ut.norm( diffs.T ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L283_C24", "label": "loopFlag =", "type": "assigned_variable", "loc": [283, 283], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "vector": [14, 6, 0.8681, 0.0031, 6, 0.84, 1.0, 143, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "loopFlag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loopFlag = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L285_C12", "label": "tick()", "type": "expression", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "vector": [8, 3, 0.8742, 0.0031, 3, 0.28, 1.0, 133, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "tick", "arg_names": [], "import_names": [], "rhs_call_name": "tick", "annotation": ""}, "snippet": " clk.tick(fps)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L286_C8", "label": "fill()", "type": "expression", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [8, 2, 0.8773, 0.0031, 2, 0.36, 0.625, 346, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "fill", "arg_names": [], "import_names": [], "rhs_call_name": "fill", "annotation": ""}, "snippet": " srf.fill((255,255,255))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L287_C8", "label": "flip()", "type": "expression", "loc": [287, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [8, 2, 0.8804, 0.0031, 2, 0.36, 0.75, 677, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flip", "arg_names": [], "import_names": [], "rhs_call_name": "flip", "annotation": ""}, "snippet": " pygame.display.flip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L288_C8", "label": "tick()", "type": "expression", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [8, 2, 0.8834, 0.0031, 2, 0.36, 0.875, 133, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "tick", "arg_names": [], "import_names": [], "rhs_call_name": "tick", "annotation": ""}, "snippet": " clk.tick(fps)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L289_C8", "label": "return", "type": "return", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "vector": [13, 2, 0.8865, 0.0031, 2, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ind"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "label": "if", "type": "if", "loc": [298, 314], "level": 0, "parent": null, "vector": [4, 0, 0.9387, 0.0521, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import optparse\n\n p = optparse.OptionParser()\n p.add_option('-d', action='store_true', dest='graphical',\n help='Use a graphical display.')\n p.add_option('-g', action='store_true', dest='client',\n help='Build Client?', default=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L299_C4", "label": "optparse import optparse", "type": "import", "loc": [299, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "vector": [1, 1, 0.9172, 0.0031, 1, 0.09, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L301_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [301, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "vector": [14, 1, 0.9233, 0.0031, 1, 0.09, 0.2, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L302_C4", "label": "add_option()", "type": "expression", "loc": [302, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "vector": [8, 1, 0.9279, 0.0061, 1, 0.09, 0.4, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-d', action='store_true', dest='graphical',\n help='Use a graphical display.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L304_C4", "label": "add_option()", "type": "expression", "loc": [304, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "vector": [8, 1, 0.934, 0.0061, 1, 0.09, 0.6, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-g', action='store_true', dest='client',\n help='Build Client?', default=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L306_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [306, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "vector": [14, 1, 0.9387, 0.0031, 1, 0.09, 0.8, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "label": "if", "type": "if", "loc": [308, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "vector": [4, 1, 0.954, 0.0215, 1, 0.09, 1.0, 0, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.client:\n pc = ROS_UI_PC(graphical = opt.graphical)\n rospy.spin()\n else:\n ro = ROS_UI_Robot()\n ro.publish_tag_ids([ 'one', 'two', 'hello' ])\n ro.receive_response()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L309_C8", "label": "pc = ROS_UI_PC()", "type": "assigned_variable", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "vector": [14, 2, 0.9479, 0.0031, 2, 0.51, 0.0, 876, 3, 1, 0, 0, 256, 10, 1], "semantic": {"name": "pc", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_UI_PC", "annotation": ""}, "snippet": " pc = ROS_UI_PC(graphical = opt.graphical)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L310_C8", "label": "spin()", "type": "expression", "loc": [310, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "vector": [8, 2, 0.9509, 0.0031, 2, 0.51, 0.25, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L312_C8", "label": "ro = ROS_UI_Robot()", "type": "assigned_variable", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "vector": [14, 2, 0.9571, 0.0031, 2, 0.51, 0.5, 572, 3, 0, 0, 0, 953, 10, 1], "semantic": {"name": "ro", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_UI_Robot", "annotation": ""}, "snippet": " ro = ROS_UI_Robot()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L313_C8", "label": "publish_tag_ids()", "type": "expression", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "vector": [8, 2, 0.9601, 0.0031, 2, 0.51, 0.75, 891, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish_tag_ids", "arg_names": [], "import_names": [], "rhs_call_name": "publish_tag_ids", "annotation": ""}, "snippet": " ro.publish_tag_ids([ 'one', 'two', 'hello' ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L314_C8", "label": "receive_response()", "type": "expression", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "vector": [8, 2, 0.9632, 0.0031, 2, 0.51, 1.0, 13, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "receive_response", "arg_names": [], "import_names": [], "rhs_call_name": "receive_response", "annotation": ""}, "snippet": " ro.receive_response()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L19_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L20_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L19_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L21_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L77_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L78_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:Try_L77_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L112_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L113_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L114_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L111_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L115_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L137_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L138_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L146_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L147_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L193_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L194_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L208_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L211_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L254_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L256_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L257_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L260_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L262_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L262_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L263_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L266_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L268_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L270_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L270_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L271_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L272_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L272_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L273_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L273_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L274_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L275_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L275_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L276_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:For_L269_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L277_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L277_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L280_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L281_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L282_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L278_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L283_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:While_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Return_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Import_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L310_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Assign_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99455:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99455:Expr_L314_C8"}] |
#
# Copyright (c) 2009, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Travis Deyle (Healthcare Robotics Lab, Georgia Tech.)
__all__ = [
'lib_M5e',
'ros_M5e',
'ros_M5e_client',
'ui'
]
| ajibawa-2023/Python-Code-Large/train/row_99456 | 1 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99456:Assign_L31_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [31, 36], "level": 0, "parent": null, "vector": [14, 0, 0.9054, 0.1622, 0, 0.66, 0.0, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n'lib_M5e',\n'ros_M5e',\n'ros_M5e_client',\n'ui'\n]"}] | [] |
#!/usr/bin/python
#
# Copyright (c) 2009, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Travis Deyle (Healthcare Robotics Lab, Georgia Tech.)
# ROS imports
import roslib; roslib.load_manifest('hrl_rfid')
import rospy
from hrl_rfid.msg import RFIDread
from hrl_rfid.srv import RfidSrv
import hrl_rfid.lib_M5e as M5e
import time
from threading import Thread
# Modeled off lib_M5e.M5e_Poller
class ROS_M5e( ):
QUERY_MODE = 'query'
TRACK_MODE = 'track'
def __init__(self, name = 'reader1', readPwr = 2300,
portStr = '/dev/robot/RFIDreader',
antFuncs = [], callbacks = []):
try:
rospy.init_node( 'rfid_m5e_' + name )
except rospy.ROSException:
pass
self.mode = 'track'
self.tag_to_track = 'In Hand Tag '
self.name = name + '_reader'
rospy.logout( 'ROS_M5e: Launching RFID Reader' )
rospy.logout( 'ROS_M5e: Please check out our related work @ http://www.hsi.gatech.edu/hrl/project_rfid.shtml' )
rospy.logout( 'ROS_M5e: '+self.name+' Building & Connecting to reader' )
def prin( x ): rospy.logout( 'ROS_M5e: lib_M5e: ' + x ) # use rospy.logout in underlying lib's output
self.reader = M5e.M5e(readPwr=readPwr, portSTR = portStr, verbosity_func = prin)
self.antFuncs = antFuncs
self.callbacks = callbacks + [self.broadcast]
rospy.logout( 'ROS_M5e: publishing RFID reader with type RFIDread to channel /rfid/'+name+'_reader' )
self.channel = rospy.Publisher('/rfid/'+name+'_reader', RFIDread)
self._mode_service_obj = rospy.Service('/rfid/'+name+'_mode',
RfidSrv, self._mode_service)
rospy.logout( 'ROS_M5e: '+self.name+' Inialized and awaiting instructions' )
def run( self, total_iter = 1000 ):
for i in xrange( total_iter ):
if self.mode == self.QUERY_MODE:
for aF in self.antFuncs:
antennaName = aF(self.reader) # let current antFunc make appropriate changes
results = self.reader.QueryEnvironment()
if len(results) == 0:
datum = [antennaName, '', -1]
[cF(datum) for cF in self.callbacks]
for tagid, rssi in results:
datum = [antennaName, tagid, rssi]
[cF(datum) for cF in self.callbacks]
elif self.mode == self.TRACK_MODE:
for aF in self.antFuncs:
antennaName = aF(self.reader) # let current antFunc make appropriate changes
tagid = self.tag_to_track
rssi = self.reader.TrackSingleTag(tagid, timeout = 10, safe_response = False)
#if rssi != -1:
datum = [antennaName, tagid, rssi]
[cF(datum) for cF in self.callbacks]
else:
time.sleep(0.005)
rospy.logout( 'ROS_M5e: '+self.name+' Shutting down reader' )
def broadcast(self, data):
antName, tagid, rssi = data
rv = RFIDread( None, antName, tagid, rssi )
rv.header.stamp = rospy.Time.now()
self.channel.publish( rv )
# For internal use only
def _mode_service(self, data):
val = data.data
if len(val) == 0:
rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )
elif len(val) == 1:
if val[0] == self.QUERY_MODE:
rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )
self.mode = self.QUERY_MODE
else:
rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )
self.mode = ''
elif len(val) == 2:
if val[0] == self.TRACK_MODE and len(val[1]) == 12:
rospy.logout( 'ROS_M5e: '+self.name+' Entering Track Mode: ' + str(val[1]) )
self.mode = self.TRACK_MODE
self.tag_to_track = val[1]
else:
rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )
else:
rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )
return True
# -----------------------------------------------
# Likely Callbacks: (various antennas)
# -----------------------------------------------
def EleLeftEar(M5e):
M5e.ChangeAntennaPorts(1,1)
time.sleep(0.010)
return 'EleLeftEar'
def EleRightEar(M5e):
M5e.ChangeAntennaPorts(2,2)
time.sleep(0.010)
return 'EleRightEar'
def Hand_Right_1(M5e):
# GPIO1 = 1, GPIO2 = 0
M5e.TransmitCommand('\x02\x96\x01\x01')
M5e.ReceiveResponse()
M5e.TransmitCommand('\x02\x96\x02\x00')
M5e.ReceiveResponse()
return 'Hand_Right_1'
def Hand_Right_2(M5e):
# GPIO1 = 1, GPIO2 = 1
M5e.TransmitCommand('\x02\x96\x01\x01')
M5e.ReceiveResponse()
M5e.TransmitCommand('\x02\x96\x02\x01')
M5e.ReceiveResponse()
return 'Hand_Right_2'
def Hand_Left_1(M5e):
# GPIO1 = 0, GPIO2 = 0
M5e.TransmitCommand('\x02\x96\x01\x00')
M5e.ReceiveResponse()
M5e.TransmitCommand('\x02\x96\x02\x00')
M5e.ReceiveResponse()
return 'Hand_Left_1'
def Hand_Left_2(M5e):
# GPIO1 = 0, GPIO2 = 1
M5e.TransmitCommand('\x02\x96\x01\x00')
M5e.ReceiveResponse()
M5e.TransmitCommand('\x02\x96\x02\x01')
M5e.ReceiveResponse()
return 'Hand_Left_2'
def PrintDatum(data):
ant, ids, rssi = data
print data
if __name__ == '__main__':
print 'Starting Ears RFID Services'
ros_rfid = ROS_M5e( name = 'ears', readPwr = 2300,
portStr = '/dev/robot/RFIDreader',
antFuncs = [EleLeftEar, EleRightEar],
callbacks = [] )
total_iter = 500
t0 = time.time()
ros_rfid.run( total_iter )
t1 = time.time()
print 'Reads per sec: ', (total_iter * 2.0) / ( 1.0 * (t1 - t0))
| ajibawa-2023/Python-Code-Large/train/row_99458 | 116 | 196 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Import_L34_C0", "label": "roslib import roslib", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.1735, 0.0051, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_rfid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L34_C15", "label": "load_manifest()", "type": "expression", "loc": [34, 34], "level": 0, "parent": null, "vector": [8, 0, 0.1735, 0.0051, 0, 0.66, 0.0625, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_rfid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Import_L35_C0", "label": "rospy import rospy", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.1786, 0.0051, 0, 0.66, 0.125, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:ImportFrom_L36_C0", "label": "from hrl_rfid.msg import RFIDread", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.1837, 0.0051, 0, 0.66, 0.1875, 328, 0, 1, 0, 0, 328, 0, 0], "semantic": {"name": "hrl_rfid.msg", "arg_names": [], "import_names": ["RFIDread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.msg import RFIDread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:ImportFrom_L37_C0", "label": "from hrl_rfid.srv import RfidSrv", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.1888, 0.0051, 0, 0.66, 0.25, 592, 0, 1, 0, 0, 592, 0, 0], "semantic": {"name": "hrl_rfid.srv", "arg_names": [], "import_names": ["RfidSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.srv import RfidSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Import_L38_C0", "label": "hrl_rfid.lib_M5e import M5e", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.1939, 0.0051, 0, 0.66, 0.3125, 761, 0, 1, 0, 0, 761, 0, 0], "semantic": {"name": "hrl_rfid.lib_M5e", "arg_names": [], "import_names": ["M5e"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_rfid.lib_M5e as M5e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Import_L40_C0", "label": "time import time", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.2041, 0.0051, 0, 0.66, 0.375, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:ImportFrom_L41_C0", "label": "from threading import Thread", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.2092, 0.0051, 0, 0.66, 0.4375, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "label": "ROS_M5e", "type": "class", "loc": [45, 131], "level": 0, "parent": null, "vector": [3, 0, 0.449, 0.4439, 0, 0.66, 0.5, 65, 0, 5, 0, 0, 0, 0, 38], "semantic": {"name": "ROS_M5e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ROS_M5e( ):\n QUERY_MODE = 'query'\n TRACK_MODE = 'track'\n \n def __init__(self, name = 'reader1', readPwr = 2300,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [], callbacks = []):\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L46_C4", "label": "QUERY_MODE =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "vector": [14, 1, 0.2347, 0.0051, 1, 0.95, 0.0, 353, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "QUERY_MODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " QUERY_MODE = 'query'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L47_C4", "label": "TRACK_MODE =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "vector": [14, 1, 0.2398, 0.0051, 1, 0.95, 0.2, 197, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TRACK_MODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TRACK_MODE = 'track'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "label": "__init__", "type": "function", "loc": [49, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "vector": [2, 1, 0.3214, 0.148, 1, 0.95, 0.4, 555, 0, 6, 0, 0, 0, 0, 10], "semantic": {"name": "__init__", "arg_names": ["self", "name", "readPwr", "portStr", "antFuncs", "callbacks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name = 'reader1', readPwr = 2300,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [], callbacks = []):\n\n try:\n rospy.init_node( 'rfid_m5e_' + name )\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Try_L53_C8", "label": "try", "type": "try", "loc": [53, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [7, 2, 0.2781, 0.0204, 2, 0.23, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node( 'rfid_m5e_' + name )\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L54_C12", "label": "init_node()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:Try_L53_C8", "vector": [8, 3, 0.2755, 0.0051, 3, 0.86, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( 'rfid_m5e_' + name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L58_C8", "label": "self.mode =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [14, 2, 0.2959, 0.0051, 2, 0.23, 0.0714, 474, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = 'track'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L59_C8", "label": "self.tag_to_track =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [14, 2, 0.301, 0.0051, 2, 0.23, 0.1429, 131, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.tag_to_track", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tag_to_track = 'In Hand Tag '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L60_C8", "label": "self.name =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [14, 2, 0.3061, 0.0051, 2, 0.23, 0.2143, 689, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = name + '_reader'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L62_C8", "label": "logout()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [8, 2, 0.3163, 0.0051, 2, 0.23, 0.2857, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Launching RFID Reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L63_C8", "label": "logout()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [8, 2, 0.3214, 0.0051, 2, 0.23, 0.3571, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Please check out our related work @ http://www.hsi.gatech.edu/hrl/project_rfid.shtml' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L64_C8", "label": "logout()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [8, 2, 0.3265, 0.0051, 2, 0.23, 0.4286, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Building & Connecting to reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L66_C8", "label": "prin", "type": "function", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [2, 2, 0.3367, 0.0051, 2, 0.23, 0.5, 607, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "prin", "arg_names": ["x"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prin( x ): rospy.logout( 'ROS_M5e: lib_M5e: ' + x ) # use rospy.logout in underlying lib's output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L66_C23", "label": "logout()", "type": "expression", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L66_C8", "vector": [8, 3, 0.3367, 0.0051, 3, 0.91, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " def prin( x ): rospy.logout( 'ROS_M5e: lib_M5e: ' + x ) # use rospy.logout in underlying lib's output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L68_C8", "label": "self.reader = M5e()", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [14, 2, 0.3469, 0.0051, 2, 0.23, 0.5714, 536, 3, 3, 0, 0, 931, 10, 1], "semantic": {"name": "self.reader", "arg_names": [], "import_names": [], "rhs_call_name": "M5e", "annotation": ""}, "snippet": " self.reader = M5e.M5e(readPwr=readPwr, portSTR = portStr, verbosity_func = prin)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L69_C8", "label": "self.antFuncs =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [14, 2, 0.352, 0.0051, 2, 0.23, 0.6429, 516, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.antFuncs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.antFuncs = antFuncs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L70_C8", "label": "self.callbacks =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [14, 2, 0.3571, 0.0051, 2, 0.23, 0.7143, 264, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.callbacks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.callbacks = callbacks + [self.broadcast]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L72_C8", "label": "logout()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [8, 2, 0.3673, 0.0051, 2, 0.23, 0.7857, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: publishing RFID reader with type RFIDread to channel /rfid/'+name+'_reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L73_C8", "label": "self.channel = Publisher()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [14, 2, 0.3724, 0.0051, 2, 0.23, 0.8571, 503, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.channel", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.channel = rospy.Publisher('/rfid/'+name+'_reader', RFIDread)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L74_C8", "label": "self._mode_service_obj = Service()", "type": "assigned_variable", "loc": [74, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [14, 2, 0.3801, 0.0102, 2, 0.23, 0.9286, 356, 3, 3, 0, 0, 451, 10, 1], "semantic": {"name": "self._mode_service_obj", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " self._mode_service_obj = rospy.Service('/rfid/'+name+'_mode',\n RfidSrv, self._mode_service)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L77_C8", "label": "logout()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "vector": [8, 2, 0.3929, 0.0051, 2, 0.23, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Inialized and awaiting instructions' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L79_C4", "label": "run", "type": "function", "loc": [79, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "vector": [2, 1, 0.4617, 0.1224, 1, 0.95, 0.6, 679, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "run", "arg_names": ["self", "total_iter"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run( self, total_iter = 1000 ): \n for i in xrange( total_iter ):\n if self.mode == self.QUERY_MODE:\n for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n results = self.reader.QueryEnvironment()\n if len(results) == 0:\n datum = [antennaName, '', -1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L80_C8", "label": "for i", "type": "for", "loc": [80, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L79_C4", "vector": [6, 2, 0.4592, 0.1071, 2, 0.22, 0.0, 826, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange( total_iter ):\n if self.mode == self.QUERY_MODE:\n for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n results = self.reader.QueryEnvironment()\n if len(results) == 0:\n datum = [antennaName, '', -1]\n [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L81_C12", "label": "if", "type": "if", "loc": [81, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L80_C8", "vector": [4, 3, 0.4617, 0.102, 3, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.mode == self.QUERY_MODE:\n for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n results = self.reader.QueryEnvironment()\n if len(results) == 0:\n datum = [antennaName, '', -1]\n [cF(datum) for cF in self.callbacks]\n for tagid, rssi in results:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "label": "for aF", "type": "for", "loc": [82, 90], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L81_C12", "vector": [6, 4, 0.4388, 0.0459, 4, 0.96, 0.0, 36, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "aF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n results = self.reader.QueryEnvironment()\n if len(results) == 0:\n datum = [antennaName, '', -1]\n [cF(datum) for cF in self.callbacks]\n for tagid, rssi in results:\n datum = [antennaName, tagid, rssi]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L83_C20", "label": "antennaName = aF()", "type": "assigned_variable", "loc": [83, 83], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "vector": [14, 5, 0.4235, 0.0051, 5, 0.58, 0.0, 713, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "antennaName", "arg_names": [], "import_names": [], "rhs_call_name": "aF", "annotation": ""}, "snippet": " antennaName = aF(self.reader) # let current antFunc make appropriate changes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L84_C20", "label": "results = QueryEnvironment()", "type": "assigned_variable", "loc": [84, 84], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "vector": [14, 5, 0.4286, 0.0051, 5, 0.58, 0.3333, 143, 3, 0, 0, 0, 496, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "QueryEnvironment", "annotation": ""}, "snippet": " results = self.reader.QueryEnvironment()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L85_C20", "label": "if", "type": "if", "loc": [85, 87], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "vector": [4, 5, 0.4388, 0.0153, 5, 0.58, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(results) == 0:\n datum = [antennaName, '', -1]\n [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L86_C24", "label": "datum =", "type": "assigned_variable", "loc": [86, 86], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L85_C20", "vector": [14, 6, 0.4388, 0.0051, 6, 0.89, 0.0, 975, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "datum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " datum = [antennaName, '', -1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L87_C24", "label": "expression", "type": "expression", "loc": [87, 87], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L85_C20", "vector": [8, 6, 0.4439, 0.0051, 6, 0.89, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L88_C20", "label": "for tagid, rssi", "type": "for", "loc": [88, 90], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "vector": [6, 5, 0.4541, 0.0153, 5, 0.58, 1.0, 398, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tagid, rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tagid, rssi in results:\n datum = [antennaName, tagid, rssi]\n [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L89_C24", "label": "datum =", "type": "assigned_variable", "loc": [89, 89], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L88_C20", "vector": [14, 6, 0.4541, 0.0051, 6, 0.28, 0.0, 975, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "datum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " datum = [antennaName, tagid, rssi]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L90_C24", "label": "expression", "type": "expression", "loc": [90, 90], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L88_C20", "vector": [8, 6, 0.4592, 0.0051, 6, 0.28, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L91_C12", "label": "if", "type": "if", "loc": [91, 100], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L81_C12", "vector": [4, 4, 0.4872, 0.051, 4, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.mode == self.TRACK_MODE:\n for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n tagid = self.tag_to_track\n rssi = self.reader.TrackSingleTag(tagid, timeout = 10, safe_response = False)\n #if rssi != -1:\n datum = [antennaName, tagid, rssi]\n [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "label": "for aF", "type": "for", "loc": [92, 98], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L91_C12", "vector": [6, 5, 0.4847, 0.0357, 5, 0.14, 0.0, 36, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "aF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for aF in self.antFuncs:\n antennaName = aF(self.reader) # let current antFunc make appropriate changes\n tagid = self.tag_to_track\n rssi = self.reader.TrackSingleTag(tagid, timeout = 10, safe_response = False)\n #if rssi != -1:\n datum = [antennaName, tagid, rssi]\n [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L93_C20", "label": "antennaName = aF()", "type": "assigned_variable", "loc": [93, 93], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "vector": [14, 6, 0.4745, 0.0051, 6, 0.37, 0.0, 713, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "antennaName", "arg_names": [], "import_names": [], "rhs_call_name": "aF", "annotation": ""}, "snippet": " antennaName = aF(self.reader) # let current antFunc make appropriate changes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L94_C20", "label": "tagid =", "type": "assigned_variable", "loc": [94, 94], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "vector": [14, 6, 0.4796, 0.0051, 6, 0.37, 0.25, 538, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tagid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tagid = self.tag_to_track"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L95_C20", "label": "rssi = TrackSingleTag()", "type": "assigned_variable", "loc": [95, 95], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "vector": [14, 6, 0.4847, 0.0051, 6, 0.37, 0.5, 906, 3, 3, 0, 0, 782, 10, 1], "semantic": {"name": "rssi", "arg_names": [], "import_names": [], "rhs_call_name": "TrackSingleTag", "annotation": ""}, "snippet": " rssi = self.reader.TrackSingleTag(tagid, timeout = 10, safe_response = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L97_C20", "label": "datum =", "type": "assigned_variable", "loc": [97, 97], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "vector": [14, 6, 0.4949, 0.0051, 6, 0.37, 0.75, 975, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "datum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " datum = [antennaName, tagid, rssi]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L98_C20", "label": "expression", "type": "expression", "loc": [98, 98], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "vector": [8, 6, 0.5, 0.0051, 6, 0.37, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [cF(datum) for cF in self.callbacks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L100_C16", "label": "sleep()", "type": "expression", "loc": [100, 100], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L91_C12", "vector": [8, 5, 0.5102, 0.0051, 5, 0.14, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.005)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L102_C8", "label": "logout()", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L79_C4", "vector": [8, 2, 0.5204, 0.0051, 2, 0.22, 1.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Shutting down reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "label": "broadcast", "type": "function", "loc": [104, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "vector": [2, 1, 0.5408, 0.0255, 1, 0.95, 0.8, 803, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "broadcast", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def broadcast(self, data):\n antName, tagid, rssi = data\n rv = RFIDread( None, antName, tagid, rssi )\n rv.header.stamp = rospy.Time.now()\n self.channel.publish( rv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L105_C8", "label": "antName, tagid, rssi =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "vector": [14, 2, 0.5357, 0.0051, 2, 0.81, 0.0, 920, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "antName, tagid, rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " antName, tagid, rssi = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L106_C8", "label": "rv = RFIDread()", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "vector": [14, 2, 0.5408, 0.0051, 2, 0.81, 0.3333, 222, 3, 4, 0, 0, 624, 10, 1], "semantic": {"name": "rv", "arg_names": [], "import_names": [], "rhs_call_name": "RFIDread", "annotation": ""}, "snippet": " rv = RFIDread( None, antName, tagid, rssi )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L107_C8", "label": "rv.header.stamp = now()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "vector": [14, 2, 0.5459, 0.0051, 2, 0.81, 0.6667, 13, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "rv.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " rv.header.stamp = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L108_C8", "label": "publish()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "vector": [8, 2, 0.551, 0.0051, 2, 0.81, 1.0, 102, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.channel.publish( rv )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L111_C4", "label": "_mode_service", "type": "function", "loc": [111, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "vector": [2, 1, 0.6173, 0.1071, 1, 0.95, 1.0, 436, 0, 2, 1, 0, 0, 0, 14], "semantic": {"name": "_mode_service", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _mode_service(self, data):\n val = data.data\n if len(val) == 0:\n rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )\n elif len(val) == 1:\n if val[0] == self.QUERY_MODE:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )\n self.mode = self.QUERY_MODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L112_C8", "label": "val =", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L111_C4", "vector": [14, 2, 0.5714, 0.0051, 2, 0.82, 0.0, 618, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " val = data.data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L113_C8", "label": "if", "type": "if", "loc": [113, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L111_C4", "vector": [4, 2, 0.6199, 0.0918, 2, 0.82, 0.5, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(val) == 0:\n rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )\n elif len(val) == 1:\n if val[0] == self.QUERY_MODE:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )\n self.mode = self.QUERY_MODE\n else:\n rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L114_C12", "label": "logout()", "type": "expression", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L113_C8", "vector": [8, 3, 0.5816, 0.0051, 3, 0.82, 0.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L115_C8", "label": "if", "type": "if", "loc": [115, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L113_C8", "vector": [4, 3, 0.625, 0.0816, 3, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(val) == 1:\n if val[0] == self.QUERY_MODE:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )\n self.mode = self.QUERY_MODE\n else:\n rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )\n self.mode = ''\n elif len(val) == 2:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "label": "if", "type": "if", "loc": [116, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L115_C8", "vector": [4, 4, 0.6046, 0.0306, 4, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val[0] == self.QUERY_MODE:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )\n self.mode = self.QUERY_MODE\n else:\n rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )\n self.mode = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L117_C16", "label": "logout()", "type": "expression", "loc": [117, 117], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "vector": [8, 5, 0.5969, 0.0051, 5, 0.92, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Entering Query Mode' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L118_C16", "label": "self.mode =", "type": "assigned_variable", "loc": [118, 118], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "vector": [14, 5, 0.602, 0.0051, 5, 0.92, 0.3333, 474, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = self.QUERY_MODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L120_C16", "label": "logout()", "type": "expression", "loc": [120, 120], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "vector": [8, 5, 0.6122, 0.0051, 5, 0.92, 0.6667, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Stopping Reader' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L121_C16", "label": "self.mode =", "type": "assigned_variable", "loc": [121, 121], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "vector": [14, 5, 0.6173, 0.0051, 5, 0.92, 1.0, 474, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L122_C8", "label": "if", "type": "if", "loc": [122, 130], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L115_C8", "vector": [4, 4, 0.6429, 0.0459, 4, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(val) == 2:\n if val[0] == self.TRACK_MODE and len(val[1]) == 12:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Track Mode: ' + str(val[1]) )\n self.mode = self.TRACK_MODE\n self.tag_to_track = val[1]\n else:\n rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "label": "if", "type": "if", "loc": [123, 128], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L122_C8", "vector": [4, 5, 0.6403, 0.0306, 5, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val[0] == self.TRACK_MODE and len(val[1]) == 12:\n rospy.logout( 'ROS_M5e: '+self.name+' Entering Track Mode: ' + str(val[1]) )\n self.mode = self.TRACK_MODE\n self.tag_to_track = val[1]\n else:\n rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L124_C16", "label": "logout()", "type": "expression", "loc": [124, 124], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "vector": [8, 6, 0.6327, 0.0051, 6, 0.61, 0.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: '+self.name+' Entering Track Mode: ' + str(val[1]) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L125_C16", "label": "self.mode =", "type": "assigned_variable", "loc": [125, 125], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "vector": [14, 6, 0.6378, 0.0051, 6, 0.61, 0.3333, 474, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = self.TRACK_MODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L126_C16", "label": "self.tag_to_track =", "type": "assigned_variable", "loc": [126, 126], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "vector": [14, 6, 0.6429, 0.0051, 6, 0.61, 0.6667, 131, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.tag_to_track", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tag_to_track = val[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L128_C16", "label": "logout()", "type": "expression", "loc": [128, 128], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "vector": [8, 6, 0.6531, 0.0051, 6, 0.61, 1.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L130_C12", "label": "logout()", "type": "expression", "loc": [130, 130], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L122_C8", "vector": [8, 5, 0.6633, 0.0051, 5, 0.2, 1.0, 525, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'ROS_M5e: Mode Service called with invalid argument: ' + str(val) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L131_C8", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L111_C4", "vector": [13, 2, 0.6684, 0.0051, 2, 0.82, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L139_C0", "label": "EleLeftEar", "type": "function", "loc": [139, 142], "level": 0, "parent": null, "vector": [2, 0, 0.7168, 0.0204, 0, 0.66, 0.5625, 578, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "EleLeftEar", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def EleLeftEar(M5e):\n M5e.ChangeAntennaPorts(1,1)\n time.sleep(0.010)\n return 'EleLeftEar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L140_C4", "label": "ChangeAntennaPorts()", "type": "expression", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L139_C0", "vector": [8, 1, 0.7143, 0.0051, 1, 0.05, 0.0, 901, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ChangeAntennaPorts", "arg_names": [], "import_names": [], "rhs_call_name": "ChangeAntennaPorts", "annotation": ""}, "snippet": " M5e.ChangeAntennaPorts(1,1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L141_C4", "label": "sleep()", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L139_C0", "vector": [8, 1, 0.7194, 0.0051, 1, 0.05, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.010)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L142_C4", "label": "return", "type": "return", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L139_C0", "vector": [13, 1, 0.7245, 0.0051, 1, 0.05, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'EleLeftEar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L144_C0", "label": "EleRightEar", "type": "function", "loc": [144, 147], "level": 0, "parent": null, "vector": [2, 0, 0.7423, 0.0204, 0, 0.66, 0.625, 801, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "EleRightEar", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def EleRightEar(M5e):\n M5e.ChangeAntennaPorts(2,2)\n time.sleep(0.010)\n return 'EleRightEar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L145_C4", "label": "ChangeAntennaPorts()", "type": "expression", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L144_C0", "vector": [8, 1, 0.7398, 0.0051, 1, 0.22, 0.0, 901, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ChangeAntennaPorts", "arg_names": [], "import_names": [], "rhs_call_name": "ChangeAntennaPorts", "annotation": ""}, "snippet": " M5e.ChangeAntennaPorts(2,2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L146_C4", "label": "sleep()", "type": "expression", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L144_C0", "vector": [8, 1, 0.7449, 0.0051, 1, 0.22, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.010)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L147_C4", "label": "return", "type": "return", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L144_C0", "vector": [13, 1, 0.75, 0.0051, 1, 0.22, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'EleRightEar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "label": "Hand_Right_1", "type": "function", "loc": [149, 155], "level": 0, "parent": null, "vector": [2, 0, 0.7755, 0.0357, 0, 0.66, 0.6875, 490, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "Hand_Right_1", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Hand_Right_1(M5e):\n # GPIO1 = 1, GPIO2 = 0\n M5e.TransmitCommand('\\x02\\x96\\x01\\x01')\n M5e.ReceiveResponse()\n M5e.TransmitCommand('\\x02\\x96\\x02\\x00')\n M5e.ReceiveResponse()\n return 'Hand_Right_1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L151_C4", "label": "TransmitCommand()", "type": "expression", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "vector": [8, 1, 0.7704, 0.0051, 1, 0.99, 0.0, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x01\\x01')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L152_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "vector": [8, 1, 0.7755, 0.0051, 1, 0.99, 0.25, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L153_C4", "label": "TransmitCommand()", "type": "expression", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "vector": [8, 1, 0.7806, 0.0051, 1, 0.99, 0.5, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x02\\x00')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L154_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "vector": [8, 1, 0.7857, 0.0051, 1, 0.99, 0.75, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L155_C4", "label": "return", "type": "return", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "vector": [13, 1, 0.7908, 0.0051, 1, 0.99, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Hand_Right_1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "label": "Hand_Right_2", "type": "function", "loc": [157, 163], "level": 0, "parent": null, "vector": [2, 0, 0.8163, 0.0357, 0, 0.66, 0.75, 943, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "Hand_Right_2", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Hand_Right_2(M5e):\n # GPIO1 = 1, GPIO2 = 1\n M5e.TransmitCommand('\\x02\\x96\\x01\\x01')\n M5e.ReceiveResponse()\n M5e.TransmitCommand('\\x02\\x96\\x02\\x01')\n M5e.ReceiveResponse()\n return 'Hand_Right_2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L159_C4", "label": "TransmitCommand()", "type": "expression", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "vector": [8, 1, 0.8112, 0.0051, 1, 0.18, 0.0, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x01\\x01')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L160_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "vector": [8, 1, 0.8163, 0.0051, 1, 0.18, 0.25, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L161_C4", "label": "TransmitCommand()", "type": "expression", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "vector": [8, 1, 0.8214, 0.0051, 1, 0.18, 0.5, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x02\\x01')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L162_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "vector": [8, 1, 0.8265, 0.0051, 1, 0.18, 0.75, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L163_C4", "label": "return", "type": "return", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "vector": [13, 1, 0.8316, 0.0051, 1, 0.18, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Hand_Right_2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "label": "Hand_Left_1", "type": "function", "loc": [165, 171], "level": 0, "parent": null, "vector": [2, 0, 0.8571, 0.0357, 0, 0.66, 0.8125, 666, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "Hand_Left_1", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Hand_Left_1(M5e):\n # GPIO1 = 0, GPIO2 = 0\n M5e.TransmitCommand('\\x02\\x96\\x01\\x00')\n M5e.ReceiveResponse()\n M5e.TransmitCommand('\\x02\\x96\\x02\\x00')\n M5e.ReceiveResponse()\n return 'Hand_Left_1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L167_C4", "label": "TransmitCommand()", "type": "expression", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "vector": [8, 1, 0.852, 0.0051, 1, 0.36, 0.0, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x01\\x00')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L168_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "vector": [8, 1, 0.8571, 0.0051, 1, 0.36, 0.25, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L169_C4", "label": "TransmitCommand()", "type": "expression", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "vector": [8, 1, 0.8622, 0.0051, 1, 0.36, 0.5, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x02\\x00')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L170_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "vector": [8, 1, 0.8673, 0.0051, 1, 0.36, 0.75, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L171_C4", "label": "return", "type": "return", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "vector": [13, 1, 0.8724, 0.0051, 1, 0.36, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Hand_Left_1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "label": "Hand_Left_2", "type": "function", "loc": [173, 179], "level": 0, "parent": null, "vector": [2, 0, 0.898, 0.0357, 0, 0.66, 0.875, 308, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "Hand_Left_2", "arg_names": ["M5e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Hand_Left_2(M5e):\n # GPIO1 = 0, GPIO2 = 1\n M5e.TransmitCommand('\\x02\\x96\\x01\\x00')\n M5e.ReceiveResponse()\n M5e.TransmitCommand('\\x02\\x96\\x02\\x01')\n M5e.ReceiveResponse()\n return 'Hand_Left_2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L175_C4", "label": "TransmitCommand()", "type": "expression", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "vector": [8, 1, 0.8929, 0.0051, 1, 0.12, 0.0, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x01\\x00')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L176_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "vector": [8, 1, 0.898, 0.0051, 1, 0.12, 0.25, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L177_C4", "label": "TransmitCommand()", "type": "expression", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "vector": [8, 1, 0.9031, 0.0051, 1, 0.12, 0.5, 591, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "TransmitCommand", "arg_names": [], "import_names": [], "rhs_call_name": "TransmitCommand", "annotation": ""}, "snippet": " M5e.TransmitCommand('\\x02\\x96\\x02\\x01')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L178_C4", "label": "ReceiveResponse()", "type": "expression", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "vector": [8, 1, 0.9082, 0.0051, 1, 0.12, 0.75, 223, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ReceiveResponse", "arg_names": [], "import_names": [], "rhs_call_name": "ReceiveResponse", "annotation": ""}, "snippet": " M5e.ReceiveResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L179_C4", "label": "return", "type": "return", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "vector": [13, 1, 0.9133, 0.0051, 1, 0.12, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Hand_Left_2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L181_C0", "label": "PrintDatum", "type": "function", "loc": [181, 183], "level": 0, "parent": null, "vector": [2, 0, 0.9286, 0.0153, 0, 0.66, 0.9375, 369, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "PrintDatum", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PrintDatum(data):\n ant, ids, rssi = data\n print(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L182_C4", "label": "ant, ids, rssi =", "type": "assigned_variable", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L181_C0", "vector": [14, 1, 0.9286, 0.0051, 1, 0.9, 0.0, 269, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ant, ids, rssi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ant, ids, rssi = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L183_C4", "label": "print()", "type": "expression", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L181_C0", "vector": [8, 1, 0.9337, 0.0051, 1, 0.9, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "label": "if", "type": "if", "loc": [185, 195], "level": 0, "parent": null, "vector": [4, 0, 0.9694, 0.0561, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n print('Starting Ears RFID Services')\n ros_rfid = ROS_M5e( name = 'ears', readPwr = 2300,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [EleLeftEar, EleRightEar],\n callbacks = [] )\n total_iter = 500\n t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L186_C4", "label": "print()", "type": "expression", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "vector": [8, 1, 0.949, 0.0051, 1, 0.06, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Starting Ears RFID Services')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L187_C4", "label": "ros_rfid = ROS_M5e()", "type": "assigned_variable", "loc": [187, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "vector": [14, 1, 0.9617, 0.0204, 1, 0.06, 0.1667, 68, 3, 5, 0, 0, 65, 10, 1], "semantic": {"name": "ros_rfid", "arg_names": [], "import_names": [], "rhs_call_name": "ROS_M5e", "annotation": ""}, "snippet": " ros_rfid = ROS_M5e( name = 'ears', readPwr = 2300,\n portStr = '/dev/robot/RFIDreader',\n antFuncs = [EleLeftEar, EleRightEar],\n callbacks = [] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L191_C4", "label": "total_iter =", "type": "assigned_variable", "loc": [191, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "vector": [14, 1, 0.9745, 0.0051, 1, 0.06, 0.3333, 759, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "total_iter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_iter = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L192_C4", "label": "t0 = time()", "type": "assigned_variable", "loc": [192, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "vector": [14, 1, 0.9796, 0.0051, 1, 0.06, 0.5, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L193_C4", "label": "run()", "type": "expression", "loc": [193, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "vector": [8, 1, 0.9847, 0.0051, 1, 0.06, 0.6667, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " ros_rfid.run( total_iter )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L194_C4", "label": "t1 = time()", "type": "assigned_variable", "loc": [194, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "vector": [14, 1, 0.9898, 0.0051, 1, 0.06, 0.8333, 329, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t1", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t1 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L195_C4", "label": "print()", "type": "expression", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "vector": [8, 1, 0.9949, 0.0051, 1, 0.06, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Reads per sec: ', (total_iter * 2.0) / ( 1.0 * (t1 - t0)))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Try_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L66_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L83_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L84_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L85_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L85_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L86_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L85_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L87_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L82_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L88_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L88_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L89_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L88_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L90_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L93_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L94_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L95_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L97_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:For_L92_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L98_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L113_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L113_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L117_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L120_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L116_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L121_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L124_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L125_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L126_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L128_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L130_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Return_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L181_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:FunctionDef_L181_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Assign_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99458:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99458:Expr_L195_C4"}] |
#
# Copyright (c) 2009, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Travis Deyle (Healthcare Robotics Lab, Georgia Tech.)
# ROS imports
import roslib; roslib.load_manifest('hrl_rfid')
import rospy
from hrl_rfid.msg import RFIDread
from hrl_rfid.srv import RfidSrv
import hrl_rfid.lib_M5e as M5e
import time
import thread
class ROS_M5e_Client():
QUERY_MODE = 'query'
TRACK_MODE = 'track'
def __init__(self, name = 'reader1', callbacks=[]):
self.name = name
self._create_ros_objects()
self.callbacks = callbacks
self.last_read = ['', '', -1] # antenna_name, tagID, rssi
try:
rospy.init_node( self.name + '_listener', anonymous=True )
except rospy.ROSException:
pass
self._sub = rospy.Subscriber( '/rfid/' + self.name + '_reader', RFIDread, self._sub_cb)
def _sub_cb(self, datum):
[ cb( datum ) for cb in self.callbacks ]
self.last_read = [datum.antenna_name, datum.tagID, datum.rssi]
def unregister( self ):
# Stop processing new reads.
self._sub.unregister()
# ROS Services
def stop(self):
self._mode_service_obj([ '' ])
def track_mode(self, tag_id):
self._mode_service_obj([ self.TRACK_MODE, tag_id ])
def query_mode(self):
self._mode_service_obj([ self.QUERY_MODE ])
# Create ROS Objects (for internal use only)
def _create_ros_objects(self):
reader_service_name = '/rfid/'+self.name+'_mode'
rospy.wait_for_service(reader_service_name)
self._mode_service_obj = rospy.ServiceProxy(reader_service_name,
RfidSrv)
def read(self, antenna = ''):
if antenna == '':
return self.last_read
else:
r = self.last_read
while r[0] != antenna and not rospy.is_shutdown():
time.sleep(0.02)
r = self.last_read
return r
| ajibawa-2023/Python-Code-Large/train/row_99459 | 42 | 94 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Import_L33_C0", "label": "roslib import roslib", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.3511, 0.0106, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_rfid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L33_C15", "label": "load_manifest()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.3511, 0.0106, 0, 0.66, 0.125, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_rfid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Import_L34_C0", "label": "rospy import rospy", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.3617, 0.0106, 0, 0.66, 0.25, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:ImportFrom_L35_C0", "label": "from hrl_rfid.msg import RFIDread", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.3723, 0.0106, 0, 0.66, 0.375, 328, 0, 1, 0, 0, 328, 0, 0], "semantic": {"name": "hrl_rfid.msg", "arg_names": [], "import_names": ["RFIDread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.msg import RFIDread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:ImportFrom_L36_C0", "label": "from hrl_rfid.srv import RfidSrv", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.383, 0.0106, 0, 0.66, 0.5, 592, 0, 1, 0, 0, 592, 0, 0], "semantic": {"name": "hrl_rfid.srv", "arg_names": [], "import_names": ["RfidSrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_rfid.srv import RfidSrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Import_L37_C0", "label": "hrl_rfid.lib_M5e import M5e", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.3936, 0.0106, 0, 0.66, 0.625, 761, 0, 1, 0, 0, 761, 0, 0], "semantic": {"name": "hrl_rfid.lib_M5e", "arg_names": [], "import_names": ["M5e"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_rfid.lib_M5e as M5e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Import_L39_C0", "label": "time import time", "type": "import", "loc": [39, 39], "level": 0, "parent": null, "vector": [1, 0, 0.4149, 0.0106, 0, 0.66, 0.75, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Import_L40_C0", "label": "thread import thread", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.4255, 0.0106, 0, 0.66, 0.875, 260, 0, 1, 0, 0, 260, 0, 0], "semantic": {"name": "thread", "arg_names": [], "import_names": ["thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "import thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "label": "ROS_M5e_Client", "type": "class", "loc": [42, 93], "level": 0, "parent": null, "vector": [3, 0, 0.7181, 0.5532, 0, 0.66, 1.0, 479, 0, 8, 0, 0, 0, 0, 12], "semantic": {"name": "ROS_M5e_Client", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ROS_M5e_Client():\n QUERY_MODE = 'query'\n TRACK_MODE = 'track'\n\n def __init__(self, name = 'reader1', callbacks=[]):\n self.name = name\n self._create_ros_objects()\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L43_C4", "label": "QUERY_MODE =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [14, 1, 0.4574, 0.0106, 1, 0.9, 0.0, 353, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "QUERY_MODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " QUERY_MODE = 'query'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L44_C4", "label": "TRACK_MODE =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [14, 1, 0.4681, 0.0106, 1, 0.9, 0.1111, 197, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TRACK_MODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TRACK_MODE = 'track'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "label": "__init__", "type": "function", "loc": [46, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [2, 1, 0.5532, 0.1383, 1, 0.9, 0.2222, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "name", "callbacks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name = 'reader1', callbacks=[]):\n self.name = name\n self._create_ros_objects()\n \n self.callbacks = callbacks\n self.last_read = ['', '', -1] # antenna_name, tagID, rssi\n\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L47_C8", "label": "self.name =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "vector": [14, 2, 0.5, 0.0106, 2, 0.32, 0.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L48_C8", "label": "_create_ros_objects()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "vector": [8, 2, 0.5106, 0.0106, 2, 0.32, 0.2, 516, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_create_ros_objects", "arg_names": [], "import_names": [], "rhs_call_name": "_create_ros_objects", "annotation": ""}, "snippet": " self._create_ros_objects()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L50_C8", "label": "self.callbacks =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "vector": [14, 2, 0.5319, 0.0106, 2, 0.32, 0.4, 264, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.callbacks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.callbacks = callbacks"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L51_C8", "label": "self.last_read =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "vector": [14, 2, 0.5426, 0.0106, 2, 0.32, 0.6, 600, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.last_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.last_read = ['', '', -1] # antenna_name, tagID, rssi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Try_L53_C8", "label": "try", "type": "try", "loc": [53, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "vector": [7, 2, 0.5798, 0.0426, 2, 0.32, 0.8, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.init_node( self.name + '_listener', anonymous=True )\n except rospy.ROSException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L54_C12", "label": "init_node()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:Try_L53_C8", "vector": [8, 3, 0.5745, 0.0106, 3, 0.9, 0.0, 463, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node( self.name + '_listener', anonymous=True )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L58_C8", "label": "self._sub = Subscriber()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "vector": [14, 2, 0.617, 0.0106, 2, 0.32, 1.0, 531, 3, 3, 0, 0, 455, 10, 1], "semantic": {"name": "self._sub", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " self._sub = rospy.Subscriber( '/rfid/' + self.name + '_reader', RFIDread, self._sub_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L60_C4", "label": "_sub_cb", "type": "function", "loc": [60, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [2, 1, 0.6489, 0.0319, 1, 0.9, 0.3333, 279, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_sub_cb", "arg_names": ["self", "datum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _sub_cb(self, datum):\n [ cb( datum ) for cb in self.callbacks ]\n self.last_read = [datum.antenna_name, datum.tagID, datum.rssi]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L61_C8", "label": "expression", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L60_C4", "vector": [8, 2, 0.6489, 0.0106, 2, 0.14, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [ cb( datum ) for cb in self.callbacks ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L62_C8", "label": "self.last_read =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L60_C4", "vector": [14, 2, 0.6596, 0.0106, 2, 0.14, 1.0, 600, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.last_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.last_read = [datum.antenna_name, datum.tagID, datum.rssi]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L64_C4", "label": "unregister", "type": "function", "loc": [64, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [2, 1, 0.6915, 0.0319, 1, 0.9, 0.4444, 614, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unregister", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unregister( self ):\n # Stop processing new reads.\n self._sub.unregister()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L66_C8", "label": "unregister()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L64_C4", "vector": [8, 2, 0.7021, 0.0106, 2, 0.69, 0.0, 614, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unregister", "arg_names": [], "import_names": [], "rhs_call_name": "unregister", "annotation": ""}, "snippet": " self._sub.unregister()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L69_C4", "label": "stop", "type": "function", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [2, 1, 0.7394, 0.0213, 1, 0.9, 0.5556, 343, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self):\n self._mode_service_obj([ '' ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L70_C8", "label": "_mode_service_obj()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L69_C4", "vector": [8, 2, 0.7447, 0.0106, 2, 0.64, 0.0, 703, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_mode_service_obj", "arg_names": [], "import_names": [], "rhs_call_name": "_mode_service_obj", "annotation": ""}, "snippet": " self._mode_service_obj([ '' ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L72_C4", "label": "track_mode", "type": "function", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [2, 1, 0.7713, 0.0213, 1, 0.9, 0.6667, 884, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "track_mode", "arg_names": ["self", "tag_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def track_mode(self, tag_id):\n self._mode_service_obj([ self.TRACK_MODE, tag_id ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L73_C8", "label": "_mode_service_obj()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L72_C4", "vector": [8, 2, 0.7766, 0.0106, 2, 0.93, 0.0, 703, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_mode_service_obj", "arg_names": [], "import_names": [], "rhs_call_name": "_mode_service_obj", "annotation": ""}, "snippet": " self._mode_service_obj([ self.TRACK_MODE, tag_id ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L75_C4", "label": "query_mode", "type": "function", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [2, 1, 0.8032, 0.0213, 1, 0.9, 0.7778, 130, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "query_mode", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def query_mode(self):\n self._mode_service_obj([ self.QUERY_MODE ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L76_C8", "label": "_mode_service_obj()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L75_C4", "vector": [8, 2, 0.8085, 0.0106, 2, 0.46, 0.0, 703, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_mode_service_obj", "arg_names": [], "import_names": [], "rhs_call_name": "_mode_service_obj", "annotation": ""}, "snippet": " self._mode_service_obj([ self.QUERY_MODE ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L79_C4", "label": "_create_ros_objects", "type": "function", "loc": [79, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [2, 1, 0.8617, 0.0532, 1, 0.9, 0.8889, 516, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_create_ros_objects", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _create_ros_objects(self):\n reader_service_name = '/rfid/'+self.name+'_mode'\n rospy.wait_for_service(reader_service_name)\n self._mode_service_obj = rospy.ServiceProxy(reader_service_name,\n RfidSrv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L80_C8", "label": "reader_service_name =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L79_C4", "vector": [14, 2, 0.8511, 0.0106, 2, 0.79, 0.0, 854, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "reader_service_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " reader_service_name = '/rfid/'+self.name+'_mode'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L81_C8", "label": "wait_for_service()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L79_C4", "vector": [8, 2, 0.8617, 0.0106, 2, 0.79, 0.5, 617, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service(reader_service_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L82_C8", "label": "self._mode_service_obj = ServiceProxy()", "type": "assigned_variable", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L79_C4", "vector": [14, 2, 0.8777, 0.0213, 2, 0.79, 1.0, 356, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self._mode_service_obj", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self._mode_service_obj = rospy.ServiceProxy(reader_service_name,\n RfidSrv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L85_C4", "label": "read", "type": "function", "loc": [85, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "vector": [2, 1, 0.9468, 0.0957, 1, 0.9, 1.0, 453, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": ["self", "antenna"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, antenna = ''):\n if antenna == '':\n return self.last_read\n else:\n r = self.last_read\n while r[0] != antenna and not rospy.is_shutdown():\n time.sleep(0.02)\n r = self.last_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "label": "if", "type": "if", "loc": [86, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L85_C4", "vector": [4, 2, 0.9521, 0.0851, 2, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if antenna == '':\n return self.last_read\n else:\n r = self.last_read\n while r[0] != antenna and not rospy.is_shutdown():\n time.sleep(0.02)\n r = self.last_read\n return r"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Return_L87_C12", "label": "return", "type": "return", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "vector": [13, 3, 0.9255, 0.0106, 3, 0.35, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.last_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L89_C12", "label": "r =", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "vector": [14, 3, 0.9468, 0.0106, 3, 0.35, 0.3333, 436, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = self.last_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:While_L90_C12", "label": "while", "type": "while", "loc": [90, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "vector": [5, 3, 0.9681, 0.0319, 3, 0.35, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while r[0] != antenna and not rospy.is_shutdown():\n time.sleep(0.02)\n r = self.last_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L91_C16", "label": "sleep()", "type": "expression", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:While_L90_C12", "vector": [8, 4, 0.9681, 0.0106, 4, 0.65, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.02)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L92_C16", "label": "r =", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:While_L90_C12", "vector": [14, 4, 0.9787, 0.0106, 4, 0.65, 1.0, 436, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = self.last_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99459:Return_L93_C12", "label": "return", "type": "return", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "vector": [13, 3, 0.9894, 0.0106, 3, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return r"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Try_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Return_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:While_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:While_L90_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Expr_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:While_L90_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Assign_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99459:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99459:Return_L93_C12"}] |
#!/usr/bin/python
import numpy as np
import pickle
import matplotlib.pyplot as plt
def main():
with open('pickled_mn_std.pkl','rb') as f:
(means, stds) = pickle.load(f)
width = 1./means.shape[1]
ind = np.arange(means.shape[0])*2
#
# b = ['']*means.shape[0]
colors=[(1,0,0),
(0,1,0),
(0,0,1),
(1,1,0),
(0,1,1),
(0.3,0.3,0.3),
(0.6,0.6,0.6),
(0.6,0,0.3)]
for i in range(means.shape[1]):
for j in range(means.shape[0]):
plt.bar(ind[i]+j*width, means[j,i], width, color=colors[j], yerr=stds[j,i])
plt.show()
if __name__=='__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_99460 | 14 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Import_L3_C0", "label": "numpy import np", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1034, 0.0345, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Import_L4_C0", "label": "pickle import pickle", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1379, 0.0345, 0, 0.66, 0.25, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Import_L5_C0", "label": "matplotlib.pyplot import plt", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1724, 0.0345, 0, 0.66, 0.5, 596, 0, 1, 0, 0, 596, 0, 0], "semantic": {"name": "matplotlib.pyplot", "arg_names": [], "import_names": ["plt"], "rhs_call_name": "", "annotation": ""}, "snippet": "import matplotlib.pyplot as plt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "label": "main", "type": "function", "loc": [7, 27], "level": 0, "parent": null, "vector": [2, 0, 0.5862, 0.7241, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n with open('pickled_mn_std.pkl','rb') as f:\n (means, stds) = pickle.load(f)\n width = 1./means.shape[1]\n ind = np.arange(means.shape[0])*2\n \n#\n # b = ['']*means.shape[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Assign_L9_C8", "label": "means, stds = load()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "vector": [14, 1, 0.3103, 0.0345, 1, 0.05, 0.0, 779, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "means, stds", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " (means, stds) = pickle.load(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Assign_L10_C4", "label": "width =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "vector": [14, 1, 0.3448, 0.0345, 1, 0.05, 0.0, 989, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width = 1./means.shape[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Assign_L11_C4", "label": "ind =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "vector": [14, 1, 0.3793, 0.0345, 1, 0.05, 0.25, 680, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ind = np.arange(means.shape[0])*2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Assign_L15_C4", "label": "colors =", "type": "assigned_variable", "loc": [15, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "vector": [14, 1, 0.6379, 0.2759, 1, 0.05, 0.5, 656, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "colors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colors=[(1,0,0),\n (0,1,0), \n (0,0,1), \n (1,1,0),\n (0,1,1),\n (0.3,0.3,0.3),\n (0.6,0.6,0.6),\n (0.6,0,0.3)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:For_L23_C4", "label": "for i", "type": "for", "loc": [23, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "vector": [6, 1, 0.8276, 0.1034, 1, 0.05, 0.75, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(means.shape[1]):\n for j in range(means.shape[0]):\n plt.bar(ind[i]+j*width, means[j,i], width, color=colors[j], yerr=stds[j,i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:For_L24_C8", "label": "for j", "type": "for", "loc": [24, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:For_L23_C4", "vector": [6, 2, 0.8448, 0.069, 2, 0.61, 0.0, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range(means.shape[0]):\n plt.bar(ind[i]+j*width, means[j,i], width, color=colors[j], yerr=stds[j,i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Expr_L25_C12", "label": "bar()", "type": "expression", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:For_L24_C8", "vector": [8, 3, 0.8621, 0.0345, 3, 0.19, 0.0, 300, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "bar", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": " plt.bar(ind[i]+j*width, means[j,i], width, color=colors[j], yerr=stds[j,i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Expr_L27_C4", "label": "show()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "vector": [8, 1, 0.931, 0.0345, 1, 0.05, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " plt.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:If_L28_C0", "label": "if", "type": "if", "loc": [28, 29], "level": 0, "parent": null, "vector": [4, 0, 0.9828, 0.069, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__=='__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99460:Expr_L29_C4", "label": "main()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99460:If_L28_C0", "vector": [8, 1, 1.0, 0.0345, 1, 0.54, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:For_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99460:For_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:For_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99460:For_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:Expr_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99460:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99460:If_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99460:Expr_L29_C4"}] |
#!/usr/bin/python
import sys
import csv
def extract_data(files):
data = []
for data_file in files:
with open(data_file, 'rb') as f:
reader = csv.reader(f)
for row in reader:
data.append(row)
print "Processing: %s , %s rows" %(data_file, reader.line_num)
print "Final Length: ", len(data)
return data
if __name__=='__main__':
files = sys.argv[1:]
data = extract_data(files)
with open('condensed_data.csv', 'wb') as f_out:
writer = csv.writer(f_out)
writer.writerows(data)
| ajibawa-2023/Python-Code-Large/train/row_99461 | 16 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0476, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Import_L3_C0", "label": "csv import csv", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0476, 0, 0.66, 0.3333, 312, 0, 1, 0, 0, 312, 0, 0], "semantic": {"name": "csv", "arg_names": [], "import_names": ["csv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import csv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "label": "extract_data", "type": "function", "loc": [5, 14], "level": 0, "parent": null, "vector": [2, 0, 0.4524, 0.4762, 0, 0.66, 0.6667, 759, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "extract_data", "arg_names": ["files"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def extract_data(files):\n data = []\n for data_file in files:\n with open(data_file, 'rb') as f:\n reader = csv.reader(f)\n for row in reader:\n data.append(row)\n print(\"Processing: %s , %s rows\" %(data_file, reader.line_num))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L6_C4", "label": "data =", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "vector": [14, 1, 0.2857, 0.0476, 1, 0.04, 0.0, 929, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L7_C4", "label": "for data_file", "type": "for", "loc": [7, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "vector": [6, 1, 0.4524, 0.2857, 1, 0.04, 0.3333, 135, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "data_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for data_file in files:\n with open(data_file, 'rb') as f:\n reader = csv.reader(f)\n for row in reader:\n data.append(row)\n print(\"Processing: %s , %s rows\" %(data_file, reader.line_num))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L9_C12", "label": "reader = reader()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L7_C4", "vector": [14, 2, 0.4286, 0.0476, 2, 0.52, 0.0, 548, 3, 1, 0, 0, 548, 10, 1], "semantic": {"name": "reader", "arg_names": [], "import_names": [], "rhs_call_name": "reader", "annotation": ""}, "snippet": " reader = csv.reader(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L10_C12", "label": "for row", "type": "for", "loc": [10, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L7_C4", "vector": [6, 2, 0.5, 0.0952, 2, 0.52, 0.5, 767, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for row in reader:\n data.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Expr_L11_C16", "label": "append()", "type": "expression", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L10_C12", "vector": [8, 3, 0.5238, 0.0476, 3, 0.0, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " data.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Expr_L12_C12", "label": "print()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L7_C4", "vector": [8, 2, 0.5714, 0.0476, 2, 0.52, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Processing: %s , %s rows\" %(data_file, reader.line_num))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Expr_L13_C4", "label": "print()", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "vector": [8, 1, 0.619, 0.0476, 1, 0.04, 0.6667, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Final Length: \", len(data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Return_L14_C4", "label": "return", "type": "return", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "vector": [13, 1, 0.6667, 0.0476, 1, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "label": "if", "type": "if", "loc": [16, 21], "level": 0, "parent": null, "vector": [4, 0, 0.881, 0.2857, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__=='__main__':\n files = sys.argv[1:]\n data = extract_data(files)\n with open('condensed_data.csv', 'wb') as f_out:\n writer = csv.writer(f_out)\n writer.writerows(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L17_C3", "label": "files =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "vector": [14, 1, 0.8095, 0.0476, 1, 0.19, 0.0, 598, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " files = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L18_C3", "label": "data = extract_data()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "vector": [14, 1, 0.8571, 0.0476, 1, 0.19, 1.0, 929, 3, 1, 0, 0, 759, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "extract_data", "annotation": ""}, "snippet": " data = extract_data(files)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L20_C7", "label": "writer = writer()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "vector": [14, 1, 0.9524, 0.0476, 1, 0.19, 0.0, 614, 3, 1, 0, 0, 614, 10, 1], "semantic": {"name": "writer", "arg_names": [], "import_names": [], "rhs_call_name": "writer", "annotation": ""}, "snippet": " writer = csv.writer(f_out)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99461:Expr_L21_C7", "label": "writerows()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "vector": [8, 1, 1.0, 0.0476, 1, 0.19, 1.0, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writerows", "arg_names": [], "import_names": [], "rhs_call_name": "writerows", "annotation": ""}, "snippet": " writer.writerows(data)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L9_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L10_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L10_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Expr_L11_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:For_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Expr_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Return_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L17_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L18_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Assign_L20_C7"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99461:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99461:Expr_L21_C7"}] |
#!/usr/bin/env python
import sys
import roslib; roslib.load_manifest('wouse')
import rospy
from wouse.srv import WouseRunStop, WouseRunStopRequest
rospy.init_node('wouse_reset')
try:
rospy.wait_for_service('/wouse_run_stop', 10)
reset_client = rospy.ServiceProxy('wouse_run_stop', WouseRunStop)
rospy.loginfo("[Wouse Reset]: Found wouse run stop service.")
except:
rospy.logwarn("[Wouse Reset]: Could not find wouse run stop service.")
sys.exit()
req = WouseRunStopRequest()
req.start = True
success = reset_client(req)
if success:
rospy.loginfo("[Wouse Reset]: Reset returned successfully.")
else:
rospy.logwarn("[Wouse Reset]: Reset reported failure.")
| ajibawa-2023/Python-Code-Large/train/row_99463 | 18 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.037, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Import_L5_C0", "label": "roslib import roslib", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1852, 0.037, 0, 0.66, 0.1, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L5_C15", "label": "load_manifest()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1852, 0.037, 0, 0.66, 0.2, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Import_L6_C0", "label": "rospy import rospy", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.037, 0, 0.66, 0.3, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:ImportFrom_L7_C0", "label": "from wouse.srv import WouseRunStop, WouseRunStopRequest", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.2593, 0.037, 0, 0.66, 0.4, 855, 0, 2, 0, 0, 855, 0, 0], "semantic": {"name": "wouse.srv", "arg_names": [], "import_names": ["WouseRunStop", "WouseRunStopRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wouse.srv import WouseRunStop, WouseRunStopRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L9_C0", "label": "init_node()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.3333, 0.037, 0, 0.66, 0.5, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": "rospy.init_node('wouse_reset')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "label": "try", "type": "try", "loc": [10, 16], "level": 0, "parent": null, "vector": [7, 0, 0.4815, 0.2593, 0, 0.66, 0.6, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n rospy.wait_for_service('/wouse_run_stop', 10)\n reset_client = rospy.ServiceProxy('wouse_run_stop', WouseRunStop)\n rospy.loginfo(\"[Wouse Reset]: Found wouse run stop service.\")\nexcept: \n rospy.logwarn(\"[Wouse Reset]: Could not find wouse run stop service.\")\n sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L11_C4", "label": "wait_for_service()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "vector": [8, 1, 0.4074, 0.037, 1, 0.49, 0.0, 617, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service('/wouse_run_stop', 10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Assign_L12_C4", "label": "reset_client = ServiceProxy()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "vector": [14, 1, 0.4444, 0.037, 1, 0.49, 0.5, 598, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "reset_client", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " reset_client = rospy.ServiceProxy('wouse_run_stop', WouseRunStop)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L13_C4", "label": "loginfo()", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "vector": [8, 1, 0.4815, 0.037, 1, 0.49, 1.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"[Wouse Reset]: Found wouse run stop service.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L15_C4", "label": "logwarn()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "vector": [8, 1, 0.5556, 0.037, 1, 0.49, 0.0, 736, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logwarn", "arg_names": [], "import_names": [], "rhs_call_name": "logwarn", "annotation": ""}, "snippet": " rospy.logwarn(\"[Wouse Reset]: Could not find wouse run stop service.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L16_C4", "label": "exit()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "vector": [8, 1, 0.5926, 0.037, 1, 0.49, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Assign_L18_C0", "label": "req = WouseRunStopRequest()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.037, 0, 0.66, 0.7, 233, 3, 0, 0, 0, 714, 10, 1], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "WouseRunStopRequest", "annotation": ""}, "snippet": "req = WouseRunStopRequest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Assign_L19_C0", "label": "req.start =", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.7037, 0.037, 0, 0.66, 0.8, 532, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "req.start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "req.start = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Assign_L20_C0", "label": "success = reset_client()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.7407, 0.037, 0, 0.66, 0.9, 761, 3, 1, 0, 0, 598, 10, 1], "semantic": {"name": "success", "arg_names": [], "import_names": [], "rhs_call_name": "reset_client", "annotation": ""}, "snippet": "success = reset_client(req)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:If_L22_C0", "label": "if", "type": "if", "loc": [22, 25], "level": 0, "parent": null, "vector": [4, 0, 0.8704, 0.1481, 0, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if success:\n rospy.loginfo(\"[Wouse Reset]: Reset returned successfully.\")\nelse:\n rospy.logwarn(\"[Wouse Reset]: Reset reported failure.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L23_C4", "label": "loginfo()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99463:If_L22_C0", "vector": [8, 1, 0.8519, 0.037, 1, 0.34, 0.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"[Wouse Reset]: Reset returned successfully.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L25_C4", "label": "logwarn()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99463:If_L22_C0", "vector": [8, 1, 0.9259, 0.037, 1, 0.34, 1.0, 736, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logwarn", "arg_names": [], "import_names": [], "rhs_call_name": "logwarn", "annotation": ""}, "snippet": " rospy.logwarn(\"[Wouse Reset]: Reset reported failure.\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99463:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99463:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99463:If_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99463:If_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99463:Expr_L25_C4"}] |
#!/usr/bin/env python
import pickle
import numpy as np
from scipy import interp
import pylab as pl
from sklearn import preprocessing as pps, svm
from sklearn.metrics import roc_curve, auc
from sklearn.cross_validation import StratifiedKFold, LeaveOneOut
with open('../data/svm_data.pkl', 'rb') as f:
svm_data = pickle.load(f)
labels = svm_data['labels']
data = svm_data['data']
scaler = pps.Scaler().fit(data)
print "Mean: ", scaler.mean_
print "Std: ", scaler.std_
data_scaled = scaler.transform(data)
classifier = svm.SVC(probability=True)
classifier.fit(data_scaled, labels)
#print "Support Vectors: \r\n", classifier.support_vectors_
print "SV's per class: \r\n", classifier.n_support_
###############################################################################
## Code below modified from http://scikit-learn.org/stable/auto_examples/plot_roc_crossval.html#example-plot-roc-crossval-py
X, y = data_scaled, np.array(labels)
n_samples, n_features = X.shape
print n_samples, n_features
###############################################################################
# Classification and ROC analysis
# Run classifier with crossvalidation and plot ROC curves
cv = StratifiedKFold(y, k=9)
mean_tpr = 0.0
mean_fpr = np.linspace(0, 1, n_samples)
all_tpr = []
for i, (train, test) in enumerate(cv):
probas_ = classifier.fit(X[train], y[train]).predict_proba(X[test])
# Compute ROC curve and area the curve
fpr, tpr, thresholds = roc_curve(y[test], probas_[:, 1])
mean_tpr += interp(mean_fpr, fpr, tpr)
mean_tpr[0] = 0.0
roc_auc = auc(fpr, tpr)
pl.plot(fpr, tpr, '--', lw=1, label='ROC fold %d (area = %0.2f)' % (i, roc_auc))
pl.plot([0, 1], [0, 1], '--', color=(0.6, 0.6, 0.6), label='Luck')
mean_tpr /= len(cv)
mean_tpr[-1] = 1.0
mean_auc = auc(mean_fpr, mean_tpr)
pl.plot(mean_fpr, mean_tpr, 'k-', lw=3,
label='Mean ROC (area = %0.2f)' % mean_auc)
pl.xlim([0, 1])
pl.ylim([0, 1])
pl.xlabel('False Positive Rate')
pl.ylabel('True Positive Rate')
pl.title('Receiver Operating Characteristic')
pl.legend(loc="lower right")
pl.show()
| ajibawa-2023/Python-Code-Large/train/row_99464 | 41 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Import_L3_C0", "label": "pickle import pickle", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0448, 0.0149, 0, 0.66, 0.0, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0597, 0.0149, 0, 0.66, 0.0294, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:ImportFrom_L5_C0", "label": "from scipy import interp", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0746, 0.0149, 0, 0.66, 0.0588, 265, 0, 1, 0, 0, 265, 0, 0], "semantic": {"name": "scipy", "arg_names": [], "import_names": ["interp"], "rhs_call_name": "", "annotation": ""}, "snippet": "from scipy import interp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Import_L6_C0", "label": "pylab import pl", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0896, 0.0149, 0, 0.66, 0.0882, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:ImportFrom_L8_C0", "label": "from sklearn import pps, svm", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1194, 0.0149, 0, 0.66, 0.1176, 259, 0, 2, 0, 0, 259, 0, 0], "semantic": {"name": "sklearn", "arg_names": [], "import_names": ["pps", "svm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sklearn import preprocessing as pps, svm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:ImportFrom_L9_C0", "label": "from sklearn.metrics import roc_curve, auc", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1343, 0.0149, 0, 0.66, 0.1471, 848, 0, 2, 0, 0, 848, 0, 0], "semantic": {"name": "sklearn.metrics", "arg_names": [], "import_names": ["roc_curve", "auc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sklearn.metrics import roc_curve, auc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:ImportFrom_L10_C0", "label": "from sklearn.cross_validation import StratifiedKFold, LeaveOneOut", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1493, 0.0149, 0, 0.66, 0.1765, 625, 0, 2, 0, 0, 625, 0, 0], "semantic": {"name": "sklearn.cross_validation", "arg_names": [], "import_names": ["StratifiedKFold", "LeaveOneOut"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sklearn.cross_validation import StratifiedKFold, LeaveOneOut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L13_C4", "label": "svm_data = load()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.194, 0.0149, 0, 0.66, 0.0, 591, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "svm_data", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " svm_data = pickle.load(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L14_C0", "label": "labels =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.209, 0.0149, 0, 0.66, 0.2353, 283, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "labels = svm_data['labels']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L15_C0", "label": "data =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.2239, 0.0149, 0, 0.66, 0.2647, 929, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "data = svm_data['data']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L17_C0", "label": "scaler = fit()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.2537, 0.0149, 0, 0.66, 0.2941, 702, 3, 1, 0, 0, 828, 10, 2], "semantic": {"name": "scaler", "arg_names": [], "import_names": [], "rhs_call_name": "fit", "annotation": ""}, "snippet": "scaler = pps.Scaler().fit(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L18_C0", "label": "print()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.2687, 0.0149, 0, 0.66, 0.3235, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Mean: \", scaler.mean_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L19_C0", "label": "print()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.2836, 0.0149, 0, 0.66, 0.3529, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Std: \", scaler.std_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L20_C0", "label": "data_scaled = transform()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.2985, 0.0149, 0, 0.66, 0.3824, 579, 3, 1, 0, 0, 48, 10, 1], "semantic": {"name": "data_scaled", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": "data_scaled = scaler.transform(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L22_C0", "label": "classifier = SVC()", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.3284, 0.0149, 0, 0.66, 0.4118, 71, 3, 1, 0, 0, 706, 10, 1], "semantic": {"name": "classifier", "arg_names": [], "import_names": [], "rhs_call_name": "SVC", "annotation": ""}, "snippet": "classifier = svm.SVC(probability=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L23_C0", "label": "fit()", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.3433, 0.0149, 0, 0.66, 0.4412, 828, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "fit", "arg_names": [], "import_names": [], "rhs_call_name": "fit", "annotation": ""}, "snippet": "classifier.fit(data_scaled, labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L26_C0", "label": "print()", "type": "expression", "loc": [26, 26], "level": 0, "parent": null, "vector": [8, 0, 0.3881, 0.0149, 0, 0.66, 0.4706, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"SV's per class: \\r\\n\", classifier.n_support_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L31_C0", "label": "X, y =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.4627, 0.0149, 0, 0.66, 0.5, 218, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "X, y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "X, y = data_scaled, np.array(labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L32_C0", "label": "n_samples, n_features =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4776, 0.0149, 0, 0.66, 0.5294, 410, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "n_samples, n_features", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "n_samples, n_features = X.shape"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L33_C0", "label": "print()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.4925, 0.0149, 0, 0.66, 0.5588, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(n_samples, n_features)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L38_C0", "label": "cv = StratifiedKFold()", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.5672, 0.0149, 0, 0.66, 0.5882, 492, 3, 2, 0, 0, 661, 10, 1], "semantic": {"name": "cv", "arg_names": [], "import_names": [], "rhs_call_name": "StratifiedKFold", "annotation": ""}, "snippet": "cv = StratifiedKFold(y, k=9)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L40_C0", "label": "mean_tpr =", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.597, 0.0149, 0, 0.66, 0.6176, 499, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "mean_tpr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mean_tpr = 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L41_C0", "label": "mean_fpr = linspace()", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.6119, 0.0149, 0, 0.66, 0.6471, 485, 3, 3, 0, 0, 119, 10, 1], "semantic": {"name": "mean_fpr", "arg_names": [], "import_names": [], "rhs_call_name": "linspace", "annotation": ""}, "snippet": "mean_fpr = np.linspace(0, 1, n_samples)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L42_C0", "label": "all_tpr =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.6269, 0.0149, 0, 0.66, 0.6765, 286, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "all_tpr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "all_tpr = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "label": "for i", "type": "for", "loc": [44, 51], "level": 0, "parent": null, "vector": [6, 0, 0.709, 0.1194, 0, 0.66, 0.7059, 826, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i, (train, test) in enumerate(cv):\n probas_ = classifier.fit(X[train], y[train]).predict_proba(X[test])\n # Compute ROC curve and area the curve\n fpr, tpr, thresholds = roc_curve(y[test], probas_[:, 1])\n mean_tpr += interp(mean_fpr, fpr, tpr)\n mean_tpr[0] = 0.0\n roc_auc = auc(fpr, tpr)\n pl.plot(fpr, tpr, '--', lw=1, label='ROC fold %d (area = %0.2f)' % (i, roc_auc))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L45_C4", "label": "probas_ = predict_proba()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "vector": [14, 1, 0.6716, 0.0149, 1, 0.75, 0.0, 513, 3, 1, 0, 0, 825, 10, 2], "semantic": {"name": "probas_", "arg_names": [], "import_names": [], "rhs_call_name": "predict_proba", "annotation": ""}, "snippet": " probas_ = classifier.fit(X[train], y[train]).predict_proba(X[test])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L47_C4", "label": "fpr, tpr, thresholds = roc_curve()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "vector": [14, 1, 0.7015, 0.0149, 1, 0.75, 0.25, 102, 3, 2, 0, 0, 522, 10, 1], "semantic": {"name": "fpr, tpr, thresholds", "arg_names": [], "import_names": [], "rhs_call_name": "roc_curve", "annotation": ""}, "snippet": " fpr, tpr, thresholds = roc_curve(y[test], probas_[:, 1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L49_C4", "label": "assign", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "vector": [14, 1, 0.7313, 0.0149, 1, 0.75, 0.5, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mean_tpr[0] = 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L50_C4", "label": "roc_auc = auc()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "vector": [14, 1, 0.7463, 0.0149, 1, 0.75, 0.75, 813, 3, 2, 0, 0, 274, 10, 1], "semantic": {"name": "roc_auc", "arg_names": [], "import_names": [], "rhs_call_name": "auc", "annotation": ""}, "snippet": " roc_auc = auc(fpr, tpr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L51_C4", "label": "plot()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "vector": [8, 1, 0.7612, 0.0149, 1, 0.75, 1.0, 929, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pl.plot(fpr, tpr, '--', lw=1, label='ROC fold %d (area = %0.2f)' % (i, roc_auc))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L53_C0", "label": "plot()", "type": "expression", "loc": [53, 53], "level": 0, "parent": null, "vector": [8, 0, 0.791, 0.0149, 0, 0.66, 0.7353, 929, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": "pl.plot([0, 1], [0, 1], '--', color=(0.6, 0.6, 0.6), label='Luck')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L56_C0", "label": "assign", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.8358, 0.0149, 0, 0.66, 0.7941, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mean_tpr[-1] = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L57_C0", "label": "mean_auc = auc()", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.8507, 0.0149, 0, 0.66, 0.8235, 433, 3, 2, 0, 0, 274, 10, 1], "semantic": {"name": "mean_auc", "arg_names": [], "import_names": [], "rhs_call_name": "auc", "annotation": ""}, "snippet": "mean_auc = auc(mean_fpr, mean_tpr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L58_C0", "label": "plot()", "type": "expression", "loc": [58, 59], "level": 0, "parent": null, "vector": [8, 0, 0.8731, 0.0299, 0, 0.66, 0.8529, 929, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": "pl.plot(mean_fpr, mean_tpr, 'k-', lw=3,\n label='Mean ROC (area = %0.2f)' % mean_auc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L61_C0", "label": "xlim()", "type": "expression", "loc": [61, 61], "level": 0, "parent": null, "vector": [8, 0, 0.9104, 0.0149, 0, 0.66, 0.8824, 907, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlim", "arg_names": [], "import_names": [], "rhs_call_name": "xlim", "annotation": ""}, "snippet": "pl.xlim([0, 1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L62_C0", "label": "ylim()", "type": "expression", "loc": [62, 62], "level": 0, "parent": null, "vector": [8, 0, 0.9254, 0.0149, 0, 0.66, 0.9118, 247, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylim", "arg_names": [], "import_names": [], "rhs_call_name": "ylim", "annotation": ""}, "snippet": "pl.ylim([0, 1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L63_C0", "label": "xlabel()", "type": "expression", "loc": [63, 63], "level": 0, "parent": null, "vector": [8, 0, 0.9403, 0.0149, 0, 0.66, 0.9412, 676, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "xlabel", "annotation": ""}, "snippet": "pl.xlabel('False Positive Rate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L64_C0", "label": "ylabel()", "type": "expression", "loc": [64, 64], "level": 0, "parent": null, "vector": [8, 0, 0.9552, 0.0149, 0, 0.66, 0.9706, 584, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "ylabel", "annotation": ""}, "snippet": "pl.ylabel('True Positive Rate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L65_C0", "label": "title()", "type": "expression", "loc": [65, 65], "level": 0, "parent": null, "vector": [8, 0, 0.9701, 0.0149, 0, 0.66, 1.0, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": "pl.title('Receiver Operating Characteristic')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L66_C0", "label": "legend()", "type": "expression", "loc": [66, 66], "level": 0, "parent": null, "vector": [8, 0, 0.9851, 0.0149, 0, 0.66, 1.0294, 880, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": "pl.legend(loc=\"lower right\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L67_C0", "label": "show()", "type": "expression", "loc": [67, 67], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0149, 0, 0.66, 1.0588, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": "pl.show()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99464:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99464:For_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99464:Expr_L51_C4"}] |
#!/usr/bin/env python
import roslib; roslib.load_manifest('wouse')
import rospy
from std_msgs.msg import Header, Bool, String
from pr2_power_board.srv import PowerBoardCommand2, PowerBoardCommand2Request
from std_srvs.srv import Empty, EmptyRequest
from sound_play.libsoundplay import SoundClient
from wouse.srv import WouseRunStop
CIRCUITS=[0,1,2] #Base, Right arm, Left Arm circuits
DEAD_MAN_CONFIGURATION=False
class RunStop(object):
"""Provide utility functions for starting/stopping PR2."""
def __init__(self):
"""Establish service connections for motors, power board."""
self.init_successful = True
try:
rospy.wait_for_service('pr2_etherCAT/halt_motors', 5)
self.halt_motors_client=rospy.ServiceProxy('pr2_etherCAT/halt_motors',Empty)
rospy.loginfo("Found halt motors service")
except:
rospy.logerr("Cannot find halt motors service")
self.init_successful = False
try:
rospy.wait_for_service('pr2_etherCAT/reset_motors',5)
self.reset_motors_client=rospy.ServiceProxy('pr2_etherCAT/reset_motors',Empty)
rospy.loginfo("Found reset motors service")
except:
rospy.logerr("Cannot find halt motors service")
self.init_successful = False
try:
rospy.wait_for_service('power_board/control2',5)
self.power_board_client=rospy.ServiceProxy('power_board/control2',PowerBoardCommand2)
rospy.loginfo("Found power_board/control2 service")
except:
rospy.logerr("Cannot find power_board/control2 service")
self.init_successful = False
def stop(self):
"""Halt motors, place power board into standboy. Stops robot."""
self.halt_motors_client(EmptyRequest()) #Halt motors immediately
success = [False, False, False]
for circuit in CIRCUITS:
success[circuit] = self.standby_power(circuit)
if success[0] and success[1] and success[2]:
return True
else:
return False
def start(self):
"""Reset power board, reset motors. Un-does 'run_stop'."""
success = [False, False, False]
for circuit in CIRCUITS:
success[circuit] = self.reset_power(circuit)
if success[0] and success[1] and success[2]:
rospy.sleep(2.0)
self.reset_motors_client(EmptyRequest())
return True
else:
return False
def standby_power(self, circuit):
"""Place PR2 power board into standby"""
stdby_cmd = PowerBoardCommand2Request()
stdby_cmd.circuit = circuit
stdby_cmd.command = "stop"
return self.power_board_client(stdby_cmd)
def reset_power(self,circuit):
"""Reset PR2 power board to active from standby"""
reset_cmd = PowerBoardCommand2Request()
reset_cmd.circuit = circuit
reset_cmd.command = "start"
return self.power_board_client(reset_cmd)
class RunStopServer(object):
def __init__(self):
"""Provide dead-man-switch like server for handling wouse run-stops."""
rospy.Service("wouse_run_stop", WouseRunStop, self.service_cb)
self.run_stop = RunStop()
if DEAD_MAN_CONFIGURATION:
self.sound_client = SoundClient()
self.timeout = rospy.Duration(rospy.get_param('wouse_timeout', 1.5))
self.tone_period = rospy.Duration(10)
self.last_active_time = rospy.Time.now()
self.last_sound = rospy.Time.now()
rospy.Timer(self.timeout, self.check_receiving)
def check_receiving(self, event):
"""After timeout, check to ensure that activity is seen from wouse."""
silence = rospy.Time.now() - self.last_active_time
#print silence, " / ", self.timeout
if silence < self.timeout:
# print "Receiving"
return
#else:
# print "NOT receiving"
if (silence > self.timeout and (rospy.Time.now() - self.last_sound) > self.tone_period):
rospy.logwarn("RunStopServer has not heard from wouse recently.")
self.sound_client.play(3)#1
self.last_sound = rospy.Time.now()
def service_cb(self, req):
"""Handle service requests to start/stop run-stop. Used to reset."""
#print "Separation: ", req.time-self.last_active_time
self.last_active_time = req.time
#print "Delay: ", rospy.Time.now() - self.last_active_time
if req.stop:
return self.run_stop.stop()
elif req.start:
return self.run_stop.start()
else:
return True #only update timestamp
if __name__=='__main__':
rospy.init_node('run_stop_server')
rss = RunStopServer()
rospy.spin()
| ajibawa-2023/Python-Code-Large/train/row_99465 | 97 | 124 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Import_L3_C0", "label": "roslib import roslib", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0242, 0.0081, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L3_C15", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0242, 0.0081, 0, 0.66, 0.0833, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Import_L4_C0", "label": "rospy import rospy", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0081, 0, 0.66, 0.1667, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:ImportFrom_L5_C0", "label": "from std_msgs.msg import Header, Bool, String", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0403, 0.0081, 0, 0.66, 0.25, 366, 0, 3, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Header", "Bool", "String"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Header, Bool, String"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:ImportFrom_L6_C0", "label": "from pr2_power_board.srv import PowerBoardCommand2, PowerBoardCommand2Request", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0484, 0.0081, 0, 0.66, 0.3333, 190, 0, 2, 0, 0, 190, 0, 0], "semantic": {"name": "pr2_power_board.srv", "arg_names": [], "import_names": ["PowerBoardCommand2", "PowerBoardCommand2Request"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pr2_power_board.srv import PowerBoardCommand2, PowerBoardCommand2Request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:ImportFrom_L7_C0", "label": "from std_srvs.srv import Empty, EmptyRequest", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0565, 0.0081, 0, 0.66, 0.4167, 261, 0, 2, 0, 0, 261, 0, 0], "semantic": {"name": "std_srvs.srv", "arg_names": [], "import_names": ["Empty", "EmptyRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_srvs.srv import Empty, EmptyRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:ImportFrom_L8_C0", "label": "from sound_play.libsoundplay import SoundClient", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0081, 0, 0.66, 0.5, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "sound_play.libsoundplay", "arg_names": [], "import_names": ["SoundClient"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sound_play.libsoundplay import SoundClient"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:ImportFrom_L10_C0", "label": "from wouse.srv import WouseRunStop", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0806, 0.0081, 0, 0.66, 0.5833, 855, 0, 1, 0, 0, 855, 0, 0], "semantic": {"name": "wouse.srv", "arg_names": [], "import_names": ["WouseRunStop"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wouse.srv import WouseRunStop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L12_C0", "label": "CIRCUITS =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0968, 0.0081, 0, 0.66, 0.6667, 732, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "CIRCUITS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CIRCUITS=[0,1,2] #Base, Right arm, Left Arm circuits"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L13_C0", "label": "DEAD_MAN_CONFIGURATION =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1048, 0.0081, 0, 0.66, 0.75, 913, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "DEAD_MAN_CONFIGURATION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEAD_MAN_CONFIGURATION=False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "label": "RunStop", "type": "class", "loc": [15, 79], "level": 0, "parent": null, "vector": [3, 0, 0.379, 0.5242, 0, 0.66, 0.8333, 672, 0, 5, 0, 0, 186, 0, 23], "semantic": {"name": "RunStop", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RunStop(object):\n \"\"\"Provide utility functions for starting/stopping PR2.\"\"\"\n def __init__(self):\n \"\"\"Establish service connections for motors, power board.\"\"\"\n self.init_successful = True\n try:\n rospy.wait_for_service('pr2_etherCAT/halt_motors', 5) \n self.halt_motors_client=rospy.ServiceProxy('pr2_etherCAT/halt_motors',Empty)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "vector": [8, 1, 0.129, 0.0081, 1, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Provide utility functions for starting/stopping PR2.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "label": "__init__", "type": "function", "loc": [17, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "vector": [2, 1, 0.2379, 0.2097, 1, 0.3, 0.2, 555, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n \"\"\"Establish service connections for motors, power board.\"\"\"\n self.init_successful = True\n try:\n rospy.wait_for_service('pr2_etherCAT/halt_motors', 5) \n self.halt_motors_client=rospy.ServiceProxy('pr2_etherCAT/halt_motors',Empty)\n rospy.loginfo(\"Found halt motors service\")\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L18_C8", "label": "expression", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "vector": [8, 2, 0.1452, 0.0081, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Establish service connections for motors, power board.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L19_C8", "label": "self.init_successful =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "vector": [14, 2, 0.1532, 0.0081, 2, 0.82, 0.25, 293, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init_successful", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init_successful = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "label": "try", "type": "try", "loc": [20, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "vector": [7, 2, 0.1855, 0.0565, 2, 0.82, 0.5, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.wait_for_service('pr2_etherCAT/halt_motors', 5) \n self.halt_motors_client=rospy.ServiceProxy('pr2_etherCAT/halt_motors',Empty)\n rospy.loginfo(\"Found halt motors service\")\n except:\n rospy.logerr(\"Cannot find halt motors service\")\n self.init_successful = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L21_C12", "label": "wait_for_service()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "vector": [8, 3, 0.1694, 0.0081, 3, 0.57, 0.0, 617, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service('pr2_etherCAT/halt_motors', 5) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L22_C12", "label": "self.halt_motors_client = ServiceProxy()", "type": "assigned_variable", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "vector": [14, 3, 0.1774, 0.0081, 3, 0.57, 0.5, 47, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self.halt_motors_client", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self.halt_motors_client=rospy.ServiceProxy('pr2_etherCAT/halt_motors',Empty)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L23_C12", "label": "loginfo()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "vector": [8, 3, 0.1855, 0.0081, 3, 0.57, 1.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"Found halt motors service\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L25_C12", "label": "logerr()", "type": "expression", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "vector": [8, 3, 0.2016, 0.0081, 3, 0.57, 0.0, 747, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logerr", "arg_names": [], "import_names": [], "rhs_call_name": "logerr", "annotation": ""}, "snippet": " rospy.logerr(\"Cannot find halt motors service\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L26_C12", "label": "self.init_successful =", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "vector": [14, 3, 0.2097, 0.0081, 3, 0.57, 1.0, 293, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init_successful", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init_successful = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "label": "try", "type": "try", "loc": [28, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "vector": [7, 2, 0.25, 0.0565, 2, 0.82, 0.75, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.wait_for_service('pr2_etherCAT/reset_motors',5)\n self.reset_motors_client=rospy.ServiceProxy('pr2_etherCAT/reset_motors',Empty)\n rospy.loginfo(\"Found reset motors service\")\n except:\n rospy.logerr(\"Cannot find halt motors service\")\n self.init_successful = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L29_C12", "label": "wait_for_service()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "vector": [8, 3, 0.2339, 0.0081, 3, 0.06, 0.0, 617, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service('pr2_etherCAT/reset_motors',5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L30_C12", "label": "self.reset_motors_client = ServiceProxy()", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "vector": [14, 3, 0.2419, 0.0081, 3, 0.06, 0.5, 782, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self.reset_motors_client", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self.reset_motors_client=rospy.ServiceProxy('pr2_etherCAT/reset_motors',Empty)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L31_C12", "label": "loginfo()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "vector": [8, 3, 0.25, 0.0081, 3, 0.06, 1.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"Found reset motors service\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L33_C12", "label": "logerr()", "type": "expression", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "vector": [8, 3, 0.2661, 0.0081, 3, 0.06, 0.0, 747, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logerr", "arg_names": [], "import_names": [], "rhs_call_name": "logerr", "annotation": ""}, "snippet": " rospy.logerr(\"Cannot find halt motors service\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L34_C12", "label": "self.init_successful =", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "vector": [14, 3, 0.2742, 0.0081, 3, 0.06, 1.0, 293, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init_successful", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init_successful = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "label": "try", "type": "try", "loc": [36, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "vector": [7, 2, 0.3145, 0.0565, 2, 0.82, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.wait_for_service('power_board/control2',5)\n self.power_board_client=rospy.ServiceProxy('power_board/control2',PowerBoardCommand2)\n rospy.loginfo(\"Found power_board/control2 service\")\n except:\n rospy.logerr(\"Cannot find power_board/control2 service\")\n self.init_successful = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L37_C12", "label": "wait_for_service()", "type": "expression", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "vector": [8, 3, 0.2984, 0.0081, 3, 0.8, 0.0, 617, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service('power_board/control2',5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L38_C12", "label": "self.power_board_client = ServiceProxy()", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "vector": [14, 3, 0.3065, 0.0081, 3, 0.8, 0.5, 217, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self.power_board_client", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self.power_board_client=rospy.ServiceProxy('power_board/control2',PowerBoardCommand2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L39_C12", "label": "loginfo()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "vector": [8, 3, 0.3145, 0.0081, 3, 0.8, 1.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"Found power_board/control2 service\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L41_C12", "label": "logerr()", "type": "expression", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "vector": [8, 3, 0.3306, 0.0081, 3, 0.8, 0.0, 747, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logerr", "arg_names": [], "import_names": [], "rhs_call_name": "logerr", "annotation": ""}, "snippet": " rospy.logerr(\"Cannot find power_board/control2 service\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L42_C12", "label": "self.init_successful =", "type": "assigned_variable", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "vector": [14, 3, 0.3387, 0.0081, 3, 0.8, 1.0, 293, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init_successful", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init_successful = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "label": "stop", "type": "function", "loc": [44, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "vector": [2, 1, 0.3911, 0.0806, 1, 0.3, 0.4, 343, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self):\n \"\"\"Halt motors, place power board into standboy. Stops robot.\"\"\"\n self.halt_motors_client(EmptyRequest()) #Halt motors immediately\n success = [False, False, False]\n for circuit in CIRCUITS:\n success[circuit] = self.standby_power(circuit)\n if success[0] and success[1] and success[2]:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L45_C8", "label": "expression", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "vector": [8, 2, 0.3629, 0.0081, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Halt motors, place power board into standboy. Stops robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L46_C8", "label": "halt_motors_client()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "vector": [8, 2, 0.371, 0.0081, 2, 0.88, 0.25, 288, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "halt_motors_client", "arg_names": [], "import_names": [], "rhs_call_name": "halt_motors_client", "annotation": ""}, "snippet": " self.halt_motors_client(EmptyRequest()) #Halt motors immediately"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L47_C8", "label": "success =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "vector": [14, 2, 0.379, 0.0081, 2, 0.88, 0.5, 761, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "success", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " success = [False, False, False]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:For_L48_C8", "label": "for circuit", "type": "for", "loc": [48, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "vector": [6, 2, 0.3911, 0.0161, 2, 0.88, 0.75, 628, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "circuit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for circuit in CIRCUITS:\n success[circuit] = self.standby_power(circuit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L49_C12", "label": " = standby_power()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:For_L48_C8", "vector": [14, 3, 0.3952, 0.0081, 3, 0.68, 0.0, 0, 3, 1, 0, 0, 869, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "standby_power", "annotation": ""}, "snippet": " success[circuit] = self.standby_power(circuit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L50_C8", "label": "if", "type": "if", "loc": [50, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "vector": [4, 2, 0.4153, 0.0323, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if success[0] and success[1] and success[2]:\n return True\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L50_C8", "vector": [13, 3, 0.4113, 0.0081, 3, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L53_C12", "label": "return", "type": "return", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L50_C8", "vector": [13, 3, 0.4274, 0.0081, 3, 0.31, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "label": "start", "type": "function", "loc": [55, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "vector": [2, 1, 0.4839, 0.0887, 1, 0.3, 0.6, 511, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self):\n \"\"\"Reset power board, reset motors. Un-does 'run_stop'.\"\"\"\n success = [False, False, False]\n for circuit in CIRCUITS:\n success[circuit] = self.reset_power(circuit)\n if success[0] and success[1] and success[2]:\n rospy.sleep(2.0)\n self.reset_motors_client(EmptyRequest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L56_C8", "label": "expression", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "vector": [8, 2, 0.4516, 0.0081, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Reset power board, reset motors. Un-does 'run_stop'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L57_C8", "label": "success =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "vector": [14, 2, 0.4597, 0.0081, 2, 0.13, 0.3333, 761, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "success", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " success = [False, False, False]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:For_L58_C8", "label": "for circuit", "type": "for", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "vector": [6, 2, 0.4718, 0.0161, 2, 0.13, 0.6667, 628, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "circuit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for circuit in CIRCUITS:\n success[circuit] = self.reset_power(circuit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L59_C12", "label": " = reset_power()", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:For_L58_C8", "vector": [14, 3, 0.4758, 0.0081, 3, 0.73, 0.0, 0, 3, 1, 0, 0, 194, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "reset_power", "annotation": ""}, "snippet": " success[circuit] = self.reset_power(circuit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "label": "if", "type": "if", "loc": [60, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "vector": [4, 2, 0.504, 0.0484, 2, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if success[0] and success[1] and success[2]:\n rospy.sleep(2.0)\n self.reset_motors_client(EmptyRequest())\n return True\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L61_C12", "label": "sleep()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "vector": [8, 3, 0.4919, 0.0081, 3, 0.6, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(2.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L62_C12", "label": "reset_motors_client()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "vector": [8, 3, 0.5, 0.0081, 3, 0.6, 0.3333, 461, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "reset_motors_client", "arg_names": [], "import_names": [], "rhs_call_name": "reset_motors_client", "annotation": ""}, "snippet": " self.reset_motors_client(EmptyRequest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L63_C12", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "vector": [13, 3, 0.5081, 0.0081, 3, 0.6, 0.6667, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L65_C12", "label": "return", "type": "return", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "vector": [13, 3, 0.5242, 0.0081, 3, 0.6, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "label": "standby_power", "type": "function", "loc": [67, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "vector": [2, 1, 0.5605, 0.0484, 1, 0.3, 0.8, 869, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "standby_power", "arg_names": ["self", "circuit"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def standby_power(self, circuit):\n \"\"\"Place PR2 power board into standby\"\"\"\n stdby_cmd = PowerBoardCommand2Request()\n stdby_cmd.circuit = circuit\n stdby_cmd.command = \"stop\"\n return self.power_board_client(stdby_cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L68_C8", "label": "expression", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "vector": [8, 2, 0.5484, 0.0081, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Place PR2 power board into standby\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L69_C8", "label": "stdby_cmd = PowerBoardCommand2Request()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "vector": [14, 2, 0.5565, 0.0081, 2, 0.1, 0.25, 986, 3, 0, 0, 0, 593, 10, 1], "semantic": {"name": "stdby_cmd", "arg_names": [], "import_names": [], "rhs_call_name": "PowerBoardCommand2Request", "annotation": ""}, "snippet": " stdby_cmd = PowerBoardCommand2Request()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L70_C8", "label": "stdby_cmd.circuit =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "vector": [14, 2, 0.5645, 0.0081, 2, 0.1, 0.5, 490, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "stdby_cmd.circuit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stdby_cmd.circuit = circuit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L71_C8", "label": "stdby_cmd.command =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "vector": [14, 2, 0.5726, 0.0081, 2, 0.1, 0.75, 572, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "stdby_cmd.command", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stdby_cmd.command = \"stop\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L72_C8", "label": "return", "type": "return", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "vector": [13, 2, 0.5806, 0.0081, 2, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.power_board_client(stdby_cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "label": "reset_power", "type": "function", "loc": [74, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "vector": [2, 1, 0.6169, 0.0484, 1, 0.3, 1.0, 194, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "reset_power", "arg_names": ["self", "circuit"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reset_power(self,circuit):\n \"\"\"Reset PR2 power board to active from standby\"\"\"\n reset_cmd = PowerBoardCommand2Request()\n reset_cmd.circuit = circuit\n reset_cmd.command = \"start\"\n return self.power_board_client(reset_cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L75_C8", "label": "expression", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "vector": [8, 2, 0.6048, 0.0081, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Reset PR2 power board to active from standby\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L76_C8", "label": "reset_cmd = PowerBoardCommand2Request()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "vector": [14, 2, 0.6129, 0.0081, 2, 0.42, 0.25, 901, 3, 0, 0, 0, 593, 10, 1], "semantic": {"name": "reset_cmd", "arg_names": [], "import_names": [], "rhs_call_name": "PowerBoardCommand2Request", "annotation": ""}, "snippet": " reset_cmd = PowerBoardCommand2Request()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L77_C8", "label": "reset_cmd.circuit =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "vector": [14, 2, 0.621, 0.0081, 2, 0.42, 0.5, 246, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "reset_cmd.circuit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " reset_cmd.circuit = circuit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L78_C8", "label": "reset_cmd.command =", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "vector": [14, 2, 0.629, 0.0081, 2, 0.42, 0.75, 295, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "reset_cmd.command", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " reset_cmd.command = \"start\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L79_C8", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "vector": [13, 2, 0.6371, 0.0081, 2, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.power_board_client(reset_cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L82_C0", "label": "RunStopServer", "type": "class", "loc": [82, 119], "level": 0, "parent": null, "vector": [3, 0, 0.8105, 0.3065, 0, 0.66, 0.9167, 446, 0, 3, 0, 0, 186, 0, 16], "semantic": {"name": "RunStopServer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RunStopServer(object):\n def __init__(self):\n \"\"\"Provide dead-man-switch like server for handling wouse run-stops.\"\"\"\n rospy.Service(\"wouse_run_stop\", WouseRunStop, self.service_cb)\n self.run_stop = RunStop()\n if DEAD_MAN_CONFIGURATION:\n self.sound_client = SoundClient()\n self.timeout = rospy.Duration(rospy.get_param('wouse_timeout', 1.5))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "label": "__init__", "type": "function", "loc": [83, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L82_C0", "vector": [2, 1, 0.7097, 0.0887, 1, 0.05, 0.0, 555, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n \"\"\"Provide dead-man-switch like server for handling wouse run-stops.\"\"\"\n rospy.Service(\"wouse_run_stop\", WouseRunStop, self.service_cb)\n self.run_stop = RunStop()\n if DEAD_MAN_CONFIGURATION:\n self.sound_client = SoundClient()\n self.timeout = rospy.Duration(rospy.get_param('wouse_timeout', 1.5))\n self.tone_period = rospy.Duration(10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L84_C8", "label": "expression", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "vector": [8, 2, 0.6774, 0.0081, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Provide dead-man-switch like server for handling wouse run-stops.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L85_C8", "label": "Service()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "vector": [8, 2, 0.6855, 0.0081, 2, 0.29, 0.3333, 451, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Service", "arg_names": [], "import_names": [], "rhs_call_name": "Service", "annotation": ""}, "snippet": " rospy.Service(\"wouse_run_stop\", WouseRunStop, self.service_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L86_C8", "label": "self.run_stop = RunStop()", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "vector": [14, 2, 0.6935, 0.0081, 2, 0.29, 0.6667, 228, 3, 0, 0, 0, 672, 10, 1], "semantic": {"name": "self.run_stop", "arg_names": [], "import_names": [], "rhs_call_name": "RunStop", "annotation": ""}, "snippet": " self.run_stop = RunStop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "label": "if", "type": "if", "loc": [87, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "vector": [4, 2, 0.7258, 0.0565, 2, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if DEAD_MAN_CONFIGURATION:\n self.sound_client = SoundClient()\n self.timeout = rospy.Duration(rospy.get_param('wouse_timeout', 1.5))\n self.tone_period = rospy.Duration(10)\n self.last_active_time = rospy.Time.now()\n self.last_sound = rospy.Time.now()\n rospy.Timer(self.timeout, self.check_receiving)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L88_C12", "label": "self.sound_client = SoundClient()", "type": "assigned_variable", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "vector": [14, 3, 0.7097, 0.0081, 3, 0.24, 0.0, 697, 3, 0, 0, 0, 943, 10, 1], "semantic": {"name": "self.sound_client", "arg_names": [], "import_names": [], "rhs_call_name": "SoundClient", "annotation": ""}, "snippet": " self.sound_client = SoundClient()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L89_C12", "label": "self.timeout = Duration()", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "vector": [14, 3, 0.7177, 0.0081, 3, 0.24, 0.2, 621, 3, 1, 0, 0, 972, 10, 2], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "Duration", "annotation": ""}, "snippet": " self.timeout = rospy.Duration(rospy.get_param('wouse_timeout', 1.5))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L90_C12", "label": "self.tone_period = Duration()", "type": "assigned_variable", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "vector": [14, 3, 0.7258, 0.0081, 3, 0.24, 0.4, 532, 3, 1, 0, 0, 972, 10, 1], "semantic": {"name": "self.tone_period", "arg_names": [], "import_names": [], "rhs_call_name": "Duration", "annotation": ""}, "snippet": " self.tone_period = rospy.Duration(10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L91_C12", "label": "self.last_active_time = now()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "vector": [14, 3, 0.7339, 0.0081, 3, 0.24, 0.6, 821, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "self.last_active_time", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " self.last_active_time = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L92_C12", "label": "self.last_sound = now()", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "vector": [14, 3, 0.7419, 0.0081, 3, 0.24, 0.8, 564, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "self.last_sound", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " self.last_sound = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L93_C12", "label": "Timer()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "vector": [8, 3, 0.75, 0.0081, 3, 0.24, 1.0, 771, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Timer", "arg_names": [], "import_names": [], "rhs_call_name": "Timer", "annotation": ""}, "snippet": " rospy.Timer(self.timeout, self.check_receiving)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "label": "check_receiving", "type": "function", "loc": [95, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L82_C0", "vector": [2, 1, 0.8145, 0.1048, 1, 0.05, 0.5, 575, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "check_receiving", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check_receiving(self, event):\n \"\"\"After timeout, check to ensure that activity is seen from wouse.\"\"\"\n silence = rospy.Time.now() - self.last_active_time\n #print silence, \" / \", self.timeout\n if silence < self.timeout:\n # print \"Receiving\"\n return\n #else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L96_C8", "label": "expression", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "vector": [8, 2, 0.7742, 0.0081, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"After timeout, check to ensure that activity is seen from wouse.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L97_C8", "label": "silence =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "vector": [14, 2, 0.7823, 0.0081, 2, 0.32, 0.3333, 809, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "silence", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " silence = rospy.Time.now() - self.last_active_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L99_C8", "label": "if", "type": "if", "loc": [99, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "vector": [4, 2, 0.8065, 0.0242, 2, 0.32, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if silence < self.timeout:\n # print \"Receiving\"\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L101_C12", "label": "return", "type": "return", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L99_C8", "vector": [13, 3, 0.8145, 0.0081, 3, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L104_C8", "label": "if", "type": "if", "loc": [104, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "vector": [4, 2, 0.8508, 0.0323, 2, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (silence > self.timeout and (rospy.Time.now() - self.last_sound) > self.tone_period):\n rospy.logwarn(\"RunStopServer has not heard from wouse recently.\")\n self.sound_client.play(3)#1\n self.last_sound = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L105_C12", "label": "logwarn()", "type": "expression", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L104_C8", "vector": [8, 3, 0.8468, 0.0081, 3, 0.96, 0.0, 736, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logwarn", "arg_names": [], "import_names": [], "rhs_call_name": "logwarn", "annotation": ""}, "snippet": " rospy.logwarn(\"RunStopServer has not heard from wouse recently.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L106_C12", "label": "play()", "type": "expression", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L104_C8", "vector": [8, 3, 0.8548, 0.0081, 3, 0.96, 0.5, 836, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "play", "arg_names": [], "import_names": [], "rhs_call_name": "play", "annotation": ""}, "snippet": " self.sound_client.play(3)#1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L107_C12", "label": "self.last_sound = now()", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L104_C8", "vector": [14, 3, 0.8629, 0.0081, 3, 0.96, 1.0, 564, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "self.last_sound", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " self.last_sound = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L109_C4", "label": "service_cb", "type": "function", "loc": [109, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L82_C0", "vector": [2, 1, 0.9194, 0.0887, 1, 0.05, 1.0, 801, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "service_cb", "arg_names": ["self", "req"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def service_cb(self, req):\n \"\"\"Handle service requests to start/stop run-stop. Used to reset.\"\"\"\n #print \"Separation: \", req.time-self.last_active_time\n self.last_active_time = req.time\n #print \"Delay: \", rospy.Time.now() - self.last_active_time\n if req.stop:\n return self.run_stop.stop()\n elif req.start:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L110_C8", "label": "expression", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L109_C4", "vector": [8, 2, 0.8871, 0.0081, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handle service requests to start/stop run-stop. Used to reset.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L112_C8", "label": "self.last_active_time =", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L109_C4", "vector": [14, 2, 0.9032, 0.0081, 2, 0.74, 0.5, 821, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.last_active_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.last_active_time = req.time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L114_C8", "label": "if", "type": "if", "loc": [114, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L109_C4", "vector": [4, 2, 0.9395, 0.0484, 2, 0.74, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if req.stop:\n return self.run_stop.stop()\n elif req.start:\n return self.run_stop.start()\n else:\n return True #only update timestamp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L115_C12", "label": "return", "type": "return", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L114_C8", "vector": [13, 3, 0.9274, 0.0081, 3, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.run_stop.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L116_C8", "label": "if", "type": "if", "loc": [116, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L114_C8", "vector": [4, 3, 0.9476, 0.0323, 3, 0.06, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif req.start:\n return self.run_stop.start()\n else:\n return True #only update timestamp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L117_C12", "label": "return", "type": "return", "loc": [117, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L116_C8", "vector": [13, 4, 0.9435, 0.0081, 4, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.run_stop.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L119_C12", "label": "return", "type": "return", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L116_C8", "vector": [13, 4, 0.9597, 0.0081, 4, 0.82, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True #only update timestamp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L121_C0", "label": "if", "type": "if", "loc": [121, 124], "level": 0, "parent": null, "vector": [4, 0, 0.9879, 0.0323, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__=='__main__':\n rospy.init_node('run_stop_server')\n rss = RunStopServer()\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L122_C4", "label": "init_node()", "type": "expression", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L121_C0", "vector": [8, 1, 0.9839, 0.0081, 1, 0.78, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('run_stop_server')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L123_C4", "label": "rss = RunStopServer()", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L121_C0", "vector": [14, 1, 0.9919, 0.0081, 1, 0.78, 0.5, 865, 3, 0, 0, 0, 446, 10, 1], "semantic": {"name": "rss", "arg_names": [], "import_names": [], "rhs_call_name": "RunStopServer", "annotation": ""}, "snippet": " rss = RunStopServer()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L124_C4", "label": "spin()", "type": "expression", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L121_C0", "vector": [8, 1, 1.0, 0.0081, 1, 0.78, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:Try_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:For_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:For_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:For_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:For_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L99_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L104_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L104_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L104_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:ClassDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Return_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99465:If_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99465:Expr_L124_C4"}] |
#!/usr/bin/env python
import sys
import numpy as np
from threading import Condition
import pickle
import csv
import pygame
from sklearn import preprocessing as pps, svm
import roslib; roslib.load_manifest('wouse')
from Object import ROSObject
import rospy
from std_msgs.msg import Header
from geometry_msgs.msg import Vector3Stamped
from wouse.srv import WouseRunStop, WouseRunStopRequest
class Wouse(object):
"""
Subscribes to mouse movements, detects wincing, and signals e-stop.
"""
def __init__(self, svm_datafile):
"""Initialize svm classifier and needed services."""
try:
rospy.wait_for_service('wouse_run_stop', 5)
self.runstop_client=rospy.ServiceProxy('wouse_run_stop',
WouseRunStop, True)
rospy.loginfo("Found wouse run-stop service")
except:
rospy.logerr("Cannot find wouse run-stop service")
sys.exit()
(self.scaler, self.classifier) = self.init_classifier(svm_datafile)
rospy.loginfo("SVM Trained on data from %s" %svm_datafile)
rospy.Subscriber('wouse_movement', Vector3Stamped, self.movement_cb)
rospy.Timer(rospy.Duration(0.1), self.ping_server)
self.window = []
self.data = []
pygame.init()
self.sound_new = pygame.mixer.Sound('../../sounds/new_item.wav')
#self.csv_writer = csv.writer(open(out_file, 'ab'))
rospy.loginfo("[%s]: Ready" %rospy.get_name())
def init_classifier(self, filename):
"""Unpickle svm training data, train classifier"""
with open(filename, 'rb') as f:
svm_data = pickle.load(f)
labels = svm_data['labels']
data = svm_data['data']
scaler = pps.Scaler().fit(data)
data_scaled = scaler.transform(data)
classifier = svm.SVC()
classifier.fit(data_scaled, labels)
return (scaler, classifier)
def ping_server(self, event):
"""Send updated timestamp to Runstop server."""
req = WouseRunStopRequest(False, False, rospy.Time.now())
self.runstop_client(req)
def movement_cb(self, v3):
"""Filter out small movements, check classifier, call stop if needed."""
#line = [v3.header.stamp.to_sec(), v3.vector.x, v3.vector.y]
#self.csv_writer.writerow(line)
if (v3.vector.x**2+v3.vector.y**2)**(0.5) < 2.5:
return
if self.classify_svm(v3.vector.x, v3.vector.y, v3.header.stamp):
self.runstop_client(WouseRunStopRequest(True, False, rospy.Time.now()))
self.sound_new.play()
rospy.loginfo("Wince Detected, stopping robot!")
else:
rospy.loginfo("Not a wince")
def classify_svm(self, x, y, time):
"""Build the descriptor vector for the incoming mouse event, and classify with the svm."""
datum = []
mag = (x**2+y**2)**(0.5)
angle = np.arctan2(y,x)
datum.append(mag)
datum.append(angle)
self.window.append([x,y,time])
while (self.window[-1][-1] - self.window[0][-1]) > rospy.Duration(0.25):
self.window.pop(0)
win = np.array(self.window)
datum.append(len(self.window))
win_x = np.sum(win[:,0])
win_y = np.sum(win[:,1])
win_mag = (win_x**2+win_y**2)**(0.5)
datum.append(win_mag/len(self.window))
datum.append(np.arctan2(win_y, win_x))
datum_scaled = self.scaler.transform(datum)
prediction = self.classifier.predict(datum_scaled)
if prediction[0] == 1.:
return True
if __name__=='__main__':
rospy.init_node('wouse_node')
wouse = Wouse(sys.argv[1])
rospy.spin()
| ajibawa-2023/Python-Code-Large/train/row_99467 | 81 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0481, 0.0096, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Import_L6_C0", "label": "numpy import np", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0096, 0, 0.66, 0.0667, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:ImportFrom_L7_C0", "label": "from threading import Condition", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0673, 0.0096, 0, 0.66, 0.1333, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Condition"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Condition"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Import_L8_C0", "label": "pickle import pickle", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0096, 0, 0.66, 0.2, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Import_L9_C0", "label": "csv import csv", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0865, 0.0096, 0, 0.66, 0.2667, 312, 0, 1, 0, 0, 312, 0, 0], "semantic": {"name": "csv", "arg_names": [], "import_names": ["csv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import csv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Import_L11_C0", "label": "pygame import pygame", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1058, 0.0096, 0, 0.66, 0.3333, 87, 0, 1, 0, 0, 87, 0, 0], "semantic": {"name": "pygame", "arg_names": [], "import_names": ["pygame"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pygame"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:ImportFrom_L12_C0", "label": "from sklearn import pps, svm", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1154, 0.0096, 0, 0.66, 0.4, 259, 0, 2, 0, 0, 259, 0, 0], "semantic": {"name": "sklearn", "arg_names": [], "import_names": ["pps", "svm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sklearn import preprocessing as pps, svm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Import_L14_C0", "label": "roslib import roslib", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1346, 0.0096, 0, 0.66, 0.4667, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L14_C15", "label": "load_manifest()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.1346, 0.0096, 0, 0.66, 0.5333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:ImportFrom_L15_C0", "label": "from Object import ROSObject", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1442, 0.0096, 0, 0.66, 0.6, 867, 0, 1, 0, 0, 867, 0, 0], "semantic": {"name": "Object", "arg_names": [], "import_names": ["ROSObject"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Object import ROSObject"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Import_L16_C0", "label": "rospy import rospy", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0096, 0, 0.66, 0.6667, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:ImportFrom_L17_C0", "label": "from std_msgs.msg import Header", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1635, 0.0096, 0, 0.66, 0.7333, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Header"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Header"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:ImportFrom_L18_C0", "label": "from geometry_msgs.msg import Vector3Stamped", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1731, 0.0096, 0, 0.66, 0.8, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Vector3Stamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Vector3Stamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:ImportFrom_L20_C0", "label": "from wouse.srv import WouseRunStop, WouseRunStopRequest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1923, 0.0096, 0, 0.66, 0.8667, 855, 0, 2, 0, 0, 855, 0, 0], "semantic": {"name": "wouse.srv", "arg_names": [], "import_names": ["WouseRunStop", "WouseRunStopRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wouse.srv import WouseRunStop, WouseRunStopRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "label": "Wouse", "type": "class", "loc": [23, 99], "level": 0, "parent": null, "vector": [3, 0, 0.5865, 0.7404, 0, 0.66, 0.9333, 173, 0, 5, 0, 0, 186, 0, 48], "semantic": {"name": "Wouse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Wouse(object):\n \"\"\"\n Subscribes to mouse movements, detects wincing, and signals e-stop.\n \"\"\"\n def __init__(self, svm_datafile):\n \"\"\"Initialize svm classifier and needed services.\"\"\"\n try:\n rospy.wait_for_service('wouse_run_stop', 5) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "vector": [8, 1, 0.2404, 0.0288, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Subscribes to mouse movements, detects wincing, and signals e-stop.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "label": "__init__", "type": "function", "loc": [27, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "vector": [2, 1, 0.3558, 0.2019, 1, 0.37, 0.2, 555, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "__init__", "arg_names": ["self", "svm_datafile"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, svm_datafile):\n \"\"\"Initialize svm classifier and needed services.\"\"\"\n try:\n rospy.wait_for_service('wouse_run_stop', 5) \n self.runstop_client=rospy.ServiceProxy('wouse_run_stop',\n WouseRunStop, True)\n rospy.loginfo(\"Found wouse run-stop service\")\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L28_C8", "label": "expression", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [8, 2, 0.2692, 0.0096, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initialize svm classifier and needed services.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "label": "try", "type": "try", "loc": [29, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [7, 2, 0.3125, 0.0769, 2, 0.3, 0.1, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rospy.wait_for_service('wouse_run_stop', 5) \n self.runstop_client=rospy.ServiceProxy('wouse_run_stop',\n WouseRunStop, True)\n rospy.loginfo(\"Found wouse run-stop service\")\n except:\n rospy.logerr(\"Cannot find wouse run-stop service\")\n sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L30_C12", "label": "wait_for_service()", "type": "expression", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "vector": [8, 3, 0.2885, 0.0096, 3, 0.29, 0.0, 617, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_service", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_service", "annotation": ""}, "snippet": " rospy.wait_for_service('wouse_run_stop', 5) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L31_C12", "label": "self.runstop_client = ServiceProxy()", "type": "assigned_variable", "loc": [31, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "vector": [14, 3, 0.3029, 0.0192, 3, 0.29, 0.5, 813, 3, 3, 0, 0, 915, 10, 1], "semantic": {"name": "self.runstop_client", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self.runstop_client=rospy.ServiceProxy('wouse_run_stop',\n WouseRunStop, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L33_C12", "label": "loginfo()", "type": "expression", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "vector": [8, 3, 0.3173, 0.0096, 3, 0.29, 1.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"Found wouse run-stop service\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L35_C12", "label": "logerr()", "type": "expression", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "vector": [8, 3, 0.3365, 0.0096, 3, 0.29, 0.0, 747, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logerr", "arg_names": [], "import_names": [], "rhs_call_name": "logerr", "annotation": ""}, "snippet": " rospy.logerr(\"Cannot find wouse run-stop service\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L36_C12", "label": "exit()", "type": "expression", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "vector": [8, 3, 0.3462, 0.0096, 3, 0.29, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L38_C8", "label": " = init_classifier()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [14, 2, 0.3654, 0.0096, 2, 0.3, 0.2, 0, 3, 1, 0, 0, 596, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "init_classifier", "annotation": ""}, "snippet": " (self.scaler, self.classifier) = self.init_classifier(svm_datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L39_C8", "label": "loginfo()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [8, 2, 0.375, 0.0096, 2, 0.3, 0.3, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"SVM Trained on data from %s\" %svm_datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L40_C8", "label": "Subscriber()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [8, 2, 0.3846, 0.0096, 2, 0.3, 0.4, 455, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber('wouse_movement', Vector3Stamped, self.movement_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L41_C8", "label": "Timer()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [8, 2, 0.3942, 0.0096, 2, 0.3, 0.5, 771, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "Timer", "arg_names": [], "import_names": [], "rhs_call_name": "Timer", "annotation": ""}, "snippet": " rospy.Timer(rospy.Duration(0.1), self.ping_server)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L42_C8", "label": "self.window =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [14, 2, 0.4038, 0.0096, 2, 0.3, 0.6, 313, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.window", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.window = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L43_C8", "label": "self.data =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [14, 2, 0.4135, 0.0096, 2, 0.3, 0.7, 838, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L44_C8", "label": "init()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [8, 2, 0.4231, 0.0096, 2, 0.3, 0.8, 319, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init", "arg_names": [], "import_names": [], "rhs_call_name": "init", "annotation": ""}, "snippet": " pygame.init()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L45_C8", "label": "self.sound_new = Sound()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [14, 2, 0.4327, 0.0096, 2, 0.3, 0.9, 749, 3, 1, 0, 0, 791, 10, 1], "semantic": {"name": "self.sound_new", "arg_names": [], "import_names": [], "rhs_call_name": "Sound", "annotation": ""}, "snippet": " self.sound_new = pygame.mixer.Sound('../../sounds/new_item.wav')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L47_C8", "label": "loginfo()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "vector": [8, 2, 0.4519, 0.0096, 2, 0.3, 1.0, 607, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"[%s]: Ready\" %rospy.get_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "label": "init_classifier", "type": "function", "loc": [49, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "vector": [2, 1, 0.5192, 0.1058, 1, 0.37, 0.4, 596, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "init_classifier", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def init_classifier(self, filename):\n \"\"\"Unpickle svm training data, train classifier\"\"\"\n with open(filename, 'rb') as f:\n svm_data = pickle.load(f)\n labels = svm_data['labels']\n data = svm_data['data']\n scaler = pps.Scaler().fit(data)\n data_scaled = scaler.transform(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L50_C8", "label": "expression", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [8, 2, 0.4808, 0.0096, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Unpickle svm training data, train classifier\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L52_C12", "label": "svm_data = load()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [14, 2, 0.5, 0.0096, 2, 0.42, 0.0, 591, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "svm_data", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " svm_data = pickle.load(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L53_C8", "label": "labels =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [14, 2, 0.5096, 0.0096, 2, 0.42, 0.1429, 283, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " labels = svm_data['labels']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L54_C8", "label": "data =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [14, 2, 0.5192, 0.0096, 2, 0.42, 0.2857, 929, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = svm_data['data']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L55_C8", "label": "scaler = fit()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [14, 2, 0.5288, 0.0096, 2, 0.42, 0.4286, 702, 3, 1, 0, 0, 828, 10, 2], "semantic": {"name": "scaler", "arg_names": [], "import_names": [], "rhs_call_name": "fit", "annotation": ""}, "snippet": " scaler = pps.Scaler().fit(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L56_C8", "label": "data_scaled = transform()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [14, 2, 0.5385, 0.0096, 2, 0.42, 0.5714, 579, 3, 1, 0, 0, 48, 10, 1], "semantic": {"name": "data_scaled", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " data_scaled = scaler.transform(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L57_C8", "label": "classifier = SVC()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [14, 2, 0.5481, 0.0096, 2, 0.42, 0.7143, 71, 3, 0, 0, 0, 706, 10, 1], "semantic": {"name": "classifier", "arg_names": [], "import_names": [], "rhs_call_name": "SVC", "annotation": ""}, "snippet": " classifier = svm.SVC()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L58_C8", "label": "fit()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [8, 2, 0.5577, 0.0096, 2, 0.42, 0.8571, 828, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "fit", "arg_names": [], "import_names": [], "rhs_call_name": "fit", "annotation": ""}, "snippet": " classifier.fit(data_scaled, labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Return_L59_C8", "label": "return", "type": "return", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "vector": [13, 2, 0.5673, 0.0096, 2, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (scaler, classifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L61_C4", "label": "ping_server", "type": "function", "loc": [61, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "vector": [2, 1, 0.601, 0.0385, 1, 0.37, 0.6, 284, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "ping_server", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ping_server(self, event):\n \"\"\"Send updated timestamp to Runstop server.\"\"\"\n req = WouseRunStopRequest(False, False, rospy.Time.now())\n self.runstop_client(req)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L62_C8", "label": "expression", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L61_C4", "vector": [8, 2, 0.5962, 0.0096, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Send updated timestamp to Runstop server.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L63_C8", "label": "req = WouseRunStopRequest()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L61_C4", "vector": [14, 2, 0.6058, 0.0096, 2, 0.18, 0.5, 233, 3, 3, 0, 0, 714, 10, 2], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "WouseRunStopRequest", "annotation": ""}, "snippet": " req = WouseRunStopRequest(False, False, rospy.Time.now())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L64_C8", "label": "runstop_client()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L61_C4", "vector": [8, 2, 0.6154, 0.0096, 2, 0.18, 1.0, 299, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "runstop_client", "arg_names": [], "import_names": [], "rhs_call_name": "runstop_client", "annotation": ""}, "snippet": " self.runstop_client(req)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L66_C4", "label": "movement_cb", "type": "function", "loc": [66, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "vector": [2, 1, 0.6875, 0.1154, 1, 0.37, 0.8, 514, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "movement_cb", "arg_names": ["self", "v3"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def movement_cb(self, v3):\n \"\"\"Filter out small movements, check classifier, call stop if needed.\"\"\"\n #line = [v3.header.stamp.to_sec(), v3.vector.x, v3.vector.y]\n #self.csv_writer.writerow(line)\n if (v3.vector.x**2+v3.vector.y**2)**(0.5) < 2.5:\n return\n if self.classify_svm(v3.vector.x, v3.vector.y, v3.header.stamp):\n self.runstop_client(WouseRunStopRequest(True, False, rospy.Time.now()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L67_C8", "label": "expression", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L66_C4", "vector": [8, 2, 0.6442, 0.0096, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Filter out small movements, check classifier, call stop if needed.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L70_C8", "label": "if", "type": "if", "loc": [70, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L66_C4", "vector": [4, 2, 0.6779, 0.0192, 2, 0.37, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (v3.vector.x**2+v3.vector.y**2)**(0.5) < 2.5:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Return_L71_C12", "label": "return", "type": "return", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L70_C8", "vector": [13, 3, 0.6827, 0.0096, 3, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "label": "if", "type": "if", "loc": [72, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L66_C4", "vector": [4, 2, 0.7163, 0.0577, 2, 0.37, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.classify_svm(v3.vector.x, v3.vector.y, v3.header.stamp):\n self.runstop_client(WouseRunStopRequest(True, False, rospy.Time.now()))\n self.sound_new.play()\n rospy.loginfo(\"Wince Detected, stopping robot!\")\n else:\n rospy.loginfo(\"Not a wince\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L73_C12", "label": "runstop_client()", "type": "expression", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "vector": [8, 3, 0.7019, 0.0096, 3, 0.02, 0.0, 299, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "runstop_client", "arg_names": [], "import_names": [], "rhs_call_name": "runstop_client", "annotation": ""}, "snippet": " self.runstop_client(WouseRunStopRequest(True, False, rospy.Time.now()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L74_C12", "label": "play()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "vector": [8, 3, 0.7115, 0.0096, 3, 0.02, 0.3333, 836, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "play", "arg_names": [], "import_names": [], "rhs_call_name": "play", "annotation": ""}, "snippet": " self.sound_new.play()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L75_C12", "label": "loginfo()", "type": "expression", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "vector": [8, 3, 0.7212, 0.0096, 3, 0.02, 0.6667, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"Wince Detected, stopping robot!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L77_C12", "label": "loginfo()", "type": "expression", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "vector": [8, 3, 0.7404, 0.0096, 3, 0.02, 1.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"Not a wince\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "label": "classify_svm", "type": "function", "loc": [79, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "vector": [2, 1, 0.8558, 0.2019, 1, 0.37, 1.0, 967, 0, 4, 1, 0, 0, 0, 17], "semantic": {"name": "classify_svm", "arg_names": ["self", "x", "y", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def classify_svm(self, x, y, time):\n \"\"\"Build the descriptor vector for the incoming mouse event, and classify with the svm.\"\"\"\n datum = []\n mag = (x**2+y**2)**(0.5)\n angle = np.arctan2(y,x)\n datum.append(mag)\n datum.append(angle)\n self.window.append([x,y,time])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L80_C8", "label": "expression", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [8, 2, 0.7692, 0.0096, 2, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the descriptor vector for the incoming mouse event, and classify with the svm.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L81_C8", "label": "datum =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.7788, 0.0096, 2, 0.9, 0.0588, 975, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "datum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " datum = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L82_C8", "label": "mag =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.7885, 0.0096, 2, 0.9, 0.1176, 533, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mag = (x**2+y**2)**(0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L83_C8", "label": "angle = arctan2()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.7981, 0.0096, 2, 0.9, 0.1765, 418, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "angle", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " angle = np.arctan2(y,x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L84_C8", "label": "append()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [8, 2, 0.8077, 0.0096, 2, 0.9, 0.2353, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(mag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L85_C8", "label": "append()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [8, 2, 0.8173, 0.0096, 2, 0.9, 0.2941, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(angle)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L86_C8", "label": "append()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [8, 2, 0.8269, 0.0096, 2, 0.9, 0.3529, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.window.append([x,y,time])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:While_L87_C8", "label": "while", "type": "while", "loc": [87, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [5, 2, 0.8413, 0.0192, 2, 0.9, 0.4118, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while (self.window[-1][-1] - self.window[0][-1]) > rospy.Duration(0.25):\n self.window.pop(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L88_C12", "label": "pop()", "type": "expression", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:While_L87_C8", "vector": [8, 3, 0.8462, 0.0096, 3, 0.97, 0.0, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.window.pop(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L89_C8", "label": "win = array()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.8558, 0.0096, 2, 0.9, 0.4706, 419, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "win", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " win = np.array(self.window)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L90_C8", "label": "append()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [8, 2, 0.8654, 0.0096, 2, 0.9, 0.5294, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(len(self.window))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L91_C8", "label": "win_x = sum()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.875, 0.0096, 2, 0.9, 0.5882, 67, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "win_x", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " win_x = np.sum(win[:,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L92_C8", "label": "win_y = sum()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.8846, 0.0096, 2, 0.9, 0.6471, 815, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "win_y", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " win_y = np.sum(win[:,1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L93_C8", "label": "win_mag =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.8942, 0.0096, 2, 0.9, 0.7059, 642, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "win_mag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " win_mag = (win_x**2+win_y**2)**(0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L94_C8", "label": "append()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [8, 2, 0.9038, 0.0096, 2, 0.9, 0.7647, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(win_mag/len(self.window))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L95_C8", "label": "append()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [8, 2, 0.9135, 0.0096, 2, 0.9, 0.8235, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(np.arctan2(win_y, win_x))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L96_C8", "label": "datum_scaled = transform()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.9231, 0.0096, 2, 0.9, 0.8824, 152, 3, 1, 0, 0, 48, 10, 1], "semantic": {"name": "datum_scaled", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " datum_scaled = self.scaler.transform(datum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L97_C8", "label": "prediction = predict()", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [14, 2, 0.9327, 0.0096, 2, 0.9, 0.9412, 192, 3, 1, 0, 0, 127, 10, 1], "semantic": {"name": "prediction", "arg_names": [], "import_names": [], "rhs_call_name": "predict", "annotation": ""}, "snippet": " prediction = self.classifier.predict(datum_scaled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L98_C8", "label": "if", "type": "if", "loc": [98, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "vector": [4, 2, 0.9471, 0.0192, 2, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if prediction[0] == 1.:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Return_L99_C12", "label": "return", "type": "return", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L98_C8", "vector": [13, 3, 0.9519, 0.0096, 3, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L101_C0", "label": "if", "type": "if", "loc": [101, 104], "level": 0, "parent": null, "vector": [4, 0, 0.9856, 0.0385, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__=='__main__':\n rospy.init_node('wouse_node')\n wouse = Wouse(sys.argv[1])\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L102_C4", "label": "init_node()", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L101_C0", "vector": [8, 1, 0.9808, 0.0096, 1, 0.29, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('wouse_node')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L103_C4", "label": "wouse = Wouse()", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L101_C0", "vector": [14, 1, 0.9904, 0.0096, 1, 0.29, 0.5, 288, 3, 1, 0, 0, 173, 10, 1], "semantic": {"name": "wouse", "arg_names": [], "import_names": [], "rhs_call_name": "Wouse", "annotation": ""}, "snippet": " wouse = Wouse(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L104_C4", "label": "spin()", "type": "expression", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L101_C0", "vector": [8, 1, 1.0, 0.0096, 1, 0.29, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:Try_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Return_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Return_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:While_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:While_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Return_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99467:If_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99467:Expr_L104_C4"}] |
#!/usr/bin/env python
import sys
import os
import random
import csv
import math
import pygame
import roslib; roslib.load_manifest('wouse')
import rospy
from geometry_msgs.msg import Vector3Stamped
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtUiTools import QUiLoader
#DEGREES = ['WEAK', 'AVERAGE', 'STRONG']
DEGREES = ['']
ACTIONS = ['WINCE', 'NOD', 'SHAKE', 'JOY', 'SUPRISE', 'FEAR', 'ANGER',
'DISGUST', 'SADNESS']
SYMBOLS = ["**"*25, "%%"*25, "^v"*25, '##'*25, '&&'*25, '$$'*25]
class WouseSetupDialog(object):
"""A dialog box for setting session parameters for training the wouse."""
def __init__(self):
""" Load .ui file from QtDesigner, add callbacks as necessary"""
ui_file = WOUSE_PKG+'/src/wouse/wouse_train_options.ui'
self.dialog = QUiLoader().load(ui_file)
self.dialog.rounds_spin.valueChanged.connect(self.update_time)
self.dialog.recording_spin.valueChanged.connect(self.update_time)
self.dialog.recovery_spin.valueChanged.connect(self.update_time)
self.dialog.file_button.clicked.connect(self.file_button_cb)
self.dialog.file_field_edit.setText(WOUSE_PKG+'/data/')
self.dialog.buttonBox.accepted.connect(self.ok_cb)
self.dialog.buttonBox.rejected.connect(self.cancel_cb)
self.update_time()
def file_button_cb(self):
"""Use file dialog to get .csv file. Check for csv, update Lineedit"""
direc = self.dialog.file_field_edit.text()
filename = QFileDialog.getOpenFileName(self.dialog,
caption="File to stop wouse training data",
dir=direc,
filter="*.csv")
if len(filename[0]) != 0:
if filename[0][-4:] != '.csv':
QMessageBox.warning(self.dialog, "Warning: Invalid File",
"Warning: Selected File does not appear to be a CSV (.csv)\
data file.")
self.dialog.file_field_edit.setText(filename[0])
def calc_time(self):
"""Calculate the time (s) required for full run with current settings"""
tot_time = (self.dialog.recording_spin.value()+
self.dialog.recovery_spin.value())
return len(ACTIONS)*self.dialog.rounds_spin.value()*tot_time
def update_time(self):
"""Parse time to minutes:seconds format, update interface"""
time = self.calc_time()
mins = str(int(time)/60)
secs = str(int(round(time%60.)))
if len(secs)==1:
secs = "".join(['0',secs])
self.dialog.duration.setText('%s:%s' %(mins,secs))
def ok_cb(self):
"""Check for acceptable file. Warn if bad, if good, close, return 1"""
if self.dialog.file_field_edit.text()[-4:] != '.csv':
return QMessageBox.warning(self.dialog, "Warning: Invalid File",
"Please choose a valid CSV (.csv) data file.")
self.dialog.accept()
def cancel_cb(self):
""" Close dialog, return 0/Rejected"""
self.dialog.reject()
class WouseTrainer(object):
""" A class for printing random facial expression commands,\\
and saving data from a topic of wouse movement data."""
def __init__(self):
#QtDialog for setting parameters for session
app = QApplication([])
self.setup_gui = WouseSetupDialog()
self.setup_gui.dialog.show()
if self.setup_gui.dialog.exec_() == 0:
sys.exit()
self.rounds = self.setup_gui.dialog.rounds_spin.value()
self.record_dur = self.setup_gui.dialog.recording_spin.value()
self.recovery_dur = self.setup_gui.dialog.recovery_spin.value()
rospy.Subscriber('/wouse_movement', Vector3Stamped, self.movement_cb)
#Open file for recoding data
output_file = self.setup_gui.dialog.file_field_edit.text()
self.csv_writer = csv.writer(open(output_file, 'ab'))
#Init pygame, used for playing sounds
pygame.init()
self.sound_new = pygame.mixer.Sound(WOUSE_PKG+'/sounds/new_item.wav')
self.sound_done = pygame.mixer.Sound(WOUSE_PKG+'/sounds/item_done.wav')
self.degree='AVERAGE'
self.recording = False
def movement_cb(self, v3s):
"""Write a new line to the csv file for incoming data."""
if self.recording:
line = [self.degree, self.behavior, v3s.header.stamp.to_sec(),
v3s.vector.x, v3s.vector.y]
self.csv_writer.writerow(line)
def run(self, rounds, record_dur, recovery_dur):
"""Perform training given parameters and actions."""
act_list = rounds*ACTIONS
random.shuffle(act_list)
count = 1
print "Starting in: "
countdown = range(1,10)
countdown.reverse()
for number in countdown:
print "%s" %number
rospy.sleep(1)
while len(act_list) > 0 and not rospy.is_shutdown():
self.behavior = act_list.pop()
bar = random.choice(SYMBOLS)
self.recording = True
self.sound_new.play()
print "\r\n"*15
print bar
print "%s: %s" %(count, self.behavior)
print bar
print "\r\n"*15
rospy.sleep(record_dur)
self.recording = False
self.sound_done.play()
count += 1
rospy.sleep(recovery_dur)
if not act_list:
print "Training Session Completed"
else:
print "Training Session Ended Early"
if __name__=='__main__':
rospy.init_node('wouse_trainer')
WOUSE_PKG = roslib.packages.get_pkg_dir('wouse')
wt = WouseTrainer()
wt.run(wt.rounds, wt.record_dur, wt.recovery_dur)
| ajibawa-2023/Python-Code-Large/train/row_99468 | 115 | 148 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0135, 0.0068, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0203, 0.0068, 0, 0.66, 0.0556, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Import_L4_C0", "label": "random import random", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.0068, 0, 0.66, 0.1111, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Import_L5_C0", "label": "csv import csv", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0338, 0.0068, 0, 0.66, 0.1667, 312, 0, 1, 0, 0, 312, 0, 0], "semantic": {"name": "csv", "arg_names": [], "import_names": ["csv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import csv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Import_L6_C0", "label": "math import math", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0405, 0.0068, 0, 0.66, 0.2222, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Import_L7_C0", "label": "pygame import pygame", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0473, 0.0068, 0, 0.66, 0.2778, 87, 0, 1, 0, 0, 87, 0, 0], "semantic": {"name": "pygame", "arg_names": [], "import_names": ["pygame"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pygame"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Import_L9_C0", "label": "roslib import roslib", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0608, 0.0068, 0, 0.66, 0.3333, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L9_C15", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0608, 0.0068, 0, 0.66, 0.3889, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Import_L10_C0", "label": "rospy import rospy", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0676, 0.0068, 0, 0.66, 0.4444, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:ImportFrom_L11_C0", "label": "from geometry_msgs.msg import Vector3Stamped", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0743, 0.0068, 0, 0.66, 0.5, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Vector3Stamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Vector3Stamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:ImportFrom_L13_C0", "label": "from PySide.QtCore import *", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0878, 0.0068, 0, 0.66, 0.5556, 973, 0, 1, 0, 0, 973, 0, 0], "semantic": {"name": "PySide.QtCore", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from PySide.QtCore import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:ImportFrom_L14_C0", "label": "from PySide.QtGui import *", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0946, 0.0068, 0, 0.66, 0.6111, 87, 0, 1, 0, 0, 87, 0, 0], "semantic": {"name": "PySide.QtGui", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from PySide.QtGui import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:ImportFrom_L15_C0", "label": "from PySide.QtUiTools import QUiLoader", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1014, 0.0068, 0, 0.66, 0.6667, 490, 0, 1, 0, 0, 490, 0, 0], "semantic": {"name": "PySide.QtUiTools", "arg_names": [], "import_names": ["QUiLoader"], "rhs_call_name": "", "annotation": ""}, "snippet": "from PySide.QtUiTools import QUiLoader"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L18_C0", "label": "DEGREES =", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.1216, 0.0068, 0, 0.66, 0.7222, 970, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "DEGREES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEGREES = ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L19_C0", "label": "ACTIONS =", "type": "assigned_variable", "loc": [19, 20], "level": 0, "parent": null, "vector": [14, 0, 0.1318, 0.0135, 0, 0.66, 0.7778, 298, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ACTIONS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ACTIONS = ['WINCE', 'NOD', 'SHAKE', 'JOY', 'SUPRISE', 'FEAR', 'ANGER', \n 'DISGUST', 'SADNESS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L21_C0", "label": "SYMBOLS =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.1419, 0.0068, 0, 0.66, 0.8333, 44, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "SYMBOLS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SYMBOLS = [\"**\"*25, \"%%\"*25, \"^v\"*25, '##'*25, '&&'*25, '$$'*25]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "label": "WouseSetupDialog", "type": "class", "loc": [23, 76], "level": 0, "parent": null, "vector": [3, 0, 0.3345, 0.3649, 0, 0.66, 0.8889, 731, 0, 6, 0, 0, 186, 0, 32], "semantic": {"name": "WouseSetupDialog", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WouseSetupDialog(object):\n \"\"\"A dialog box for setting session parameters for training the wouse.\"\"\"\n def __init__(self):\n \"\"\" Load .ui file from QtDesigner, add callbacks as necessary\"\"\"\n ui_file = WOUSE_PKG+'/src/wouse/wouse_train_options.ui'\n self.dialog = QUiLoader().load(ui_file)\n self.dialog.rounds_spin.valueChanged.connect(self.update_time)\n self.dialog.recording_spin.valueChanged.connect(self.update_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "vector": [8, 1, 0.1622, 0.0068, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A dialog box for setting session parameters for training the wouse.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "label": "__init__", "type": "function", "loc": [25, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "vector": [2, 1, 0.2061, 0.0811, 1, 0.23, 0.1667, 555, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n \"\"\" Load .ui file from QtDesigner, add callbacks as necessary\"\"\"\n ui_file = WOUSE_PKG+'/src/wouse/wouse_train_options.ui'\n self.dialog = QUiLoader().load(ui_file)\n self.dialog.rounds_spin.valueChanged.connect(self.update_time)\n self.dialog.recording_spin.valueChanged.connect(self.update_time)\n self.dialog.recovery_spin.valueChanged.connect(self.update_time)\n self.dialog.file_button.clicked.connect(self.file_button_cb) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.1757, 0.0068, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Load .ui file from QtDesigner, add callbacks as necessary\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L27_C8", "label": "ui_file =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [14, 2, 0.1824, 0.0068, 2, 0.24, 0.1, 770, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ui_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ui_file = WOUSE_PKG+'/src/wouse/wouse_train_options.ui'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L28_C8", "label": "self.dialog = load()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [14, 2, 0.1892, 0.0068, 2, 0.24, 0.2, 18, 3, 1, 0, 0, 37, 10, 2], "semantic": {"name": "self.dialog", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " self.dialog = QUiLoader().load(ui_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L29_C8", "label": "connect()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.1959, 0.0068, 2, 0.24, 0.3, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.dialog.rounds_spin.valueChanged.connect(self.update_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L30_C8", "label": "connect()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.2027, 0.0068, 2, 0.24, 0.4, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.dialog.recording_spin.valueChanged.connect(self.update_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L31_C8", "label": "connect()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.2095, 0.0068, 2, 0.24, 0.5, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.dialog.recovery_spin.valueChanged.connect(self.update_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L32_C8", "label": "connect()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.2162, 0.0068, 2, 0.24, 0.6, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.dialog.file_button.clicked.connect(self.file_button_cb) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L33_C8", "label": "setText()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.223, 0.0068, 2, 0.24, 0.7, 40, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setText", "arg_names": [], "import_names": [], "rhs_call_name": "setText", "annotation": ""}, "snippet": " self.dialog.file_field_edit.setText(WOUSE_PKG+'/data/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L34_C8", "label": "connect()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.2297, 0.0068, 2, 0.24, 0.8, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.dialog.buttonBox.accepted.connect(self.ok_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L35_C8", "label": "connect()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.2365, 0.0068, 2, 0.24, 0.9, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.dialog.buttonBox.rejected.connect(self.cancel_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L36_C8", "label": "update_time()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "vector": [8, 2, 0.2432, 0.0068, 2, 0.24, 1.0, 396, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_time", "arg_names": [], "import_names": [], "rhs_call_name": "update_time", "annotation": ""}, "snippet": " self.update_time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "label": "file_button_cb", "type": "function", "loc": [38, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "vector": [2, 1, 0.2973, 0.0878, 1, 0.23, 0.3333, 349, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "file_button_cb", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def file_button_cb(self):\n \"\"\"Use file dialog to get .csv file. Check for csv, update Lineedit\"\"\"\n direc = self.dialog.file_field_edit.text()\n filename = QFileDialog.getOpenFileName(self.dialog,\n caption=\"File to stop wouse training data\",\n dir=direc,\n filter=\"*.csv\")\n if len(filename[0]) != 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L39_C8", "label": "expression", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "vector": [8, 2, 0.2635, 0.0068, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Use file dialog to get .csv file. Check for csv, update Lineedit\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L40_C8", "label": "direc = text()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "vector": [14, 2, 0.2703, 0.0068, 2, 0.37, 0.3333, 620, 3, 0, 0, 0, 439, 10, 1], "semantic": {"name": "direc", "arg_names": [], "import_names": [], "rhs_call_name": "text", "annotation": ""}, "snippet": " direc = self.dialog.file_field_edit.text()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L41_C8", "label": "filename = getOpenFileName()", "type": "assigned_variable", "loc": [41, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "vector": [14, 2, 0.2872, 0.027, 2, 0.37, 0.6667, 275, 3, 4, 0, 0, 709, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "getOpenFileName", "annotation": ""}, "snippet": " filename = QFileDialog.getOpenFileName(self.dialog,\n caption=\"File to stop wouse training data\",\n dir=direc,\n filter=\"*.csv\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L45_C8", "label": "if", "type": "if", "loc": [45, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "vector": [4, 2, 0.3209, 0.0405, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(filename[0]) != 0:\n if filename[0][-4:] != '.csv':\n QMessageBox.warning(self.dialog, \"Warning: Invalid File\",\n \"Warning: Selected File does not appear to be a CSV (.csv)\\\n data file.\")\n self.dialog.file_field_edit.setText(filename[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L46_C12", "label": "if", "type": "if", "loc": [46, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L45_C8", "vector": [4, 3, 0.3209, 0.027, 3, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filename[0][-4:] != '.csv':\n QMessageBox.warning(self.dialog, \"Warning: Invalid File\",\n \"Warning: Selected File does not appear to be a CSV (.csv)\\\n data file.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L47_C16", "label": "warning()", "type": "expression", "loc": [47, 49], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L46_C12", "vector": [8, 4, 0.3243, 0.0203, 4, 0.47, 0.0, 320, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " QMessageBox.warning(self.dialog, \"Warning: Invalid File\",\n \"Warning: Selected File does not appear to be a CSV (.csv)\\\n data file.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L50_C12", "label": "setText()", "type": "expression", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L45_C8", "vector": [8, 3, 0.3378, 0.0068, 3, 0.76, 1.0, 40, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setText", "arg_names": [], "import_names": [], "rhs_call_name": "setText", "annotation": ""}, "snippet": " self.dialog.file_field_edit.setText(filename[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L52_C4", "label": "calc_time", "type": "function", "loc": [52, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "vector": [2, 1, 0.3649, 0.0338, 1, 0.23, 0.5, 975, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "calc_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def calc_time(self):\n \"\"\"Calculate the time (s) required for full run with current settings\"\"\"\n tot_time = (self.dialog.recording_spin.value()+\n self.dialog.recovery_spin.value())\n return len(ACTIONS)*self.dialog.rounds_spin.value()*tot_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L53_C8", "label": "expression", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L52_C4", "vector": [8, 2, 0.3581, 0.0068, 2, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calculate the time (s) required for full run with current settings\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L54_C8", "label": "tot_time =", "type": "assigned_variable", "loc": [54, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L52_C4", "vector": [14, 2, 0.3682, 0.0135, 2, 0.58, 0.5, 70, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tot_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tot_time = (self.dialog.recording_spin.value()+\n self.dialog.recovery_spin.value())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L52_C4", "vector": [13, 2, 0.3784, 0.0068, 2, 0.58, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(ACTIONS)*self.dialog.rounds_spin.value()*tot_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "label": "update_time", "type": "function", "loc": [58, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "vector": [2, 1, 0.4155, 0.0541, 1, 0.23, 0.6667, 396, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "update_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_time(self):\n \"\"\"Parse time to minutes:seconds format, update interface\"\"\"\n time = self.calc_time()\n mins = str(int(time)/60)\n secs = str(int(round(time%60.)))\n if len(secs)==1:\n secs = \"\".join(['0',secs])\n self.dialog.duration.setText('%s:%s' %(mins,secs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L59_C8", "label": "expression", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "vector": [8, 2, 0.3986, 0.0068, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parse time to minutes:seconds format, update interface\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L60_C8", "label": "time = calc_time()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "vector": [14, 2, 0.4054, 0.0068, 2, 0.06, 0.2, 654, 3, 0, 0, 0, 975, 10, 1], "semantic": {"name": "time", "arg_names": [], "import_names": [], "rhs_call_name": "calc_time", "annotation": ""}, "snippet": " time = self.calc_time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L61_C8", "label": "mins = str()", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "vector": [14, 2, 0.4122, 0.0068, 2, 0.06, 0.4, 606, 3, 1, 0, 0, 52, 10, 2], "semantic": {"name": "mins", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " mins = str(int(time)/60)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L62_C8", "label": "secs = str()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "vector": [14, 2, 0.4189, 0.0068, 2, 0.06, 0.6, 584, 3, 1, 0, 0, 52, 10, 3], "semantic": {"name": "secs", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " secs = str(int(round(time%60.)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "vector": [4, 2, 0.4291, 0.0135, 2, 0.06, 0.8, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(secs)==1:\n secs = \"\".join(['0',secs])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L64_C12", "label": "secs = join()", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L63_C8", "vector": [14, 3, 0.4324, 0.0068, 3, 0.27, 0.0, 584, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "secs", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " secs = \"\".join(['0',secs])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L65_C8", "label": "setText()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "vector": [8, 2, 0.4392, 0.0068, 2, 0.06, 1.0, 40, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setText", "arg_names": [], "import_names": [], "rhs_call_name": "setText", "annotation": ""}, "snippet": " self.dialog.duration.setText('%s:%s' %(mins,secs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L67_C4", "label": "ok_cb", "type": "function", "loc": [67, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "vector": [2, 1, 0.4696, 0.0405, 1, 0.23, 0.8333, 932, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "ok_cb", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ok_cb(self):\n \"\"\"Check for acceptable file. Warn if bad, if good, close, return 1\"\"\"\n if self.dialog.file_field_edit.text()[-4:] != '.csv':\n return QMessageBox.warning(self.dialog, \"Warning: Invalid File\",\n \"Please choose a valid CSV (.csv) data file.\")\n self.dialog.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L68_C8", "label": "expression", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L67_C4", "vector": [8, 2, 0.4595, 0.0068, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Check for acceptable file. Warn if bad, if good, close, return 1\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L69_C8", "label": "if", "type": "if", "loc": [69, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L67_C4", "vector": [4, 2, 0.473, 0.0203, 2, 0.21, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.dialog.file_field_edit.text()[-4:] != '.csv':\n return QMessageBox.warning(self.dialog, \"Warning: Invalid File\",\n \"Please choose a valid CSV (.csv) data file.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Return_L70_C12", "label": "return", "type": "return", "loc": [70, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L69_C8", "vector": [13, 3, 0.4764, 0.0135, 3, 0.91, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return QMessageBox.warning(self.dialog, \"Warning: Invalid File\",\n \"Please choose a valid CSV (.csv) data file.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L72_C8", "label": "accept()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L67_C4", "vector": [8, 2, 0.4865, 0.0068, 2, 0.21, 1.0, 829, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "accept", "arg_names": [], "import_names": [], "rhs_call_name": "accept", "annotation": ""}, "snippet": " self.dialog.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L74_C4", "label": "cancel_cb", "type": "function", "loc": [74, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "vector": [2, 1, 0.5068, 0.0203, 1, 0.23, 1.0, 660, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "cancel_cb", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cancel_cb(self):\n \"\"\" Close dialog, return 0/Rejected\"\"\"\n self.dialog.reject()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L75_C8", "label": "expression", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L74_C4", "vector": [8, 2, 0.5068, 0.0068, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Close dialog, return 0/Rejected\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L76_C8", "label": "reject()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L74_C4", "vector": [8, 2, 0.5135, 0.0068, 2, 0.97, 1.0, 575, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reject", "arg_names": [], "import_names": [], "rhs_call_name": "reject", "annotation": ""}, "snippet": " self.dialog.reject()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "label": "WouseTrainer", "type": "class", "loc": [78, 141], "level": 0, "parent": null, "vector": [3, 0, 0.7399, 0.4324, 0, 0.66, 0.9444, 381, 0, 3, 0, 0, 186, 0, 38], "semantic": {"name": "WouseTrainer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WouseTrainer(object):\n \"\"\" A class for printing random facial expression commands,\\\\\n and saving data from a topic of wouse movement data.\"\"\"\n def __init__(self):\n #QtDialog for setting parameters for session\n app = QApplication([])\n self.setup_gui = WouseSetupDialog()\n self.setup_gui.dialog.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L79_C4", "label": "expression", "type": "expression", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "vector": [8, 1, 0.5372, 0.0135, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" A class for printing random facial expression commands,\\\\\n and saving data from a topic of wouse movement data.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "label": "__init__", "type": "function", "loc": [81, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "vector": [2, 1, 0.6216, 0.1554, 1, 0.73, 0.3333, 555, 0, 1, 0, 0, 0, 0, 15], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n #QtDialog for setting parameters for session\n app = QApplication([])\n self.setup_gui = WouseSetupDialog()\n self.setup_gui.dialog.show()\n if self.setup_gui.dialog.exec_() == 0:\n sys.exit()\n self.rounds = self.setup_gui.dialog.rounds_spin.value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L83_C8", "label": "app = QApplication()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.5608, 0.0068, 2, 0.99, 0.0, 494, 3, 1, 0, 0, 447, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "QApplication", "annotation": ""}, "snippet": " app = QApplication([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L84_C8", "label": "self.setup_gui = WouseSetupDialog()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.5676, 0.0068, 2, 0.99, 0.0714, 829, 3, 0, 0, 0, 731, 10, 1], "semantic": {"name": "self.setup_gui", "arg_names": [], "import_names": [], "rhs_call_name": "WouseSetupDialog", "annotation": ""}, "snippet": " self.setup_gui = WouseSetupDialog()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L85_C8", "label": "show()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [8, 2, 0.5743, 0.0068, 2, 0.99, 0.1429, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " self.setup_gui.dialog.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L86_C8", "label": "if", "type": "if", "loc": [86, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [4, 2, 0.5845, 0.0135, 2, 0.99, 0.2143, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.setup_gui.dialog.exec_() == 0:\n sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L87_C12", "label": "exit()", "type": "expression", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L86_C8", "vector": [8, 3, 0.5878, 0.0068, 3, 0.2, 0.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L88_C8", "label": "self.rounds = value()", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.5946, 0.0068, 2, 0.99, 0.2857, 681, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "self.rounds", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " self.rounds = self.setup_gui.dialog.rounds_spin.value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L89_C8", "label": "self.record_dur = value()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.6014, 0.0068, 2, 0.99, 0.3571, 757, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "self.record_dur", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " self.record_dur = self.setup_gui.dialog.recording_spin.value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L90_C8", "label": "self.recovery_dur = value()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.6081, 0.0068, 2, 0.99, 0.4286, 841, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "self.recovery_dur", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " self.recovery_dur = self.setup_gui.dialog.recovery_spin.value() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L92_C8", "label": "Subscriber()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [8, 2, 0.6216, 0.0068, 2, 0.99, 0.5, 455, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber('/wouse_movement', Vector3Stamped, self.movement_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L94_C8", "label": "output_file = text()", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.6351, 0.0068, 2, 0.99, 0.5714, 395, 3, 0, 0, 0, 439, 10, 1], "semantic": {"name": "output_file", "arg_names": [], "import_names": [], "rhs_call_name": "text", "annotation": ""}, "snippet": " output_file = self.setup_gui.dialog.file_field_edit.text()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L95_C8", "label": "self.csv_writer = writer()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.6419, 0.0068, 2, 0.99, 0.6429, 449, 3, 1, 0, 0, 614, 10, 2], "semantic": {"name": "self.csv_writer", "arg_names": [], "import_names": [], "rhs_call_name": "writer", "annotation": ""}, "snippet": " self.csv_writer = csv.writer(open(output_file, 'ab'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L98_C8", "label": "init()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [8, 2, 0.6622, 0.0068, 2, 0.99, 0.7143, 319, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init", "arg_names": [], "import_names": [], "rhs_call_name": "init", "annotation": ""}, "snippet": " pygame.init()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L99_C8", "label": "self.sound_new = Sound()", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.6689, 0.0068, 2, 0.99, 0.7857, 749, 3, 1, 0, 0, 791, 10, 1], "semantic": {"name": "self.sound_new", "arg_names": [], "import_names": [], "rhs_call_name": "Sound", "annotation": ""}, "snippet": " self.sound_new = pygame.mixer.Sound(WOUSE_PKG+'/sounds/new_item.wav')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L100_C8", "label": "self.sound_done = Sound()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.6757, 0.0068, 2, 0.99, 0.8571, 934, 3, 1, 0, 0, 791, 10, 1], "semantic": {"name": "self.sound_done", "arg_names": [], "import_names": [], "rhs_call_name": "Sound", "annotation": ""}, "snippet": " self.sound_done = pygame.mixer.Sound(WOUSE_PKG+'/sounds/item_done.wav')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L102_C8", "label": "self.degree =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.6892, 0.0068, 2, 0.99, 0.9286, 434, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.degree", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.degree='AVERAGE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L103_C8", "label": "self.recording =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "vector": [14, 2, 0.6959, 0.0068, 2, 0.99, 1.0, 770, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.recording", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.recording = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L105_C4", "label": "movement_cb", "type": "function", "loc": [105, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "vector": [2, 1, 0.7264, 0.0405, 1, 0.73, 0.6667, 514, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "movement_cb", "arg_names": ["self", "v3s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def movement_cb(self, v3s):\n \"\"\"Write a new line to the csv file for incoming data.\"\"\"\n if self.recording:\n line = [self.degree, self.behavior, v3s.header.stamp.to_sec(),\n v3s.vector.x, v3s.vector.y]\n self.csv_writer.writerow(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L106_C8", "label": "expression", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L105_C4", "vector": [8, 2, 0.7162, 0.0068, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Write a new line to the csv file for incoming data.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L107_C8", "label": "if", "type": "if", "loc": [107, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L105_C4", "vector": [4, 2, 0.7331, 0.027, 2, 0.56, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.recording:\n line = [self.degree, self.behavior, v3s.header.stamp.to_sec(),\n v3s.vector.x, v3s.vector.y]\n self.csv_writer.writerow(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L108_C12", "label": "line =", "type": "assigned_variable", "loc": [108, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L107_C8", "vector": [14, 3, 0.7331, 0.0135, 3, 0.52, 0.0, 373, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line = [self.degree, self.behavior, v3s.header.stamp.to_sec(),\n v3s.vector.x, v3s.vector.y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L110_C12", "label": "writerow()", "type": "expression", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L107_C8", "vector": [8, 3, 0.7432, 0.0068, 3, 0.52, 1.0, 941, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writerow", "arg_names": [], "import_names": [], "rhs_call_name": "writerow", "annotation": ""}, "snippet": " self.csv_writer.writerow(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "label": "run", "type": "function", "loc": [112, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "vector": [2, 1, 0.8547, 0.2027, 1, 0.73, 1.0, 679, 0, 4, 0, 0, 0, 0, 21], "semantic": {"name": "run", "arg_names": ["self", "rounds", "record_dur", "recovery_dur"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self, rounds, record_dur, recovery_dur):\n \"\"\"Perform training given parameters and actions.\"\"\"\n act_list = rounds*ACTIONS\n random.shuffle(act_list)\n count = 1\n print(\"Starting in: \")\n countdown = range(1,10)\n countdown.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L113_C8", "label": "expression", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [8, 2, 0.7635, 0.0068, 2, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Perform training given parameters and actions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L114_C8", "label": "act_list =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [14, 2, 0.7703, 0.0068, 2, 0.17, 0.1111, 944, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "act_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " act_list = rounds*ACTIONS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L115_C8", "label": "shuffle()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [8, 2, 0.777, 0.0068, 2, 0.17, 0.2222, 903, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "shuffle", "arg_names": [], "import_names": [], "rhs_call_name": "shuffle", "annotation": ""}, "snippet": " random.shuffle(act_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L116_C8", "label": "count =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [14, 2, 0.7838, 0.0068, 2, 0.17, 0.3333, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L117_C8", "label": "print()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [8, 2, 0.7905, 0.0068, 2, 0.17, 0.4444, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Starting in: \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L118_C8", "label": "countdown = range()", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [14, 2, 0.7973, 0.0068, 2, 0.17, 0.5556, 607, 3, 2, 0, 0, 816, 10, 1], "semantic": {"name": "countdown", "arg_names": [], "import_names": [], "rhs_call_name": "range", "annotation": ""}, "snippet": " countdown = range(1,10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L119_C8", "label": "reverse()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [8, 2, 0.8041, 0.0068, 2, 0.17, 0.6667, 109, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "reverse", "annotation": ""}, "snippet": " countdown.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:For_L120_C8", "label": "for number", "type": "for", "loc": [120, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [6, 2, 0.8176, 0.0203, 2, 0.17, 0.7778, 408, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for number in countdown:\n print(\"%s\" %number)\n rospy.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L121_C12", "label": "print()", "type": "expression", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:For_L120_C8", "vector": [8, 3, 0.8176, 0.0068, 3, 0.35, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"%s\" %number)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L122_C12", "label": "sleep()", "type": "expression", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:For_L120_C8", "vector": [8, 3, 0.8243, 0.0068, 3, 0.35, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "label": "while", "type": "while", "loc": [123, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [5, 2, 0.8784, 0.1014, 2, 0.17, 0.8889, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(act_list) > 0 and not rospy.is_shutdown():\n self.behavior = act_list.pop()\n bar = random.choice(SYMBOLS)\n self.recording = True\n self.sound_new.play()\n print(\"\\r\\n\"*15)\n print(bar)\n print(\"%s: %s\" %(count, self.behavior))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L124_C12", "label": "self.behavior = pop()", "type": "assigned_variable", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [14, 3, 0.8378, 0.0068, 3, 0.09, 0.0, 931, 3, 0, 0, 0, 969, 10, 1], "semantic": {"name": "self.behavior", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.behavior = act_list.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L125_C12", "label": "bar = choice()", "type": "assigned_variable", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [14, 3, 0.8446, 0.0068, 3, 0.09, 0.0833, 300, 3, 1, 0, 0, 30, 10, 1], "semantic": {"name": "bar", "arg_names": [], "import_names": [], "rhs_call_name": "choice", "annotation": ""}, "snippet": " bar = random.choice(SYMBOLS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L126_C12", "label": "self.recording =", "type": "assigned_variable", "loc": [126, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [14, 3, 0.8514, 0.0068, 3, 0.09, 0.1667, 770, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.recording", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.recording = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L127_C12", "label": "play()", "type": "expression", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.8581, 0.0068, 3, 0.09, 0.25, 836, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "play", "arg_names": [], "import_names": [], "rhs_call_name": "play", "annotation": ""}, "snippet": " self.sound_new.play()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L128_C12", "label": "print()", "type": "expression", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.8649, 0.0068, 3, 0.09, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\r\\n\"*15)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L129_C12", "label": "print()", "type": "expression", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.8716, 0.0068, 3, 0.09, 0.4167, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(bar)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L130_C12", "label": "print()", "type": "expression", "loc": [130, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.8784, 0.0068, 3, 0.09, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"%s: %s\" %(count, self.behavior))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L131_C12", "label": "print()", "type": "expression", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.8851, 0.0068, 3, 0.09, 0.5833, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(bar)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L132_C12", "label": "print()", "type": "expression", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.8919, 0.0068, 3, 0.09, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\r\\n\"*15)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L133_C12", "label": "sleep()", "type": "expression", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.8986, 0.0068, 3, 0.09, 0.75, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(record_dur)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L134_C12", "label": "self.recording =", "type": "assigned_variable", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [14, 3, 0.9054, 0.0068, 3, 0.09, 0.8333, 770, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.recording", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.recording = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L135_C12", "label": "play()", "type": "expression", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.9122, 0.0068, 3, 0.09, 0.9167, 836, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "play", "arg_names": [], "import_names": [], "rhs_call_name": "play", "annotation": ""}, "snippet": " self.sound_done.play()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L137_C12", "label": "sleep()", "type": "expression", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "vector": [8, 3, 0.9257, 0.0068, 3, 0.09, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(recovery_dur)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L138_C8", "label": "if", "type": "if", "loc": [138, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "vector": [4, 2, 0.9426, 0.027, 2, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not act_list:\n print(\"Training Session Completed\")\n else:\n print(\"Training Session Ended Early\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L139_C12", "label": "print()", "type": "expression", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L138_C8", "vector": [8, 3, 0.9392, 0.0068, 3, 0.99, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Training Session Completed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L141_C12", "label": "print()", "type": "expression", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L138_C8", "vector": [8, 3, 0.9527, 0.0068, 3, 0.99, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Training Session Ended Early\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "label": "if", "type": "if", "loc": [143, 147], "level": 0, "parent": null, "vector": [4, 0, 0.9797, 0.0338, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__=='__main__':\n rospy.init_node('wouse_trainer')\n WOUSE_PKG = roslib.packages.get_pkg_dir('wouse')\n wt = WouseTrainer()\n wt.run(wt.rounds, wt.record_dur, wt.recovery_dur)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L144_C4", "label": "init_node()", "type": "expression", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "vector": [8, 1, 0.973, 0.0068, 1, 0.97, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('wouse_trainer')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L145_C4", "label": "WOUSE_PKG = get_pkg_dir()", "type": "assigned_variable", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "vector": [14, 1, 0.9797, 0.0068, 1, 0.97, 0.3333, 596, 3, 1, 0, 0, 53, 10, 1], "semantic": {"name": "WOUSE_PKG", "arg_names": [], "import_names": [], "rhs_call_name": "get_pkg_dir", "annotation": ""}, "snippet": " WOUSE_PKG = roslib.packages.get_pkg_dir('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L146_C4", "label": "wt = WouseTrainer()", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "vector": [14, 1, 0.9865, 0.0068, 1, 0.97, 0.6667, 396, 3, 0, 0, 0, 381, 10, 1], "semantic": {"name": "wt", "arg_names": [], "import_names": [], "rhs_call_name": "WouseTrainer", "annotation": ""}, "snippet": " wt = WouseTrainer()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L147_C4", "label": "run()", "type": "expression", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "vector": [8, 1, 0.9932, 0.0068, 1, 0.97, 1.0, 679, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " wt.run(wt.rounds, wt.record_dur, wt.recovery_dur)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L46_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L47_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Return_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:For_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:For_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:For_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L130_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Assign_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99468:If_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99468:Expr_L147_C4"}] |
#!/usr/bin/env python
import sys
import numpy as np
from threading import Condition
import pickle
import csv
import pygame
from sklearn import preprocessing as pps, svm
import roslib; roslib.load_manifest('wouse')
import rospy
from std_msgs.msg import Header
from geometry_msgs.msg import Vector3Stamped
from wouse.srv import WouseRunStop, WouseRunStopRequest
class Wouse(object):
"""
Subscribes to mouse movements, detects wincing, and signals e-stop.
"""
def __init__(self, svm_datafile):
"""Initialize svm classifier and needed services."""
(self.scaler, self.classifier) = self.init_classifier(svm_datafile)
rospy.loginfo("SVM Trained on data from %s" %svm_datafile)
rospy.Subscriber('wouse_movement', Vector3Stamped, self.movement_cb)
self.window = []
self.data = []
pygame.init()
self.sound_new = pygame.mixer.Sound('../../sounds/new_item.wav')
#self.csv_writer = csv.writer(open(out_file, 'ab'))
rospy.loginfo("[%s]: Ready" %rospy.get_name())
def init_classifier(self, filename):
"""Unpickle svm training data, train classifier"""
with open(filename, 'rb') as f:
svm_data = pickle.load(f)
labels = svm_data['labels']
data = svm_data['data']
scaler = pps.Scaler().fit(data)
data_scaled = scaler.transform(data)
classifier = svm.SVC()
classifier.fit(data_scaled, labels)
return (scaler, classifier)
def movement_cb(self, v3):
"""Filter out small movements, check classifier, call stop if needed."""
#line = [v3.header.stamp.to_sec(), v3.vector.x, v3.vector.y]
#self.csv_writer.writerow(line)
if (v3.vector.x**2+v3.vector.y**2)**(0.5) < 2.5:
return
if self.classify_svm(v3.vector.x, v3.vector.y, v3.header.stamp):
self.sound_new.play()
rospy.loginfo("Wince Detected, stopping robot!")
else:
rospy.loginfo("Not a wince")
def classify_svm(self, x, y, time):
"""Build the descriptor vector for the incoming mouse event, and classify with the svm."""
datum = []
mag = (x**2+y**2)**(0.5)
angle = np.arctan2(y,x)
datum.append(mag)
datum.append(angle)
self.window.append([x,y,time])
while (self.window[-1][-1] - self.window[0][-1]) > rospy.Duration(0.25):
self.window.pop(0)
win = np.array(self.window)
datum.append(len(self.window))
win_x = np.sum(win[:,0])
win_y = np.sum(win[:,1])
win_mag = (win_x**2+win_y**2)**(0.5)
datum.append(win_mag/len(self.window))
datum.append(np.arctan2(win_y, win_x))
datum_scaled = self.scaler.transform(datum)
prediction = self.classifier.predict(datum_scaled)
if prediction[0] == 1.:
return True
if __name__=='__main__':
rospy.init_node('wouse_node')
wouse = Wouse(sys.argv[1])
rospy.spin()
| ajibawa-2023/Python-Code-Large/train/row_99469 | 68 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0353, 0.0118, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0471, 0.0118, 0, 0.66, 0.0714, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:ImportFrom_L5_C0", "label": "from threading import Condition", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0118, 0, 0.66, 0.1429, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Condition"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Condition"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Import_L6_C0", "label": "pickle import pickle", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0706, 0.0118, 0, 0.66, 0.2143, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Import_L7_C0", "label": "csv import csv", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0824, 0.0118, 0, 0.66, 0.2857, 312, 0, 1, 0, 0, 312, 0, 0], "semantic": {"name": "csv", "arg_names": [], "import_names": ["csv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import csv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Import_L9_C0", "label": "pygame import pygame", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1059, 0.0118, 0, 0.66, 0.3571, 87, 0, 1, 0, 0, 87, 0, 0], "semantic": {"name": "pygame", "arg_names": [], "import_names": ["pygame"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pygame"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:ImportFrom_L10_C0", "label": "from sklearn import pps, svm", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0118, 0, 0.66, 0.4286, 259, 0, 2, 0, 0, 259, 0, 0], "semantic": {"name": "sklearn", "arg_names": [], "import_names": ["pps", "svm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from sklearn import preprocessing as pps, svm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Import_L12_C0", "label": "roslib import roslib", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1412, 0.0118, 0, 0.66, 0.5, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L12_C15", "label": "load_manifest()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.1412, 0.0118, 0, 0.66, 0.5714, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('wouse')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Import_L13_C0", "label": "rospy import rospy", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1529, 0.0118, 0, 0.66, 0.6429, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:ImportFrom_L14_C0", "label": "from std_msgs.msg import Header", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1647, 0.0118, 0, 0.66, 0.7143, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Header"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Header"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:ImportFrom_L15_C0", "label": "from geometry_msgs.msg import Vector3Stamped", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1765, 0.0118, 0, 0.66, 0.7857, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["Vector3Stamped"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import Vector3Stamped"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:ImportFrom_L17_C0", "label": "from wouse.srv import WouseRunStop, WouseRunStopRequest", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.0118, 0, 0.66, 0.8571, 855, 0, 2, 0, 0, 855, 0, 0], "semantic": {"name": "wouse.srv", "arg_names": [], "import_names": ["WouseRunStop", "WouseRunStopRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wouse.srv import WouseRunStop, WouseRunStopRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "label": "Wouse", "type": "class", "loc": [20, 80], "level": 0, "parent": null, "vector": [3, 0, 0.5882, 0.7176, 0, 0.66, 0.9286, 173, 0, 4, 0, 0, 186, 0, 35], "semantic": {"name": "Wouse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Wouse(object):\n \"\"\"\n Subscribes to mouse movements, detects wincing, and signals e-stop.\n \"\"\"\n def __init__(self, svm_datafile):\n \"\"\"Initialize svm classifier and needed services.\"\"\"\n (self.scaler, self.classifier) = self.init_classifier(svm_datafile)\n rospy.loginfo(\"SVM Trained on data from %s\" %svm_datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "vector": [8, 1, 0.2588, 0.0353, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Subscribes to mouse movements, detects wincing, and signals e-stop.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "label": "__init__", "type": "function", "loc": [24, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "vector": [2, 1, 0.3412, 0.1294, 1, 0.58, 0.25, 555, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "svm_datafile"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, svm_datafile):\n \"\"\"Initialize svm classifier and needed services.\"\"\"\n (self.scaler, self.classifier) = self.init_classifier(svm_datafile)\n rospy.loginfo(\"SVM Trained on data from %s\" %svm_datafile)\n rospy.Subscriber('wouse_movement', Vector3Stamped, self.movement_cb)\n self.window = []\n self.data = []\n pygame.init()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L25_C8", "label": "expression", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [8, 2, 0.2941, 0.0118, 2, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initialize svm classifier and needed services.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L26_C8", "label": " = init_classifier()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [14, 2, 0.3059, 0.0118, 2, 0.78, 0.125, 0, 3, 1, 0, 0, 596, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "init_classifier", "annotation": ""}, "snippet": " (self.scaler, self.classifier) = self.init_classifier(svm_datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L27_C8", "label": "loginfo()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [8, 2, 0.3176, 0.0118, 2, 0.78, 0.25, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"SVM Trained on data from %s\" %svm_datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L28_C8", "label": "Subscriber()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [8, 2, 0.3294, 0.0118, 2, 0.78, 0.375, 455, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber('wouse_movement', Vector3Stamped, self.movement_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L29_C8", "label": "self.window =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [14, 2, 0.3412, 0.0118, 2, 0.78, 0.5, 313, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.window", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.window = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L30_C8", "label": "self.data =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [14, 2, 0.3529, 0.0118, 2, 0.78, 0.625, 838, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L31_C8", "label": "init()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [8, 2, 0.3647, 0.0118, 2, 0.78, 0.75, 319, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init", "arg_names": [], "import_names": [], "rhs_call_name": "init", "annotation": ""}, "snippet": " pygame.init()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L32_C8", "label": "self.sound_new = Sound()", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [14, 2, 0.3765, 0.0118, 2, 0.78, 0.875, 749, 3, 1, 0, 0, 791, 10, 1], "semantic": {"name": "self.sound_new", "arg_names": [], "import_names": [], "rhs_call_name": "Sound", "annotation": ""}, "snippet": " self.sound_new = pygame.mixer.Sound('../../sounds/new_item.wav')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L34_C8", "label": "loginfo()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "vector": [8, 2, 0.4, 0.0118, 2, 0.78, 1.0, 607, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"[%s]: Ready\" %rospy.get_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "label": "init_classifier", "type": "function", "loc": [36, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "vector": [2, 1, 0.4824, 0.1294, 1, 0.58, 0.5, 596, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "init_classifier", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def init_classifier(self, filename):\n \"\"\"Unpickle svm training data, train classifier\"\"\"\n with open(filename, 'rb') as f:\n svm_data = pickle.load(f)\n labels = svm_data['labels']\n data = svm_data['data']\n scaler = pps.Scaler().fit(data)\n data_scaled = scaler.transform(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L37_C8", "label": "expression", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [8, 2, 0.4353, 0.0118, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Unpickle svm training data, train classifier\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L39_C12", "label": "svm_data = load()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [14, 2, 0.4588, 0.0118, 2, 0.73, 0.0, 591, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "svm_data", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " svm_data = pickle.load(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L40_C8", "label": "labels =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [14, 2, 0.4706, 0.0118, 2, 0.73, 0.1429, 283, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " labels = svm_data['labels']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L41_C8", "label": "data =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [14, 2, 0.4824, 0.0118, 2, 0.73, 0.2857, 929, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = svm_data['data']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L42_C8", "label": "scaler = fit()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [14, 2, 0.4941, 0.0118, 2, 0.73, 0.4286, 702, 3, 1, 0, 0, 828, 10, 2], "semantic": {"name": "scaler", "arg_names": [], "import_names": [], "rhs_call_name": "fit", "annotation": ""}, "snippet": " scaler = pps.Scaler().fit(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L43_C8", "label": "data_scaled = transform()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [14, 2, 0.5059, 0.0118, 2, 0.73, 0.5714, 579, 3, 1, 0, 0, 48, 10, 1], "semantic": {"name": "data_scaled", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " data_scaled = scaler.transform(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L44_C8", "label": "classifier = SVC()", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [14, 2, 0.5176, 0.0118, 2, 0.73, 0.7143, 71, 3, 0, 0, 0, 706, 10, 1], "semantic": {"name": "classifier", "arg_names": [], "import_names": [], "rhs_call_name": "SVC", "annotation": ""}, "snippet": " classifier = svm.SVC()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L45_C8", "label": "fit()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [8, 2, 0.5294, 0.0118, 2, 0.73, 0.8571, 828, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "fit", "arg_names": [], "import_names": [], "rhs_call_name": "fit", "annotation": ""}, "snippet": " classifier.fit(data_scaled, labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Return_L46_C8", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "vector": [13, 2, 0.5412, 0.0118, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (scaler, classifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L48_C4", "label": "movement_cb", "type": "function", "loc": [48, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "vector": [2, 1, 0.6235, 0.1294, 1, 0.58, 0.75, 514, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "movement_cb", "arg_names": ["self", "v3"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def movement_cb(self, v3):\n \"\"\"Filter out small movements, check classifier, call stop if needed.\"\"\"\n #line = [v3.header.stamp.to_sec(), v3.vector.x, v3.vector.y]\n #self.csv_writer.writerow(line)\n if (v3.vector.x**2+v3.vector.y**2)**(0.5) < 2.5:\n return\n if self.classify_svm(v3.vector.x, v3.vector.y, v3.header.stamp):\n self.sound_new.play()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L49_C8", "label": "expression", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L48_C4", "vector": [8, 2, 0.5765, 0.0118, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Filter out small movements, check classifier, call stop if needed.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L52_C8", "label": "if", "type": "if", "loc": [52, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L48_C4", "vector": [4, 2, 0.6176, 0.0235, 2, 0.4, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (v3.vector.x**2+v3.vector.y**2)**(0.5) < 2.5:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Return_L53_C12", "label": "return", "type": "return", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L52_C8", "vector": [13, 3, 0.6235, 0.0118, 3, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L54_C8", "label": "if", "type": "if", "loc": [54, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L48_C4", "vector": [4, 2, 0.6588, 0.0588, 2, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.classify_svm(v3.vector.x, v3.vector.y, v3.header.stamp):\n self.sound_new.play()\n rospy.loginfo(\"Wince Detected, stopping robot!\")\n else:\n rospy.loginfo(\"Not a wince\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L55_C12", "label": "play()", "type": "expression", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L54_C8", "vector": [8, 3, 0.6471, 0.0118, 3, 0.41, 0.0, 836, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "play", "arg_names": [], "import_names": [], "rhs_call_name": "play", "annotation": ""}, "snippet": " self.sound_new.play()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L56_C12", "label": "loginfo()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L54_C8", "vector": [8, 3, 0.6588, 0.0118, 3, 0.41, 0.5, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"Wince Detected, stopping robot!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L58_C12", "label": "loginfo()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L54_C8", "vector": [8, 3, 0.6824, 0.0118, 3, 0.41, 1.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(\"Not a wince\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "label": "classify_svm", "type": "function", "loc": [60, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "vector": [2, 1, 0.8235, 0.2471, 1, 0.58, 1.0, 967, 0, 4, 1, 0, 0, 0, 17], "semantic": {"name": "classify_svm", "arg_names": ["self", "x", "y", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def classify_svm(self, x, y, time):\n \"\"\"Build the descriptor vector for the incoming mouse event, and classify with the svm.\"\"\"\n datum = []\n mag = (x**2+y**2)**(0.5)\n angle = np.arctan2(y,x)\n datum.append(mag)\n datum.append(angle)\n self.window.append([x,y,time])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L61_C8", "label": "expression", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [8, 2, 0.7176, 0.0118, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the descriptor vector for the incoming mouse event, and classify with the svm.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L62_C8", "label": "datum =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.7294, 0.0118, 2, 0.75, 0.0588, 975, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "datum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " datum = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L63_C8", "label": "mag =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.7412, 0.0118, 2, 0.75, 0.1176, 533, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mag = (x**2+y**2)**(0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L64_C8", "label": "angle = arctan2()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.7529, 0.0118, 2, 0.75, 0.1765, 418, 3, 2, 0, 0, 895, 10, 1], "semantic": {"name": "angle", "arg_names": [], "import_names": [], "rhs_call_name": "arctan2", "annotation": ""}, "snippet": " angle = np.arctan2(y,x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L65_C8", "label": "append()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [8, 2, 0.7647, 0.0118, 2, 0.75, 0.2353, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(mag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L66_C8", "label": "append()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [8, 2, 0.7765, 0.0118, 2, 0.75, 0.2941, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(angle)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L67_C8", "label": "append()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [8, 2, 0.7882, 0.0118, 2, 0.75, 0.3529, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.window.append([x,y,time])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:While_L68_C8", "label": "while", "type": "while", "loc": [68, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [5, 2, 0.8059, 0.0235, 2, 0.75, 0.4118, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while (self.window[-1][-1] - self.window[0][-1]) > rospy.Duration(0.25):\n self.window.pop(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L69_C12", "label": "pop()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:While_L68_C8", "vector": [8, 3, 0.8118, 0.0118, 3, 0.29, 0.0, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.window.pop(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L70_C8", "label": "win = array()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.8235, 0.0118, 2, 0.75, 0.4706, 419, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "win", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " win = np.array(self.window)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L71_C8", "label": "append()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [8, 2, 0.8353, 0.0118, 2, 0.75, 0.5294, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(len(self.window))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L72_C8", "label": "win_x = sum()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.8471, 0.0118, 2, 0.75, 0.5882, 67, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "win_x", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " win_x = np.sum(win[:,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L73_C8", "label": "win_y = sum()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.8588, 0.0118, 2, 0.75, 0.6471, 815, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "win_y", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " win_y = np.sum(win[:,1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L74_C8", "label": "win_mag =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.8706, 0.0118, 2, 0.75, 0.7059, 642, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "win_mag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " win_mag = (win_x**2+win_y**2)**(0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L75_C8", "label": "append()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [8, 2, 0.8824, 0.0118, 2, 0.75, 0.7647, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(win_mag/len(self.window))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L76_C8", "label": "append()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [8, 2, 0.8941, 0.0118, 2, 0.75, 0.8235, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " datum.append(np.arctan2(win_y, win_x))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L77_C8", "label": "datum_scaled = transform()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.9059, 0.0118, 2, 0.75, 0.8824, 152, 3, 1, 0, 0, 48, 10, 1], "semantic": {"name": "datum_scaled", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " datum_scaled = self.scaler.transform(datum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L78_C8", "label": "prediction = predict()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [14, 2, 0.9176, 0.0118, 2, 0.75, 0.9412, 192, 3, 1, 0, 0, 127, 10, 1], "semantic": {"name": "prediction", "arg_names": [], "import_names": [], "rhs_call_name": "predict", "annotation": ""}, "snippet": " prediction = self.classifier.predict(datum_scaled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L79_C8", "label": "if", "type": "if", "loc": [79, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "vector": [4, 2, 0.9353, 0.0235, 2, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if prediction[0] == 1.:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Return_L80_C12", "label": "return", "type": "return", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L79_C8", "vector": [13, 3, 0.9412, 0.0118, 3, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L82_C0", "label": "if", "type": "if", "loc": [82, 85], "level": 0, "parent": null, "vector": [4, 0, 0.9824, 0.0471, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__=='__main__':\n rospy.init_node('wouse_node')\n wouse = Wouse(sys.argv[1])\n rospy.spin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L83_C4", "label": "init_node()", "type": "expression", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L82_C0", "vector": [8, 1, 0.9765, 0.0118, 1, 0.94, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('wouse_node')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L84_C4", "label": "wouse = Wouse()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L82_C0", "vector": [14, 1, 0.9882, 0.0118, 1, 0.94, 0.5, 288, 3, 1, 0, 0, 173, 10, 1], "semantic": {"name": "wouse", "arg_names": [], "import_names": [], "rhs_call_name": "Wouse", "annotation": ""}, "snippet": " wouse = Wouse(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L85_C4", "label": "spin()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L82_C0", "vector": [8, 1, 1.0, 0.0118, 1, 0.94, 1.0, 17, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "spin", "arg_names": [], "import_names": [], "rhs_call_name": "spin", "annotation": ""}, "snippet": " rospy.spin()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Return_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Return_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:While_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:While_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L79_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Return_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99469:If_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99469:Expr_L85_C4"}] |
#!/usr/bin/env python
import camera_setup_lib as csl
import camera_config as cc
##
# Createss a dictionary mapping camera UUID to OpenCV IDs
def camera_ids():
uidIndexDict = {}
numCameras = csl.init_bus1394()
for i in range(numCameras):
uidIndexDict[csl.getCameraUID(i)] = i
csl.endCameraSetup()
return uidIndexDict
##
# Returns a dictionary mapping from camera names to OpenCV ID for all hooked up
# cameras
def camera_names():
ids = camera_ids()
all_ids = {}
for k in cc.camera_parameters.keys():
all_ids[cc.camera_parameters[k]['uid']] = k
name_camera_map = {}
for k in ids.keys():
name_camera_map[all_ids[k]] = ids[k]
return name_camera_map
##
# Returns the OpenCV ID of a named camera
# @param camera_name
def lookup_by_name(camera_name):
ids = camera_ids()
print 'ids:', ids
return ids[cc.camera_parameters[camera_name]['uid']]
if __name__ == '__main__':
print 'Camera UUIDs', camera_ids()
print 'Available cameras:', camera_names()
| ajibawa-2023/Python-Code-Large/train/row_99471 | 25 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Import_L2_C0", "label": "camera_setup_lib import csl", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.025, 0, 0.66, 0.0, 303, 0, 1, 0, 0, 303, 0, 0], "semantic": {"name": "camera_setup_lib", "arg_names": [], "import_names": ["csl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import camera_setup_lib as csl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Import_L3_C0", "label": "camera_config import cc", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.075, 0.025, 0, 0.66, 0.2, 94, 0, 1, 0, 0, 94, 0, 0], "semantic": {"name": "camera_config", "arg_names": [], "import_names": ["cc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import camera_config as cc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "label": "camera_ids", "type": "function", "loc": [7, 13], "level": 0, "parent": null, "vector": [2, 0, 0.25, 0.175, 0, 0.66, 0.4, 361, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "camera_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def camera_ids():\n\tuidIndexDict = {}\n\tnumCameras = csl.init_bus1394()\n\tfor i in range(numCameras):\n\t\tuidIndexDict[csl.getCameraUID(i)] = i\n\tcsl.endCameraSetup()\n\treturn uidIndexDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L8_C1", "label": "uidIndexDict =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "vector": [14, 1, 0.2, 0.025, 1, 0.07, 0.0, 891, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "uidIndexDict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tuidIndexDict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L9_C1", "label": "numCameras = init_bus1394()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "vector": [14, 1, 0.225, 0.025, 1, 0.07, 0.25, 9, 3, 0, 0, 0, 216, 10, 1], "semantic": {"name": "numCameras", "arg_names": [], "import_names": [], "rhs_call_name": "init_bus1394", "annotation": ""}, "snippet": "\tnumCameras = csl.init_bus1394()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L10_C1", "label": "for i", "type": "for", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "vector": [6, 1, 0.2625, 0.05, 1, 0.07, 0.5, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in range(numCameras):\n\t\tuidIndexDict[csl.getCameraUID(i)] = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L11_C2", "label": "assign", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L10_C1", "vector": [14, 2, 0.275, 0.025, 2, 0.38, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tuidIndexDict[csl.getCameraUID(i)] = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Expr_L12_C1", "label": "endCameraSetup()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "vector": [8, 1, 0.3, 0.025, 1, 0.07, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "endCameraSetup", "arg_names": [], "import_names": [], "rhs_call_name": "endCameraSetup", "annotation": ""}, "snippet": "\tcsl.endCameraSetup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Return_L13_C1", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "vector": [13, 1, 0.325, 0.025, 1, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn uidIndexDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "label": "camera_names", "type": "function", "loc": [18, 28], "level": 0, "parent": null, "vector": [2, 0, 0.575, 0.275, 0, 0.66, 0.6, 262, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "camera_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def camera_names():\n ids = camera_ids()\n all_ids = {}\n\n for k in cc.camera_parameters.keys():\n all_ids[cc.camera_parameters[k]['uid']] = k\n\n name_camera_map = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L19_C4", "label": "ids = camera_ids()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "vector": [14, 1, 0.475, 0.025, 1, 0.4, 0.0, 202, 3, 0, 0, 0, 361, 10, 1], "semantic": {"name": "ids", "arg_names": [], "import_names": [], "rhs_call_name": "camera_ids", "annotation": ""}, "snippet": " ids = camera_ids()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L20_C4", "label": "all_ids =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "vector": [14, 1, 0.5, 0.025, 1, 0.4, 0.2, 989, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "all_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " all_ids = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L22_C4", "label": "for k", "type": "for", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "vector": [6, 1, 0.5625, 0.05, 1, 0.4, 0.4, 954, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in cc.camera_parameters.keys():\n all_ids[cc.camera_parameters[k]['uid']] = k"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L23_C8", "label": "assign", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L22_C4", "vector": [14, 2, 0.575, 0.025, 2, 0.03, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " all_ids[cc.camera_parameters[k]['uid']] = k"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L25_C4", "label": "name_camera_map =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "vector": [14, 1, 0.625, 0.025, 1, 0.4, 0.6, 549, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "name_camera_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name_camera_map = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L26_C4", "label": "for k", "type": "for", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "vector": [6, 1, 0.6625, 0.05, 1, 0.4, 0.8, 954, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in ids.keys():\n name_camera_map[all_ids[k]] = ids[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L27_C8", "label": "assign", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L26_C4", "vector": [14, 2, 0.675, 0.025, 2, 0.12, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name_camera_map[all_ids[k]] = ids[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Return_L28_C4", "label": "return", "type": "return", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "vector": [13, 1, 0.7, 0.025, 1, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return name_camera_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L33_C0", "label": "lookup_by_name", "type": "function", "loc": [33, 36], "level": 0, "parent": null, "vector": [2, 0, 0.8625, 0.1, 0, 0.66, 0.8, 41, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "lookup_by_name", "arg_names": ["camera_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def lookup_by_name(camera_name):\n ids = camera_ids()\n print('ids:', ids)\n return ids[cc.camera_parameters[camera_name]['uid']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L34_C4", "label": "ids = camera_ids()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L33_C0", "vector": [14, 1, 0.85, 0.025, 1, 0.53, 0.0, 202, 3, 0, 0, 0, 361, 10, 1], "semantic": {"name": "ids", "arg_names": [], "import_names": [], "rhs_call_name": "camera_ids", "annotation": ""}, "snippet": " ids = camera_ids()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Expr_L35_C4", "label": "print()", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L33_C0", "vector": [8, 1, 0.875, 0.025, 1, 0.53, 0.5, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('ids:', ids)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Return_L36_C4", "label": "return", "type": "return", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L33_C0", "vector": [13, 1, 0.9, 0.025, 1, 0.53, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ids[cc.camera_parameters[camera_name]['uid']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:If_L38_C0", "label": "if", "type": "if", "loc": [38, 40], "level": 0, "parent": null, "vector": [4, 0, 0.975, 0.075, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n print('Camera UUIDs', camera_ids())\n print('Available cameras:', camera_names())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Expr_L39_C4", "label": "print()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:If_L38_C0", "vector": [8, 1, 0.975, 0.025, 1, 0.33, 0.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Camera UUIDs', camera_ids())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99471:Expr_L40_C4", "label": "print()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99471:If_L38_C0", "vector": [8, 1, 1.0, 0.025, 1, 0.33, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Available cameras:', camera_names())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L8_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L9_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L10_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L10_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Expr_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Return_L13_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Return_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Return_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99471:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99471:Expr_L40_C4"}] |
import roslib
roslib.load_manifest('hrl_camera')
import cv
camera_parameters = {
#A sample configuration
'default' :
{
'calibration_image_width' : 320.0,
'calibration_image_height' : 240.0,
'focal_length_x_in_pixels' : 161.80593,
'focal_length_y_in_pixels' : 163.49099,
'optical_center_x_in_pixels' : 159.78997,
'optical_center_y_in_pixels' : 136.73113,
'lens_distortion_radial_1' : -0.26334,
'lens_distortion_radial_2' : 0.05096,
'lens_distortion_tangential_1' : 0.00105,
'lens_distortion_tangential_2' : -0.00016,
'opencv_bayer_pattern' : None,
#whether this camera was mounted upside down
'upside_down': True,
'color': False,
#the class to load in a normal python import statement
'class': 'firefly',
#UUID obtained by calling 'python camera_uuid.py'
'uid': None
},
'dummy_deepthought':
{
'calibration_image_width' : 640.0,
'calibration_image_height' : 480.0,
'focal_length_x_in_pixels' : 362.381,
'focal_length_y_in_pixels' : 362.260,
'optical_center_x_in_pixels' : 275.630,
'optical_center_y_in_pixels' : 267.914,
'lens_distortion_radial_1' : -0.270544,
'lens_distortion_radial_2' : 0.0530850,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : cv.CV_BayerBG2BGR,
'upside_down': False,
'color': True,
'class': 'firefly',
'uid': 7281161
},
#########################################################################
# Start of cameras on Cody
#########################################################################
'mekabotUTM':
{
'calibration_image_width' : 640.0,
'calibration_image_height' : 480.0,
'focal_length_x_in_pixels' : 362.381,
'focal_length_y_in_pixels' : 362.260,
'optical_center_x_in_pixels' : 275.630,
'optical_center_y_in_pixels' : 267.914,
'lens_distortion_radial_1' : -0.270544,
'lens_distortion_radial_2' : 0.0530850,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : cv.CV_BayerGB2BGR,
#'opencv_bayer_pattern' : cv.CV_BayerBG2BGR,
'type': 'Point Grey Firefly',
'class': 'firefly',
'color': True,
'uid': 8520228
},
#########################################################################
# Start of camera on ELE
#########################################################################
'catadioptric' :
{
'calibration_image_width' : 640.0,
'calibration_image_height' : 480.0,
'focal_length_x_in_pixels' : 360,
'focal_length_y_in_pixels' : 360,
'optical_center_x_in_pixels' : 320,
'optical_center_y_in_pixels' : 240,
'lens_distortion_radial_1' : 0,
'lens_distortion_radial_2' : 0,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : None,
'type': 'Point Grey Firefly',
'class': 'firefly',
'color': False,
'uid': 7281154
},
'stereo_left':
{
'calibration_image_width' : 640.0,
'calibration_image_height' : 480.0,
'focal_length_x_in_pixels' : 1017.33,
'focal_length_y_in_pixels' : 1018.47,
'optical_center_x_in_pixels' : 306.264,
'optical_center_y_in_pixels' : 226.465,
'lens_distortion_radial_1' : -0.480961,
'lens_distortion_radial_2' : 0.341886,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : cv.CV_BayerGR2BGR,
'type': 'Point Grey Firefly',
'class': 'firefly',
'color': True,
'frame_rate': 7.5,
'ros_topic': '/stereohead/left/color_image',
'uid': 7140923
},
'stereo_right':
{
'calibration_image_width' : 640.0,
'calibration_image_height' : 480.0,
'focal_length_x_in_pixels' : 1013.70,
'focal_length_y_in_pixels' : 1015.33,
'optical_center_x_in_pixels' : 303.834,
'optical_center_y_in_pixels' : 219.792,
'lens_distortion_radial_1' : -0.530238,
'lens_distortion_radial_2' : 0.766580,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : cv.CV_BayerGR2BGR,
'type': 'Point Grey Firefly',
'class': 'firefly',
'color': True,
'frame_rate': 7.5,
'ros_topic': '/stereohead/right/color_image',
'uid': 7041054
},
'snozzberry_hand' :
{
'calibration_image_width' : 640.0,
'calibration_image_height' : 480.0,
'focal_length_x_in_pixels' : 351.38 ,
'focal_length_y_in_pixels' : 351.01,
'optical_center_x_in_pixels' : 301.92,
'optical_center_y_in_pixels' : 203.98,
'lens_distortion_radial_1' : -0.258504,
'lens_distortion_radial_2' : 0.0482161,
'lens_distortion_tangential_1' : 0.0,
'lens_distortion_tangential_2' : 0.0,
'opencv_bayer_pattern' : cv.CV_BayerGR2BGR,
'color': True,
'type': 'Point Grey Firefly',
'class': 'firefly',
'uid': 7140879,
'fovy': 62.
},
'ele_carriage' :
{
'calibration_image_width' : 1024.0,
'calibration_image_height' : 768.0,
'focal_length_x_in_pixels' : 624.043,
'focal_length_y_in_pixels' : 625.488,
'optical_center_x_in_pixels' : 531.805 ,
'optical_center_y_in_pixels' : 404.651,
'lens_distortion_radial_1' : -0.314033,
'lens_distortion_radial_2' : 0.0973255,
'lens_distortion_tangential_1' : 0.,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : cv.CV_BayerGR2RGB,
'cv_cap_prop_mode' : 101,
'upside_down': False,
'color': True,
'type': 'Point Grey DragonFly2',
'class': 'dragonfly2',
'uid': 9030523
},
'ele_utm_old' :
{
'calibration_image_width' : 640.0,
'calibration_image_height' : 480.0,
'focal_length_x_in_pixels' : 358.804,
'focal_length_y_in_pixels' : 359.702,
'optical_center_x_in_pixels' : 309.151,
'optical_center_y_in_pixels' : 226.581,
'lens_distortion_radial_1' : -0.273398,
'lens_distortion_radial_2' : 0.0546037,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'cv_cap_prop_mode' : 101,
'opencv_bayer_pattern' : cv.CV_BayerBG2BGR,
'color': True,
'type': 'Point Grey Firefly',
'class': 'firefly',
'uid': 8520136
},
#########################################################################
# End of cameras on ELE.
#########################################################################
'remote_head' :
{
'calibration_image_width': 1024.0,
'calibration_image_height': 768.0,
'focal_length_x_in_pixels': 863.136719,
'focal_length_y_in_pixels': 863.513672,
'optical_center_x_in_pixels': 546.340088,
'optical_center_y_in_pixels': 403.253998,
'lens_distortion_radial_1': -0.417464,
'lens_distortion_radial_2': 0.217398 ,
'lens_distortion_tangential_1': 0.002538 ,
'lens_distortion_tangential_2': 0.000321 ,
'cv_cap_prop_mode': 101,
'opencv_bayer_pattern': cv.CV_BayerGR2RGB,
'color': True,
'type': 'Point Grey DragonFly2',
'class': 'dragonfly2',
'uid': 9030543
},
'lab_overhead' :
{
'calibration_image_width' : 1024.0,
'calibration_image_height' : 768.0,
'focal_length_x_in_pixels' : 462.794,
'focal_length_y_in_pixels' : 462.041,
'optical_center_x_in_pixels' : 488.590,
'optical_center_y_in_pixels' : 428.419,
'lens_distortion_radial_1' : -0.240018,
'lens_distortion_radial_2' : 0.0372740,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : None,
#whether this camera was mounted upside down
'upside_down': True,
'color': True,
'type': 'Point Grey DragonFly2',
#the class to load in a normal python import statement
'class': 'dragonfly2',
#UUID obtained by calling 'python camera_uuid.py'
'uid': None
}
}
| ajibawa-2023/Python-Code-Large/train/row_99472 | 4 | 247 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99472:Import_L1_C0", "label": "roslib import roslib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.004, 0.004, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99472:Expr_L2_C0", "label": "load_manifest()", "type": "expression", "loc": [2, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0081, 0.004, 0, 0.66, 0.3333, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_camera')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99472:Import_L3_C0", "label": "cv import cv", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0121, 0.004, 0, 0.66, 0.6667, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99472:Assign_L5_C0", "label": "camera_parameters =", "type": "assigned_variable", "loc": [5, 247], "level": 0, "parent": null, "vector": [14, 0, 0.5101, 0.9838, 0, 0.66, 1.0, 359, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "camera_parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "camera_parameters = {\n #A sample configuration\n 'default' :\n {\n 'calibration_image_width' : 320.0,\n 'calibration_image_height' : 240.0, \n 'focal_length_x_in_pixels' : 161.80593,\n 'focal_length_y_in_pixels' : 163.49099,"}] | [] |
import camera
class firefly(camera.camera):
def __init__(self, camera_configuration, opencv_id):
camera.camera.__init__(self, camera_configuration, opencv_id)
| ajibawa-2023/Python-Code-Large/train/row_99473 | 4 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99473:Import_L1_C0", "label": "camera import camera", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "camera", "arg_names": [], "import_names": ["camera"], "rhs_call_name": "", "annotation": ""}, "snippet": "import camera"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99473:ClassDef_L3_C0", "label": "firefly", "type": "class", "loc": [3, 5], "level": 0, "parent": null, "vector": [3, 0, 0.8, 0.6, 0, 0.66, 1.0, 753, 0, 1, 0, 0, 2, 0, 1], "semantic": {"name": "firefly", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class firefly(camera.camera):\n def __init__(self, camera_configuration, opencv_id):\n camera.camera.__init__(self, camera_configuration, opencv_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99473:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99473:ClassDef_L3_C0", "vector": [2, 1, 0.9, 0.4, 1, 0.47, 0.0, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "camera_configuration", "opencv_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, camera_configuration, opencv_id):\n camera.camera.__init__(self, camera_configuration, opencv_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99473:Expr_L5_C8", "label": "__init__()", "type": "expression", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99473:FunctionDef_L4_C4", "vector": [8, 2, 1.0, 0.2, 2, 0.9, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " camera.camera.__init__(self, camera_configuration, opencv_id)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99473:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99473:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99473:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99473:Expr_L5_C8"}] |
import roslib # Needed to load opencv
roslib.load_manifest('hrl_camera') #
import cv
import camera_setup_lib as csl
import camera
class dragonfly2(camera.camera):
def __init__(self, camera_configuration, opencv_id):
self.config = camera_configuration
self.device = opencv_id
self._set_registers()
camera.camera.__init__(self, camera_configuration, opencv_id)
#create capture and related attributes
#self.capture = cv.CaptureFromCAM(self.device)
#if not self.capture:
# raise RuntimeError("Cannot open camera!\n")
cur_codec = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_MODE)
print "dragonfly2: current codec interpretation is : ", cur_codec
integ = cv.SetCaptureProperty(self.capture,cv.CV_CAP_PROP_MODE,
self.config['cv_cap_prop_mode'])
#self.set_frame_rate(3.75) # set it really low to start out.
# increase later.
fps = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS)
print "dragonfly2: fps : ", fps
next_codec = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_MODE)
print "dragonfly2: current codec interpretation is : ", next_codec
def _set_registers(self):
csl.init_bus1394()
# Mode
csl.setRegister(self.device,0x604,0xA0000000)
# Format
csl.setRegister(self.device,0x608,0x20000000)
#sets raw bayer image format for mono image format modes
csl.setRegister(self.device, 0x1048, 0x80000081)
mode = csl.getRegister(self.device, 0x604)
format= csl.getRegister(self.device, 0x608)
rate = csl.getRegister(self.device, 0x600)
#software_trigger
print "dragonfly2: mode", hex(mode)
print "dragonfly2: format", hex(format)
print "dragonfly2: rate", hex(rate)
| ajibawa-2023/Python-Code-Large/train/row_99474 | 29 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Import_L1_C0", "label": "roslib import roslib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib # Needed to load opencv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L2_C0", "label": "load_manifest()", "type": "expression", "loc": [2, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0208, 0, 0.66, 0.2, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_camera') #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Import_L3_C0", "label": "cv import cv", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0208, 0, 0.66, 0.4, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Import_L4_C0", "label": "camera_setup_lib import csl", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0208, 0, 0.66, 0.6, 303, 0, 1, 0, 0, 303, 0, 0], "semantic": {"name": "camera_setup_lib", "arg_names": [], "import_names": ["csl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import camera_setup_lib as csl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Import_L5_C0", "label": "camera import camera", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1042, 0.0208, 0, 0.66, 0.8, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "camera", "arg_names": [], "import_names": ["camera"], "rhs_call_name": "", "annotation": ""}, "snippet": "import camera"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:ClassDef_L7_C0", "label": "dragonfly2", "type": "class", "loc": [7, 46], "level": 0, "parent": null, "vector": [3, 0, 0.5521, 0.8333, 0, 0.66, 1.0, 407, 0, 2, 0, 0, 2, 0, 22], "semantic": {"name": "dragonfly2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class dragonfly2(camera.camera):\n def __init__(self, camera_configuration, opencv_id):\n self.config = camera_configuration\n self.device = opencv_id\n self._set_registers()\n camera.camera.__init__(self, camera_configuration, opencv_id)\n\n #create capture and related attributes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "label": "__init__", "type": "function", "loc": [8, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:ClassDef_L7_C0", "vector": [2, 1, 0.3854, 0.4583, 1, 0.57, 0.0, 555, 0, 3, 0, 0, 0, 0, 9], "semantic": {"name": "__init__", "arg_names": ["self", "camera_configuration", "opencv_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, camera_configuration, opencv_id):\n self.config = camera_configuration\n self.device = opencv_id\n self._set_registers()\n camera.camera.__init__(self, camera_configuration, opencv_id)\n\n #create capture and related attributes\n #self.capture = cv.CaptureFromCAM(self.device)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L9_C8", "label": "self.config =", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [14, 2, 0.1875, 0.0208, 2, 0.1, 0.0, 663, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.config = camera_configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L10_C8", "label": "self.device =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [14, 2, 0.2083, 0.0208, 2, 0.1, 0.1, 993, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.device", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.device = opencv_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L11_C8", "label": "_set_registers()", "type": "expression", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [8, 2, 0.2292, 0.0208, 2, 0.1, 0.2, 787, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_set_registers", "arg_names": [], "import_names": [], "rhs_call_name": "_set_registers", "annotation": ""}, "snippet": " self._set_registers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L12_C8", "label": "__init__()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [8, 2, 0.25, 0.0208, 2, 0.1, 0.3, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " camera.camera.__init__(self, camera_configuration, opencv_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L18_C8", "label": "cur_codec = GetCaptureProperty()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [14, 2, 0.375, 0.0208, 2, 0.1, 0.4, 789, 3, 2, 0, 0, 215, 10, 1], "semantic": {"name": "cur_codec", "arg_names": [], "import_names": [], "rhs_call_name": "GetCaptureProperty", "annotation": ""}, "snippet": " cur_codec = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_MODE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L19_C8", "label": "print()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [8, 2, 0.3958, 0.0208, 2, 0.1, 0.5, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"dragonfly2: current codec interpretation is : \", cur_codec)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L20_C8", "label": "integ = SetCaptureProperty()", "type": "assigned_variable", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [14, 2, 0.4271, 0.0417, 2, 0.1, 0.6, 326, 3, 3, 0, 0, 606, 10, 1], "semantic": {"name": "integ", "arg_names": [], "import_names": [], "rhs_call_name": "SetCaptureProperty", "annotation": ""}, "snippet": " integ = cv.SetCaptureProperty(self.capture,cv.CV_CAP_PROP_MODE,\n self.config['cv_cap_prop_mode'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L26_C8", "label": "fps = GetCaptureProperty()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [14, 2, 0.5417, 0.0208, 2, 0.1, 0.7, 376, 3, 2, 0, 0, 215, 10, 1], "semantic": {"name": "fps", "arg_names": [], "import_names": [], "rhs_call_name": "GetCaptureProperty", "annotation": ""}, "snippet": " fps = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L27_C8", "label": "print()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [8, 2, 0.5625, 0.0208, 2, 0.1, 0.8, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"dragonfly2: fps : \", fps)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L28_C8", "label": "next_codec = GetCaptureProperty()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [14, 2, 0.5833, 0.0208, 2, 0.1, 0.9, 436, 3, 2, 0, 0, 215, 10, 1], "semantic": {"name": "next_codec", "arg_names": [], "import_names": [], "rhs_call_name": "GetCaptureProperty", "annotation": ""}, "snippet": " next_codec = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_MODE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L29_C8", "label": "print()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "vector": [8, 2, 0.6042, 0.0208, 2, 0.1, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"dragonfly2: current codec interpretation is : \", next_codec)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "label": "_set_registers", "type": "function", "loc": [31, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:ClassDef_L7_C0", "vector": [2, 1, 0.8021, 0.3333, 1, 0.57, 1.0, 787, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "_set_registers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_registers(self):\n csl.init_bus1394()\n # Mode\n csl.setRegister(self.device,0x604,0xA0000000)\n # Format\n csl.setRegister(self.device,0x608,0x20000000)\n #sets raw bayer image format for mono image format modes \n csl.setRegister(self.device, 0x1048, 0x80000081)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L32_C8", "label": "init_bus1394()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [8, 2, 0.6667, 0.0208, 2, 0.52, 0.0, 216, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init_bus1394", "arg_names": [], "import_names": [], "rhs_call_name": "init_bus1394", "annotation": ""}, "snippet": " csl.init_bus1394()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L34_C8", "label": "setRegister()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [8, 2, 0.7083, 0.0208, 2, 0.52, 0.1111, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " csl.setRegister(self.device,0x604,0xA0000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L36_C8", "label": "setRegister()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [8, 2, 0.75, 0.0208, 2, 0.52, 0.2222, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " csl.setRegister(self.device,0x608,0x20000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L38_C8", "label": "setRegister()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [8, 2, 0.7917, 0.0208, 2, 0.52, 0.3333, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " csl.setRegister(self.device, 0x1048, 0x80000081)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L40_C8", "label": "mode = getRegister()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [14, 2, 0.8333, 0.0208, 2, 0.52, 0.4444, 991, 3, 2, 0, 0, 921, 10, 1], "semantic": {"name": "mode", "arg_names": [], "import_names": [], "rhs_call_name": "getRegister", "annotation": ""}, "snippet": " mode = csl.getRegister(self.device, 0x604)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L41_C8", "label": "format = getRegister()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [14, 2, 0.8542, 0.0208, 2, 0.52, 0.5556, 293, 3, 2, 0, 0, 921, 10, 1], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "getRegister", "annotation": ""}, "snippet": " format= csl.getRegister(self.device, 0x608)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L42_C8", "label": "rate = getRegister()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [14, 2, 0.875, 0.0208, 2, 0.52, 0.6667, 477, 3, 2, 0, 0, 921, 10, 1], "semantic": {"name": "rate", "arg_names": [], "import_names": [], "rhs_call_name": "getRegister", "annotation": ""}, "snippet": " rate = csl.getRegister(self.device, 0x600)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L44_C8", "label": "print()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [8, 2, 0.9167, 0.0208, 2, 0.52, 0.7778, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"dragonfly2: mode\", hex(mode))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L45_C8", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [8, 2, 0.9375, 0.0208, 2, 0.52, 0.8889, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"dragonfly2: format\", hex(format))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L46_C8", "label": "print()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "vector": [8, 2, 0.9583, 0.0208, 2, 0.52, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"dragonfly2: rate\", hex(rate))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99474:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99474:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99474:Expr_L46_C8"}] |
import camera_config as cc
import camera_uuid as cu
def find_camera(name):
parameters = cc.camera_parameters[name]
opencv_id = cu.lookup_by_name(name)
classname = parameters['class']
import_statement = 'import ' + classname
instantiation = classname + '.' + classname + '(parameters, opencv_id)'
exec import_statement
return eval(instantiation)
if __name__ == '__main__':
import sys
import roslib
roslib.load_manifest('hrl_camera')
import cv
name = sys.argv[1]
cv.NamedWindow(name, cv.CV_WINDOW_AUTOSIZE)
c = find_camera(name)
while True:
f = c.get_frame()
cv.ShowImage(name, f)
cv.WaitKey(33)
| ajibawa-2023/Python-Code-Large/train/row_99475 | 22 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Import_L1_C0", "label": "camera_config import cc", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 94, 0, 1, 0, 0, 94, 0, 0], "semantic": {"name": "camera_config", "arg_names": [], "import_names": ["cc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import camera_config as cc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Import_L2_C0", "label": "camera_uuid import cu", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0385, 0, 0.66, 0.3333, 707, 0, 1, 0, 0, 707, 0, 0], "semantic": {"name": "camera_uuid", "arg_names": [], "import_names": ["cu"], "rhs_call_name": "", "annotation": ""}, "snippet": "import camera_uuid as cu"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "label": "find_camera", "type": "function", "loc": [4, 11], "level": 0, "parent": null, "vector": [2, 0, 0.2885, 0.3077, 0, 0.66, 0.6667, 514, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "find_camera", "arg_names": ["name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_camera(name):\n parameters = cc.camera_parameters[name]\n opencv_id = cu.lookup_by_name(name)\n classname = parameters['class']\n import_statement = 'import ' + classname\n instantiation = classname + '.' + classname + '(parameters, opencv_id)'\n exec(import_statement)\n return eval(instantiation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L5_C4", "label": "parameters =", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "vector": [14, 1, 0.1923, 0.0385, 1, 0.89, 0.0, 29, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = cc.camera_parameters[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L6_C4", "label": "opencv_id = lookup_by_name()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "vector": [14, 1, 0.2308, 0.0385, 1, 0.89, 0.1667, 705, 3, 1, 0, 0, 41, 10, 1], "semantic": {"name": "opencv_id", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_by_name", "annotation": ""}, "snippet": " opencv_id = cu.lookup_by_name(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L7_C4", "label": "classname =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "vector": [14, 1, 0.2692, 0.0385, 1, 0.89, 0.3333, 583, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "classname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " classname = parameters['class']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L8_C4", "label": "import_statement =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "vector": [14, 1, 0.3077, 0.0385, 1, 0.89, 0.5, 206, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "import_statement", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " import_statement = 'import ' + classname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L9_C4", "label": "instantiation =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "vector": [14, 1, 0.3462, 0.0385, 1, 0.89, 0.6667, 761, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "instantiation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " instantiation = classname + '.' + classname + '(parameters, opencv_id)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L10_C4", "label": "exec()", "type": "expression", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "vector": [8, 1, 0.3846, 0.0385, 1, 0.89, 0.8333, 272, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exec", "arg_names": [], "import_names": [], "rhs_call_name": "exec", "annotation": ""}, "snippet": " exec(import_statement)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Return_L11_C4", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "vector": [13, 1, 0.4231, 0.0385, 1, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return eval(instantiation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "label": "if", "type": "if", "loc": [14, 25], "level": 0, "parent": null, "vector": [4, 0, 0.75, 0.4615, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import sys\n import roslib\n roslib.load_manifest('hrl_camera')\n import cv\n name = sys.argv[1]\n cv.NamedWindow(name, cv.CV_WINDOW_AUTOSIZE)\n c = find_camera(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Import_L15_C4", "label": "sys import sys", "type": "import", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "vector": [1, 1, 0.5769, 0.0385, 1, 0.61, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Import_L16_C4", "label": "roslib import roslib", "type": "import", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "vector": [1, 1, 0.6154, 0.0385, 1, 0.61, 0.1429, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L17_C4", "label": "load_manifest()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "vector": [8, 1, 0.6538, 0.0385, 1, 0.61, 0.2857, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": " roslib.load_manifest('hrl_camera')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Import_L18_C4", "label": "cv import cv", "type": "import", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "vector": [1, 1, 0.6923, 0.0385, 1, 0.61, 0.4286, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": " import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L19_C4", "label": "name =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "vector": [14, 1, 0.7308, 0.0385, 1, 0.61, 0.5714, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L20_C4", "label": "NamedWindow()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "vector": [8, 1, 0.7692, 0.0385, 1, 0.61, 0.7143, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "NamedWindow", "arg_names": [], "import_names": [], "rhs_call_name": "NamedWindow", "annotation": ""}, "snippet": " cv.NamedWindow(name, cv.CV_WINDOW_AUTOSIZE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L21_C4", "label": "c = find_camera()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "vector": [14, 1, 0.8077, 0.0385, 1, 0.61, 0.8571, 411, 3, 1, 0, 0, 514, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "find_camera", "annotation": ""}, "snippet": " c = find_camera(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:While_L22_C4", "label": "while", "type": "while", "loc": [22, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "vector": [5, 1, 0.9038, 0.1538, 1, 0.61, 1.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n f = c.get_frame()\n cv.ShowImage(name, f)\n cv.WaitKey(33)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L23_C8", "label": "f = get_frame()", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:While_L22_C4", "vector": [14, 2, 0.8846, 0.0385, 2, 0.53, 0.0, 899, 3, 0, 0, 0, 489, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "get_frame", "annotation": ""}, "snippet": " f = c.get_frame()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L24_C8", "label": "ShowImage()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:While_L22_C4", "vector": [8, 2, 0.9231, 0.0385, 2, 0.53, 0.5, 896, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ShowImage", "arg_names": [], "import_names": [], "rhs_call_name": "ShowImage", "annotation": ""}, "snippet": " cv.ShowImage(name, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L25_C8", "label": "WaitKey()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99475:While_L22_C4", "vector": [8, 2, 0.9615, 0.0385, 2, 0.53, 1.0, 885, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "WaitKey", "arg_names": [], "import_names": [], "rhs_call_name": "WaitKey", "annotation": ""}, "snippet": " cv.WaitKey(33)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Import_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Import_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Import_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:While_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:While_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:While_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99475:While_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99475:Expr_L25_C8"}] |
import _camera_setup_lib
def _swig_repr(self):
try: strthis = "proxy of " + self.this.__repr__()
except: strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
import types
try:
_object = types.ObjectType
_newclass = 1
except AttributeError:
class _object : pass
_newclass = 0
del types
init_bus1394 = _camera_setup_lib.init_bus1394
getCameraUID = _camera_setup_lib.getCameraUID
endCameraSetup = _camera_setup_lib.endCameraSetup
setFrameRate = _camera_setup_lib.setFrameRate
getRegister = _camera_setup_lib.getRegister
setRegister = _camera_setup_lib.setRegister
#All hex setting to the cameras confined to this code
brightness_register_dict = { 'brightness': 0x800, 'exposure': 0x804,
'shutter_time': 0x81c, 'gain': 0x820,
'white_balance': 0x80c, 'gamma': 0x818}
register_dict = { 'frame_rate': 0x600, 'trigger_mode': 0x830,
'trigger_delay': 0x834, 'pio_direction': 0x11f8,
'strobe_0_cnt': 0x1500 }
fps_dict = { 60:0xa0000000,
30:0x80000000,
# 20:0x70000000, 20 does not seem to be an
# option
15:0x60000000,
7.5:0x40000000,
3.75:0x20000000,
1.875:0x10000000 }
# Dictionary from registers to fps. It's named sps because sps is fps backawards ;)
spf_dict = { '0xa':60,
'0x8':30,
'0x6':15,
'0x4':7.5 }
register_dict.update( brightness_register_dict )
def get_registers( index ):
"""
index would be the .device property of a Camera object
[register function, register value]"""
return [(key,getRegister( index, register_dict[key])) for key in register_dict.keys()]
def get_frame_rate( index ):
"""
Get the frame rate
"""
val = (0xe0000000 & getRegister( index, register_dict['frame_rate'])) >> 7*4
return spf_dict[hex(int(val))]
def set_frame_rate( index, rate ):
frame_rate = fps_dict[rate]
setRegister( index, register_dict['frame_rate'], frame_rate)
def set_stereo_slaving( master, slave ):
'''
master and slave would be the .device property of Camera objects
This function assumes that the right camera is slave off of the left'''
setRegister( master, register_dict['pio_direction'], 0x80000000)
setRegister( slave, register_dict['strobe_0_cnt'], 0x82000000)
setRegister( slave, register_dict['trigger_mode'], 0x83110000 )
setRegister( master, register_dict['trigger_mode'], 0x80100000 )
for key in brightness_register_dict.keys():
rdval = getRegister( master, register_dict[key])
setRegister( slave, register_dict[key] ,rdval)
def get_brightness_settings( index ):
"""
index would be the .device property of a Camera object
[register function, register value]"""
return [(key, 0xfff & getRegister( index, brightness_register_dict[key])) for key in brightness_register_dict.keys()]
def set_auto( index ):
"""Set a particular camera to automatically ajdust brightness and exposure"""
setRegister( index, register_dict['brightness'], 0x83000000)
setRegister( index, register_dict['exposure'], 0x83000000)
setRegister( index, register_dict['shutter_time'], 0x8300000e)
setRegister( index, register_dict['gain'], 0x8300000f)
print 'set auto being called'
def get_gamma(index):
return getRegister(index, brightness_register_dict['gamma'])
def set_gamma(index,gamma):
''' gamma: 0 or 1
'''
setRegister(index, brightness_register_dict['gamma'], 0x82000000+gamma)
def get_whitebalance(index):
return getRegister(index, brightness_register_dict['white_balance'])
def set_whitebalance(index,r_val,b_val):
setRegister(index, brightness_register_dict['white_balance'], 0x82000000+r_val+b_val*4096)
def set_brightness( index, brightness=None, exposure=None, shutter_time=None, gain=None ):
"""If brightness is not specified auto mode is used for all settings. If shutter_time
and gain are specified, exposure does nothing. All values should be set between 0-4095"""
def limit_fff( parameter ):
if parameter > 0xfff:
parameter = 0xfff
elif parameter < 0:
parameter = 0
return parameter
if brightness == None and exposure != None:
setRegister( index, register_dict['brightness'], 0x83000000 )
setRegister( index, register_dict['exposure'], 0x82000000+limit_fff(exposure))
setRegister( index, register_dict['shutter_time'], 0x83000000)
setRegister( index, register_dict['gain'], 0x83000000)
elif brightness == None:
set_auto( index )
else:
if shutter_time != None or gain != None:
setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))
setRegister( index, register_dict['exposure'], 0x80000000)
setRegister( index, register_dict['shutter_time'], 0x82000000+limit_fff(shutter_time))
setRegister( index, register_dict['gain'], 0x82000000+limit_fff(gain))
else:
if exposure == None:
setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))
setRegister( index, register_dict['exposure'], 0x83000000)
setRegister( index, register_dict['shutter_time'], 0x83000000)
setRegister( index, register_dict['gain'], 0x83000000)
else:
setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))
setRegister( index, register_dict['exposure'], 0x82000000+limit_fff(exposure))
setRegister( index, register_dict['shutter_time'], 0x83000000)
setRegister( index, register_dict['gain'], 0x83000000)
| ajibawa-2023/Python-Code-Large/train/row_99476 | 90 | 160 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Import_L1_C0", "label": "_camera_setup_lib import _camera_setup_lib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 0, 0.66, 0.0, 740, 0, 1, 0, 0, 740, 0, 0], "semantic": {"name": "_camera_setup_lib", "arg_names": [], "import_names": ["_camera_setup_lib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import _camera_setup_lib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L3_C0", "label": "_swig_repr", "type": "function", "loc": [3, 6], "level": 0, "parent": null, "vector": [2, 0, 0.0281, 0.025, 0, 0.66, 0.04, 276, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_swig_repr", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _swig_repr(self):\n try: strthis = \"proxy of \" + self.this.__repr__()\n except: strthis = \"\"\n return \"<%s.%s; %s >\" % (self.__class__.__module__, self.__class__.__name__, strthis,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L4_C4", "label": "try", "type": "try", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L3_C0", "vector": [7, 1, 0.0281, 0.0125, 1, 0.99, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try: strthis = \"proxy of \" + self.this.__repr__()\n except: strthis = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L4_C9", "label": "strthis =", "type": "assigned_variable", "loc": [4, 4], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L4_C4", "vector": [14, 2, 0.025, 0.0063, 2, 0.34, 0.0, 182, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "strthis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try: strthis = \"proxy of \" + self.this.__repr__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L5_C12", "label": "strthis =", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L4_C4", "vector": [14, 2, 0.0312, 0.0063, 2, 0.34, 0.0, 182, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "strthis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " except: strthis = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L6_C4", "label": "return", "type": "return", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L3_C0", "vector": [13, 1, 0.0375, 0.0063, 1, 0.99, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"<%s.%s; %s >\" % (self.__class__.__module__, self.__class__.__name__, strthis,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Import_L8_C0", "label": "types import types", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.0063, 0, 0.66, 0.08, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "types", "arg_names": [], "import_names": ["types"], "rhs_call_name": "", "annotation": ""}, "snippet": "import types"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "label": "try", "type": "try", "loc": [9, 14], "level": 0, "parent": null, "vector": [7, 0, 0.0719, 0.0375, 0, 0.66, 0.12, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n _object = types.ObjectType\n _newclass = 1\nexcept AttributeError:\n class _object : pass\n _newclass = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L10_C4", "label": "_object =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "vector": [14, 1, 0.0625, 0.0063, 1, 0.14, 0.0, 30, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _object = types.ObjectType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L11_C4", "label": "_newclass =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "vector": [14, 1, 0.0688, 0.0063, 1, 0.14, 1.0, 280, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_newclass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _newclass = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:ClassDef_L13_C4", "label": "_object", "type": "class", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "vector": [3, 1, 0.0813, 0.0063, 1, 0.14, 0.0, 30, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class _object : pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L14_C4", "label": "_newclass =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "vector": [14, 1, 0.0875, 0.0063, 1, 0.14, 1.0, 280, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_newclass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _newclass = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L18_C0", "label": "init_bus1394 =", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.1125, 0.0063, 0, 0.66, 0.2, 216, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "init_bus1394", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "init_bus1394 = _camera_setup_lib.init_bus1394"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L19_C0", "label": "getCameraUID =", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.1187, 0.0063, 0, 0.66, 0.24, 791, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "getCameraUID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "getCameraUID = _camera_setup_lib.getCameraUID"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L20_C0", "label": "endCameraSetup =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.125, 0.0063, 0, 0.66, 0.28, 77, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "endCameraSetup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "endCameraSetup = _camera_setup_lib.endCameraSetup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L21_C0", "label": "setFrameRate =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.1313, 0.0063, 0, 0.66, 0.32, 866, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "setFrameRate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "setFrameRate = _camera_setup_lib.setFrameRate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L22_C0", "label": "getRegister =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.1375, 0.0063, 0, 0.66, 0.36, 921, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "getRegister", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "getRegister = _camera_setup_lib.getRegister"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L23_C0", "label": "setRegister =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.1437, 0.0063, 0, 0.66, 0.4, 253, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "setRegister = _camera_setup_lib.setRegister"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L26_C0", "label": "brightness_register_dict =", "type": "assigned_variable", "loc": [26, 28], "level": 0, "parent": null, "vector": [14, 0, 0.1688, 0.0187, 0, 0.66, 0.44, 899, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "brightness_register_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "brightness_register_dict = { 'brightness': 0x800, 'exposure': 0x804, \n 'shutter_time': 0x81c, 'gain': 0x820,\n 'white_balance': 0x80c, 'gamma': 0x818}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L30_C0", "label": "register_dict =", "type": "assigned_variable", "loc": [30, 32], "level": 0, "parent": null, "vector": [14, 0, 0.1938, 0.0187, 0, 0.66, 0.48, 872, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "register_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "register_dict = { 'frame_rate': 0x600, 'trigger_mode': 0x830, \n 'trigger_delay': 0x834, 'pio_direction': 0x11f8, \n 'strobe_0_cnt': 0x1500 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L34_C0", "label": "fps_dict =", "type": "assigned_variable", "loc": [34, 41], "level": 0, "parent": null, "vector": [14, 0, 0.2344, 0.05, 0, 0.66, 0.52, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "fps_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "fps_dict = { 60:0xa0000000,\n 30:0x80000000,\n# 20:0x70000000, 20 does not seem to be an\n# option\n 15:0x60000000,\n 7.5:0x40000000,\n 3.75:0x20000000,\n 1.875:0x10000000 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L44_C0", "label": "spf_dict =", "type": "assigned_variable", "loc": [44, 47], "level": 0, "parent": null, "vector": [14, 0, 0.2844, 0.025, 0, 0.66, 0.56, 655, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "spf_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "spf_dict = { '0xa':60,\n '0x8':30,\n '0x6':15,\n '0x4':7.5 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L50_C0", "label": "update()", "type": "expression", "loc": [50, 50], "level": 0, "parent": null, "vector": [8, 0, 0.3125, 0.0063, 0, 0.66, 0.6, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": "register_dict.update( brightness_register_dict )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L52_C0", "label": "get_registers", "type": "function", "loc": [52, 57], "level": 0, "parent": null, "vector": [2, 0, 0.3406, 0.0375, 0, 0.66, 0.64, 254, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_registers", "arg_names": ["index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_registers( index ):\n \"\"\"\n index would be the .device property of a Camera object\n \n [register function, register value]\"\"\"\n return [(key,getRegister( index, register_dict[key])) for key in register_dict.keys()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L53_C4", "label": "expression", "type": "expression", "loc": [53, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L52_C0", "vector": [8, 1, 0.3406, 0.025, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n index would be the .device property of a Camera object\n \n [register function, register value]\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L57_C4", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L52_C0", "vector": [13, 1, 0.3563, 0.0063, 1, 0.58, 1.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(key,getRegister( index, register_dict[key])) for key in register_dict.keys()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L59_C0", "label": "get_frame_rate", "type": "function", "loc": [59, 64], "level": 0, "parent": null, "vector": [2, 0, 0.3844, 0.0375, 0, 0.66, 0.68, 752, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_frame_rate", "arg_names": ["index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_frame_rate( index ):\n \"\"\"\n Get the frame rate\n \"\"\"\n val = (0xe0000000 & getRegister( index, register_dict['frame_rate'])) >> 7*4\n return spf_dict[hex(int(val))] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L60_C4", "label": "expression", "type": "expression", "loc": [60, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L59_C0", "vector": [8, 1, 0.3812, 0.0187, 1, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Get the frame rate\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L63_C4", "label": "val =", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L59_C0", "vector": [14, 1, 0.3937, 0.0063, 1, 0.5, 0.5, 618, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " val = (0xe0000000 & getRegister( index, register_dict['frame_rate'])) >> 7*4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L64_C4", "label": "return", "type": "return", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L59_C0", "vector": [13, 1, 0.4, 0.0063, 1, 0.5, 1.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return spf_dict[hex(int(val))] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L67_C0", "label": "set_frame_rate", "type": "function", "loc": [67, 69], "level": 0, "parent": null, "vector": [2, 0, 0.425, 0.0187, 0, 0.66, 0.72, 975, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_frame_rate", "arg_names": ["index", "rate"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def set_frame_rate( index, rate ):\n frame_rate = fps_dict[rate]\n setRegister( index, register_dict['frame_rate'], frame_rate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L68_C4", "label": "frame_rate =", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L67_C0", "vector": [14, 1, 0.425, 0.0063, 1, 0.19, 0.0, 527, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "frame_rate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frame_rate = fps_dict[rate]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L69_C4", "label": "setRegister()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L67_C0", "vector": [8, 1, 0.4313, 0.0063, 1, 0.19, 1.0, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['frame_rate'], frame_rate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "label": "set_stereo_slaving", "type": "function", "loc": [72, 85], "level": 0, "parent": null, "vector": [2, 0, 0.4906, 0.0875, 0, 0.66, 0.76, 94, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "set_stereo_slaving", "arg_names": ["master", "slave"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def set_stereo_slaving( master, slave ):\n '''\n master and slave would be the .device property of Camera objects\n \n This function assumes that the right camera is slave off of the left'''\n setRegister( master, register_dict['pio_direction'], 0x80000000)\n setRegister( slave, register_dict['strobe_0_cnt'], 0x82000000)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L73_C4", "label": "expression", "type": "expression", "loc": [73, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "vector": [8, 1, 0.4656, 0.025, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n master and slave would be the .device property of Camera objects\n \n This function assumes that the right camera is slave off of the left'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L77_C4", "label": "setRegister()", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "vector": [8, 1, 0.4813, 0.0063, 1, 0.45, 0.2, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( master, register_dict['pio_direction'], 0x80000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L78_C4", "label": "setRegister()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "vector": [8, 1, 0.4875, 0.0063, 1, 0.45, 0.4, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( slave, register_dict['strobe_0_cnt'], 0x82000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L80_C4", "label": "setRegister()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "vector": [8, 1, 0.5, 0.0063, 1, 0.45, 0.6, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( slave, register_dict['trigger_mode'], 0x83110000 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L81_C4", "label": "setRegister()", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "vector": [8, 1, 0.5062, 0.0063, 1, 0.45, 0.8, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( master, register_dict['trigger_mode'], 0x80100000 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:For_L83_C4", "label": "for key", "type": "for", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "vector": [6, 1, 0.525, 0.0187, 1, 0.45, 1.0, 230, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in brightness_register_dict.keys():\n rdval = getRegister( master, register_dict[key])\n setRegister( slave, register_dict[key] ,rdval)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L84_C8", "label": "rdval = getRegister()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:For_L83_C4", "vector": [14, 2, 0.525, 0.0063, 2, 0.51, 0.0, 320, 3, 2, 0, 0, 921, 10, 1], "semantic": {"name": "rdval", "arg_names": [], "import_names": [], "rhs_call_name": "getRegister", "annotation": ""}, "snippet": " rdval = getRegister( master, register_dict[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L85_C8", "label": "setRegister()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:For_L83_C4", "vector": [8, 2, 0.5312, 0.0063, 2, 0.51, 1.0, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( slave, register_dict[key] ,rdval)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L88_C0", "label": "get_brightness_settings", "type": "function", "loc": [88, 93], "level": 0, "parent": null, "vector": [2, 0, 0.5656, 0.0375, 0, 0.66, 0.8, 996, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_brightness_settings", "arg_names": ["index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_brightness_settings( index ):\n \"\"\"\n index would be the .device property of a Camera object\n \n [register function, register value]\"\"\"\n return [(key, 0xfff & getRegister( index, brightness_register_dict[key])) for key in brightness_register_dict.keys()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L89_C4", "label": "expression", "type": "expression", "loc": [89, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L88_C0", "vector": [8, 1, 0.5656, 0.025, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n index would be the .device property of a Camera object\n \n [register function, register value]\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L88_C0", "vector": [13, 1, 0.5813, 0.0063, 1, 0.13, 1.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(key, 0xfff & getRegister( index, brightness_register_dict[key])) for key in brightness_register_dict.keys()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "label": "set_auto", "type": "function", "loc": [96, 102], "level": 0, "parent": null, "vector": [2, 0, 0.6188, 0.0437, 0, 0.66, 0.84, 673, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "set_auto", "arg_names": ["index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def set_auto( index ):\n \"\"\"Set a particular camera to automatically ajdust brightness and exposure\"\"\"\n setRegister( index, register_dict['brightness'], 0x83000000)\n setRegister( index, register_dict['exposure'], 0x83000000)\n setRegister( index, register_dict['shutter_time'], 0x8300000e)\n setRegister( index, register_dict['gain'], 0x8300000f)\n print('set auto being called')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L97_C4", "label": "expression", "type": "expression", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "vector": [8, 1, 0.6062, 0.0063, 1, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Set a particular camera to automatically ajdust brightness and exposure\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L98_C4", "label": "setRegister()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "vector": [8, 1, 0.6125, 0.0063, 1, 0.6, 0.2, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['brightness'], 0x83000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L99_C4", "label": "setRegister()", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "vector": [8, 1, 0.6188, 0.0063, 1, 0.6, 0.4, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['exposure'], 0x83000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L100_C4", "label": "setRegister()", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "vector": [8, 1, 0.625, 0.0063, 1, 0.6, 0.6, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['shutter_time'], 0x8300000e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L101_C4", "label": "setRegister()", "type": "expression", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "vector": [8, 1, 0.6312, 0.0063, 1, 0.6, 0.8, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['gain'], 0x8300000f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L102_C4", "label": "print()", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "vector": [8, 1, 0.6375, 0.0063, 1, 0.6, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('set auto being called')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L105_C0", "label": "get_gamma", "type": "function", "loc": [105, 106], "level": 0, "parent": null, "vector": [2, 0, 0.6594, 0.0125, 0, 0.66, 0.88, 126, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_gamma", "arg_names": ["index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_gamma(index):\n return getRegister(index, brightness_register_dict['gamma'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L106_C4", "label": "return", "type": "return", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L105_C0", "vector": [13, 1, 0.6625, 0.0063, 1, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return getRegister(index, brightness_register_dict['gamma'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L108_C0", "label": "set_gamma", "type": "function", "loc": [108, 111], "level": 0, "parent": null, "vector": [2, 0, 0.6844, 0.025, 0, 0.66, 0.92, 342, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_gamma", "arg_names": ["index", "gamma"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def set_gamma(index,gamma):\n ''' gamma: 0 or 1\n '''\n setRegister(index, brightness_register_dict['gamma'], 0x82000000+gamma)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L109_C4", "label": "expression", "type": "expression", "loc": [109, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L108_C0", "vector": [8, 1, 0.6844, 0.0125, 1, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ''' gamma: 0 or 1\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L111_C4", "label": "setRegister()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L108_C0", "vector": [8, 1, 0.6937, 0.0063, 1, 0.6, 1.0, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister(index, brightness_register_dict['gamma'], 0x82000000+gamma)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L113_C0", "label": "get_whitebalance", "type": "function", "loc": [113, 114], "level": 0, "parent": null, "vector": [2, 0, 0.7094, 0.0125, 0, 0.66, 0.96, 476, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_whitebalance", "arg_names": ["index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_whitebalance(index):\n return getRegister(index, brightness_register_dict['white_balance'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L114_C4", "label": "return", "type": "return", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L113_C0", "vector": [13, 1, 0.7125, 0.0063, 1, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return getRegister(index, brightness_register_dict['white_balance'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L116_C0", "label": "set_whitebalance", "type": "function", "loc": [116, 117], "level": 0, "parent": null, "vector": [2, 0, 0.7281, 0.0125, 0, 0.66, 1.0, 157, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_whitebalance", "arg_names": ["index", "r_val", "b_val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def set_whitebalance(index,r_val,b_val):\n setRegister(index, brightness_register_dict['white_balance'], 0x82000000+r_val+b_val*4096)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L117_C4", "label": "setRegister()", "type": "expression", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L116_C0", "vector": [8, 1, 0.7312, 0.0063, 1, 0.37, 0.0, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister(index, brightness_register_dict['white_balance'], 0x82000000+r_val+b_val*4096)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L119_C0", "label": "set_brightness", "type": "function", "loc": [119, 156], "level": 0, "parent": null, "vector": [2, 0, 0.8594, 0.2375, 0, 0.66, 1.04, 252, 0, 5, 1, 0, 0, 0, 24], "semantic": {"name": "set_brightness", "arg_names": ["index", "brightness", "exposure", "shutter_time", "gain"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def set_brightness( index, brightness=None, exposure=None, shutter_time=None, gain=None ):\n \"\"\"If brightness is not specified auto mode is used for all settings. If shutter_time\n and gain are specified, exposure does nothing. All values should be set between 0-4095\"\"\"\n\n def limit_fff( parameter ):\n if parameter > 0xfff:\n parameter = 0xfff\n elif parameter < 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L120_C4", "label": "expression", "type": "expression", "loc": [120, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L119_C0", "vector": [8, 1, 0.7531, 0.0125, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"If brightness is not specified auto mode is used for all settings. If shutter_time\n and gain are specified, exposure does nothing. All values should be set between 0-4095\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L123_C4", "label": "limit_fff", "type": "function", "loc": [123, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L119_C0", "vector": [2, 1, 0.7875, 0.0437, 1, 0.2, 0.5, 475, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "limit_fff", "arg_names": ["parameter"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def limit_fff( parameter ):\n if parameter > 0xfff:\n parameter = 0xfff\n elif parameter < 0:\n parameter = 0\n\n return parameter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L124_C8", "label": "if", "type": "if", "loc": [124, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L123_C4", "vector": [4, 2, 0.7844, 0.025, 2, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parameter > 0xfff:\n parameter = 0xfff\n elif parameter < 0:\n parameter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L125_C12", "label": "parameter =", "type": "assigned_variable", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L124_C8", "vector": [14, 3, 0.7812, 0.0063, 3, 0.84, 0.0, 816, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "parameter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameter = 0xfff"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L126_C8", "label": "if", "type": "if", "loc": [126, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L124_C8", "vector": [4, 3, 0.7906, 0.0125, 3, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif parameter < 0:\n parameter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L127_C12", "label": "parameter =", "type": "assigned_variable", "loc": [127, 127], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L126_C8", "vector": [14, 4, 0.7937, 0.0063, 4, 0.88, 0.0, 816, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "parameter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L129_C8", "label": "return", "type": "return", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L123_C4", "vector": [13, 2, 0.8063, 0.0063, 2, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parameter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "label": "if", "type": "if", "loc": [131, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L119_C0", "vector": [4, 1, 0.8969, 0.1625, 1, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if brightness == None and exposure != None:\n setRegister( index, register_dict['brightness'], 0x83000000 )\n setRegister( index, register_dict['exposure'], 0x82000000+limit_fff(exposure))\n setRegister( index, register_dict['shutter_time'], 0x83000000)\n setRegister( index, register_dict['gain'], 0x83000000)\n \n elif brightness == None:\n set_auto( index )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L132_C8", "label": "setRegister()", "type": "expression", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "vector": [8, 2, 0.825, 0.0063, 2, 0.92, 0.0, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['brightness'], 0x83000000 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L133_C8", "label": "setRegister()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "vector": [8, 2, 0.8313, 0.0063, 2, 0.92, 0.25, 253, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['exposure'], 0x82000000+limit_fff(exposure))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L134_C8", "label": "setRegister()", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "vector": [8, 2, 0.8375, 0.0063, 2, 0.92, 0.5, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['shutter_time'], 0x83000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L135_C8", "label": "setRegister()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "vector": [8, 2, 0.8438, 0.0063, 2, 0.92, 0.75, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['gain'], 0x83000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L137_C4", "label": "if", "type": "if", "loc": [137, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "vector": [4, 2, 0.9156, 0.125, 2, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 19], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif brightness == None:\n set_auto( index )\n \n else:\n if shutter_time != None or gain != None:\n setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))\n setRegister( index, register_dict['exposure'], 0x80000000)\n setRegister( index, register_dict['shutter_time'], 0x82000000+limit_fff(shutter_time))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L138_C8", "label": "set_auto()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L137_C4", "vector": [8, 3, 0.8625, 0.0063, 3, 0.76, 0.0, 673, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_auto", "arg_names": [], "import_names": [], "rhs_call_name": "set_auto", "annotation": ""}, "snippet": " set_auto( index )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "label": "if", "type": "if", "loc": [141, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L137_C4", "vector": [4, 3, 0.9281, 0.1, 3, 0.76, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if shutter_time != None or gain != None:\n setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))\n setRegister( index, register_dict['exposure'], 0x80000000)\n setRegister( index, register_dict['shutter_time'], 0x82000000+limit_fff(shutter_time))\n setRegister( index, register_dict['gain'], 0x82000000+limit_fff(gain))\n else:\n if exposure == None:\n setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L142_C16", "label": "setRegister()", "type": "expression", "loc": [142, 142], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "vector": [8, 4, 0.8875, 0.0063, 4, 0.51, 0.0, 253, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L143_C16", "label": "setRegister()", "type": "expression", "loc": [143, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "vector": [8, 4, 0.8938, 0.0063, 4, 0.51, 0.25, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['exposure'], 0x80000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L144_C16", "label": "setRegister()", "type": "expression", "loc": [144, 144], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "vector": [8, 4, 0.9, 0.0063, 4, 0.51, 0.5, 253, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['shutter_time'], 0x82000000+limit_fff(shutter_time))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L145_C16", "label": "setRegister()", "type": "expression", "loc": [145, 145], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "vector": [8, 4, 0.9062, 0.0063, 4, 0.51, 0.75, 253, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['gain'], 0x82000000+limit_fff(gain))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "label": "if", "type": "if", "loc": [147, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "vector": [4, 4, 0.9469, 0.0625, 4, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if exposure == None:\n setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))\n setRegister( index, register_dict['exposure'], 0x83000000)\n setRegister( index, register_dict['shutter_time'], 0x83000000)\n setRegister( index, register_dict['gain'], 0x83000000)\n else:\n setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))\n setRegister( index, register_dict['exposure'], 0x82000000+limit_fff(exposure))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L148_C20", "label": "setRegister()", "type": "expression", "loc": [148, 148], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "vector": [8, 5, 0.925, 0.0063, 5, 0.54, 0.0, 253, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L149_C20", "label": "setRegister()", "type": "expression", "loc": [149, 149], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "vector": [8, 5, 0.9313, 0.0063, 5, 0.54, 0.1429, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['exposure'], 0x83000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L150_C20", "label": "setRegister()", "type": "expression", "loc": [150, 150], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "vector": [8, 5, 0.9375, 0.0063, 5, 0.54, 0.2857, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['shutter_time'], 0x83000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L151_C20", "label": "setRegister()", "type": "expression", "loc": [151, 151], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "vector": [8, 5, 0.9437, 0.0063, 5, 0.54, 0.4286, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['gain'], 0x83000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L153_C20", "label": "setRegister()", "type": "expression", "loc": [153, 153], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "vector": [8, 5, 0.9563, 0.0063, 5, 0.54, 0.5714, 253, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['brightness'], 0x82000000+limit_fff(brightness))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L154_C20", "label": "setRegister()", "type": "expression", "loc": [154, 154], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "vector": [8, 5, 0.9625, 0.0063, 5, 0.54, 0.7143, 253, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['exposure'], 0x82000000+limit_fff(exposure))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L155_C20", "label": "setRegister()", "type": "expression", "loc": [155, 155], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "vector": [8, 5, 0.9688, 0.0063, 5, 0.54, 0.8571, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['shutter_time'], 0x83000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L156_C20", "label": "setRegister()", "type": "expression", "loc": [156, 156], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "vector": [8, 5, 0.975, 0.0063, 5, 0.54, 1.0, 253, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setRegister", "arg_names": [], "import_names": [], "rhs_call_name": "setRegister", "annotation": ""}, "snippet": " setRegister( index, register_dict['gain'], 0x83000000)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L4_C9"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L5_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:ClassDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:For_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:For_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:For_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L126_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Assign_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Return_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L142_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L143_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L144_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L145_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L141_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L148_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L149_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L150_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L151_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L153_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L154_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L155_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99476:If_L147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99476:Expr_L156_C20"}] |
import roslib # Needed to load opencv
roslib.load_manifest('hrl_camera') #
import cv
import hrl_opencv.adaptors as ad
import camera_setup_lib as csl
import numpy as np
class NoFrameException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class camera:
##
# @param camera_configuration a dictionary of parameters needed for this camera
def __init__(self, camera_configuration, opencv_id):
self.config = camera_configuration
self.device = opencv_id
#self._set_registers()
#create capture and related attributes
self.capture = cv.CaptureFromCAM(self.device)
if not self.capture:
raise RuntimeError("Cannot open camera!\n")
self._make_undistort_matrices()
def _make_undistort_matrices(self):
p = self.config
some_arr = np.array([[p['focal_length_x_in_pixels'], 0, p['optical_center_x_in_pixels']],
[0, p['focal_length_y_in_pixels'], p['optical_center_y_in_pixels']],
[0, 0, 1.0]])
self.intrinsic_cvmat = ad.array2cvmat(some_arr)
self.distortion_cvmat = ad.array2cvmat(np.array([[p['lens_distortion_radial_1'],
p['lens_distortion_radial_2'],
p['lens_distortion_tangential_1'],
p['lens_distortion_tangential_2']]]))
self.size = (int(p['calibration_image_width']), int(p['calibration_image_height']))
#Sanity check
size_image = cv.QueryFrame(self.capture)
camera_image_size = cv.GetSize(size_image)
if not ((camera_image_size[0] == self.size[0]) and (camera_image_size[1] == self.size[1])):
raise RuntimeError('Size of image returned by camera and size declared in config. file do not match.'
+ ' Config:' + str(self.size) + ' Camera: ' + str(camera_image_size))
#Set up buffers for undistortion
self.raw_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 1)
self.gray_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 1)
self.undistort_mapx = cv.CreateImage(self.size, cv.IPL_DEPTH_32F, 1)
self.undistort_mapy = cv.CreateImage(self.size, cv.IPL_DEPTH_32F, 1)
self.unbayer_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 3)
self.color = p['color']
if self.color == True:
self.cvbayer_pattern = p['opencv_bayer_pattern']
if self.color == True:
self.undistort_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 3)
else:
self.undistort_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 1)
cv.InitUndistortMap(self.intrinsic_cvmat, self.distortion_cvmat,
self.undistort_mapx, self.undistort_mapy)
self.corrected_orientation = None
def get_frame(self):
self.raw_image = self.get_raw_frame()
im = self.undistort_frame()
if self.config.has_key('upside_down'):
if self.config['upside_down']:
if self.corrected_orientation == None:
self.corrected_orientation = cv.CloneImage(im)
cv.Flip(im, self.corrected_orientation, -1)
im = self.corrected_orientation
return im
## returns color image. does NOT undistort the image.
def get_frame_debayered(self):
self.raw_image = self.get_raw_frame()
return self.convert_color()
def get_raw_frame(self):
# Assumes that we are going to debayer the image later, so
# returns a single channel image.
im = cv.QueryFrame(self.capture)
if im == None:
raise NoFrameException('')
cv.Split(im, self.gray_image, None, None, None)
return self.gray_image
def undistort_frame(self):
img = self.convert_color()
cv.Remap(img, self.undistort_image, self.undistort_mapx, self.undistort_mapy,
cv.CV_INTER_LINEAR, cv.ScalarAll(0))
return self.undistort_image
def convert_color(self):
if self.color == True:
cv.CvtColor(self.raw_image, self.unbayer_image, self.cvbayer_pattern)
return self.unbayer_image
else:
return self.raw_image
##
# Set frame rate: 7.5, 15, 30, or 60Hz
# by default we set this to a low value
# to not have to deal with firewire bandwidth
# issues
def set_frame_rate(self, rate=7.5):
cv.SetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS, rate)
#csl.set_frame_rate(self.device, rate)
def get_frame_rate(self):
fps = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS)
return fps
def set_brightness(self, brightness=150, shutter_time=97,
gain=450, exposure=None):
csl.set_brightness(self.device, brightness, exposure, shutter_time, gain)
## auto - probably only used for displaying images.
def set_auto(self):
csl.set_auto(self.device)
#if __name__ == '__main__':
# cva = ad.array2cv(np.ones((2,3)))
| ajibawa-2023/Python-Code-Large/train/row_99477 | 76 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Import_L1_C0", "label": "roslib import roslib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0075, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib # Needed to load opencv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L2_C0", "label": "load_manifest()", "type": "expression", "loc": [2, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0149, 0.0075, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_camera') #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Import_L4_C0", "label": "cv import cv", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0299, 0.0075, 0, 0.66, 0.2857, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Import_L5_C0", "label": "hrl_opencv.adaptors import ad", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0373, 0.0075, 0, 0.66, 0.4286, 410, 0, 1, 0, 0, 410, 0, 0], "semantic": {"name": "hrl_opencv.adaptors", "arg_names": [], "import_names": ["ad"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_opencv.adaptors as ad"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Import_L6_C0", "label": "camera_setup_lib import csl", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0448, 0.0075, 0, 0.66, 0.5714, 303, 0, 1, 0, 0, 303, 0, 0], "semantic": {"name": "camera_setup_lib", "arg_names": [], "import_names": ["csl"], "rhs_call_name": "", "annotation": ""}, "snippet": "import camera_setup_lib as csl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Import_L7_C0", "label": "numpy import np", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0522, 0.0075, 0, 0.66, 0.7143, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L9_C0", "label": "NoFrameException", "type": "class", "loc": [9, 15], "level": 0, "parent": null, "vector": [3, 0, 0.0896, 0.0522, 0, 0.66, 0.8571, 686, 0, 2, 0, 0, 645, 0, 1], "semantic": {"name": "NoFrameException", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NoFrameException(Exception):\n \n def __init__(self, value):\n self.value = value\n\n def __str__(self):\n return repr(self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L11_C4", "label": "__init__", "type": "function", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L9_C0", "vector": [2, 1, 0.0858, 0.0149, 1, 0.1, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, value):\n self.value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L12_C8", "label": "self.value =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L11_C4", "vector": [14, 2, 0.0896, 0.0075, 2, 0.78, 0.0, 966, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L14_C4", "label": "__str__", "type": "function", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L9_C0", "vector": [2, 1, 0.1082, 0.0149, 1, 0.1, 1.0, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return repr(self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L15_C8", "label": "return", "type": "return", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L14_C4", "vector": [13, 2, 0.1119, 0.0075, 2, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return repr(self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "label": "camera", "type": "class", "loc": [17, 131], "level": 0, "parent": null, "vector": [3, 0, 0.5522, 0.8582, 0, 0.66, 1.0, 848, 0, 11, 0, 0, 0, 0, 40], "semantic": {"name": "camera", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class camera:\n ##\n # @param camera_configuration a dictionary of parameters needed for this camera\n def __init__(self, camera_configuration, opencv_id):\n self.config = camera_configuration\n self.device = opencv_id\n #self._set_registers()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "label": "__init__", "type": "function", "loc": [20, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.1828, 0.0746, 1, 0.88, 0.0, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "camera_configuration", "opencv_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, camera_configuration, opencv_id):\n self.config = camera_configuration\n self.device = opencv_id\n #self._set_registers()\n\n #create capture and related attributes\n self.capture = cv.CaptureFromCAM(self.device)\n if not self.capture:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L21_C8", "label": "self.config =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "vector": [14, 2, 0.1567, 0.0075, 2, 0.87, 0.0, 663, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.config = camera_configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L22_C8", "label": "self.device =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "vector": [14, 2, 0.1642, 0.0075, 2, 0.87, 0.25, 993, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.device", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.device = opencv_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L26_C8", "label": "self.capture = CaptureFromCAM()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "vector": [14, 2, 0.194, 0.0075, 2, 0.87, 0.5, 357, 3, 1, 0, 0, 637, 10, 1], "semantic": {"name": "self.capture", "arg_names": [], "import_names": [], "rhs_call_name": "CaptureFromCAM", "annotation": ""}, "snippet": " self.capture = cv.CaptureFromCAM(self.device)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L27_C8", "label": "if", "type": "if", "loc": [27, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "vector": [4, 2, 0.2052, 0.0149, 2, 0.87, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.capture:\n raise RuntimeError(\"Cannot open camera!\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L29_C8", "label": "_make_undistort_matrices()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "vector": [8, 2, 0.2164, 0.0075, 2, 0.87, 1.0, 272, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_make_undistort_matrices", "arg_names": [], "import_names": [], "rhs_call_name": "_make_undistort_matrices", "annotation": ""}, "snippet": " self._make_undistort_matrices()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "label": "_make_undistort_matrices", "type": "function", "loc": [32, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.3769, 0.2836, 1, 0.88, 0.1, 272, 0, 1, 0, 0, 0, 0, 19], "semantic": {"name": "_make_undistort_matrices", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _make_undistort_matrices(self):\n p = self.config\n some_arr = np.array([[p['focal_length_x_in_pixels'], 0, p['optical_center_x_in_pixels']],\n [0, p['focal_length_y_in_pixels'], p['optical_center_y_in_pixels']],\n [0, 0, 1.0]])\n self.intrinsic_cvmat = ad.array2cvmat(some_arr)\n self.distortion_cvmat = ad.array2cvmat(np.array([[p['lens_distortion_radial_1'],\n p['lens_distortion_radial_2'],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L33_C8", "label": "p =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.2463, 0.0075, 2, 0.35, 0.0, 491, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p = self.config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L34_C8", "label": "some_arr = array()", "type": "assigned_variable", "loc": [34, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.2612, 0.0224, 2, 0.35, 0.0588, 960, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "some_arr", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " some_arr = np.array([[p['focal_length_x_in_pixels'], 0, p['optical_center_x_in_pixels']],\n [0, p['focal_length_y_in_pixels'], p['optical_center_y_in_pixels']],\n [0, 0, 1.0]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L37_C8", "label": "self.intrinsic_cvmat = array2cvmat()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.2761, 0.0075, 2, 0.35, 0.1176, 11, 3, 1, 0, 0, 393, 10, 1], "semantic": {"name": "self.intrinsic_cvmat", "arg_names": [], "import_names": [], "rhs_call_name": "array2cvmat", "annotation": ""}, "snippet": " self.intrinsic_cvmat = ad.array2cvmat(some_arr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L38_C8", "label": "self.distortion_cvmat = array2cvmat()", "type": "assigned_variable", "loc": [38, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.2948, 0.0299, 2, 0.35, 0.1765, 888, 3, 1, 0, 0, 393, 10, 2], "semantic": {"name": "self.distortion_cvmat", "arg_names": [], "import_names": [], "rhs_call_name": "array2cvmat", "annotation": ""}, "snippet": " self.distortion_cvmat = ad.array2cvmat(np.array([[p['lens_distortion_radial_1'],\n p['lens_distortion_radial_2'],\n p['lens_distortion_tangential_1'],\n p['lens_distortion_tangential_2']]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L42_C8", "label": "self.size =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.3134, 0.0075, 2, 0.35, 0.2353, 183, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "self.size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.size = (int(p['calibration_image_width']), int(p['calibration_image_height']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L45_C8", "label": "size_image = QueryFrame()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.3358, 0.0075, 2, 0.35, 0.2941, 730, 3, 1, 0, 0, 442, 10, 1], "semantic": {"name": "size_image", "arg_names": [], "import_names": [], "rhs_call_name": "QueryFrame", "annotation": ""}, "snippet": " size_image = cv.QueryFrame(self.capture)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L46_C8", "label": "camera_image_size = GetSize()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.3433, 0.0075, 2, 0.35, 0.3529, 834, 3, 1, 0, 0, 139, 10, 1], "semantic": {"name": "camera_image_size", "arg_names": [], "import_names": [], "rhs_call_name": "GetSize", "annotation": ""}, "snippet": " camera_image_size = cv.GetSize(size_image)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L47_C8", "label": "if", "type": "if", "loc": [47, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [4, 2, 0.3582, 0.0224, 2, 0.35, 0.4118, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ((camera_image_size[0] == self.size[0]) and (camera_image_size[1] == self.size[1])):\n raise RuntimeError('Size of image returned by camera and size declared in config. file do not match.' \n + ' Config:' + str(self.size) + ' Camera: ' + str(camera_image_size))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L53_C8", "label": "self.raw_image = CreateImage()", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.3955, 0.0075, 2, 0.35, 0.4706, 827, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "self.raw_image", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " self.raw_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L54_C8", "label": "self.gray_image = CreateImage()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.403, 0.0075, 2, 0.35, 0.5294, 373, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "self.gray_image", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " self.gray_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L55_C8", "label": "self.undistort_mapx = CreateImage()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.4104, 0.0075, 2, 0.35, 0.5882, 293, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "self.undistort_mapx", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " self.undistort_mapx = cv.CreateImage(self.size, cv.IPL_DEPTH_32F, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L56_C8", "label": "self.undistort_mapy = CreateImage()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.4179, 0.0075, 2, 0.35, 0.6471, 262, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "self.undistort_mapy", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " self.undistort_mapy = cv.CreateImage(self.size, cv.IPL_DEPTH_32F, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L57_C8", "label": "self.unbayer_image = CreateImage()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.4254, 0.0075, 2, 0.35, 0.7059, 479, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "self.unbayer_image", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " self.unbayer_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L59_C8", "label": "self.color =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.4403, 0.0075, 2, 0.35, 0.7647, 422, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.color = p['color']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L60_C8", "label": "if", "type": "if", "loc": [60, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [4, 2, 0.4515, 0.0149, 2, 0.35, 0.8235, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.color == True:\n self.cvbayer_pattern = p['opencv_bayer_pattern'] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L61_C12", "label": "self.cvbayer_pattern =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L60_C8", "vector": [14, 3, 0.4552, 0.0075, 3, 0.06, 0.0, 607, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cvbayer_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cvbayer_pattern = p['opencv_bayer_pattern'] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L62_C8", "label": "if", "type": "if", "loc": [62, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [4, 2, 0.4739, 0.0299, 2, 0.35, 0.8824, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.color == True:\n self.undistort_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 3)\n else:\n self.undistort_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L63_C12", "label": "self.undistort_image = CreateImage()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L62_C8", "vector": [14, 3, 0.4701, 0.0075, 3, 0.17, 0.0, 54, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "self.undistort_image", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " self.undistort_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L65_C12", "label": "self.undistort_image = CreateImage()", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L62_C8", "vector": [14, 3, 0.4851, 0.0075, 3, 0.17, 1.0, 54, 3, 3, 0, 0, 288, 10, 1], "semantic": {"name": "self.undistort_image", "arg_names": [], "import_names": [], "rhs_call_name": "CreateImage", "annotation": ""}, "snippet": " self.undistort_image = cv.CreateImage(self.size, cv.IPL_DEPTH_8U, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L67_C8", "label": "InitUndistortMap()", "type": "expression", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [8, 2, 0.5037, 0.0149, 2, 0.35, 0.9412, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "InitUndistortMap", "arg_names": [], "import_names": [], "rhs_call_name": "InitUndistortMap", "annotation": ""}, "snippet": " cv.InitUndistortMap(self.intrinsic_cvmat, self.distortion_cvmat, \n self.undistort_mapx, self.undistort_mapy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L69_C8", "label": "self.corrected_orientation =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "vector": [14, 2, 0.5149, 0.0075, 2, 0.35, 1.0, 771, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.corrected_orientation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.corrected_orientation = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "label": "get_frame", "type": "function", "loc": [72, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.5709, 0.0746, 1, 0.88, 0.2, 489, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get_frame", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_frame(self):\n self.raw_image = self.get_raw_frame()\n im = self.undistort_frame()\n if self.config.has_key('upside_down'):\n if self.config['upside_down']:\n if self.corrected_orientation == None:\n self.corrected_orientation = cv.CloneImage(im)\n cv.Flip(im, self.corrected_orientation, -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L73_C8", "label": "self.raw_image = get_raw_frame()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "vector": [14, 2, 0.5448, 0.0075, 2, 0.47, 0.0, 827, 3, 0, 0, 0, 554, 10, 1], "semantic": {"name": "self.raw_image", "arg_names": [], "import_names": [], "rhs_call_name": "get_raw_frame", "annotation": ""}, "snippet": " self.raw_image = self.get_raw_frame()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L74_C8", "label": "im = undistort_frame()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "vector": [14, 2, 0.5522, 0.0075, 2, 0.47, 0.3333, 940, 3, 0, 0, 0, 4, 10, 1], "semantic": {"name": "im", "arg_names": [], "import_names": [], "rhs_call_name": "undistort_frame", "annotation": ""}, "snippet": " im = self.undistort_frame()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L75_C8", "label": "if", "type": "if", "loc": [75, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "vector": [4, 2, 0.5784, 0.0448, 2, 0.47, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.config.has_key('upside_down'):\n if self.config['upside_down']:\n if self.corrected_orientation == None:\n self.corrected_orientation = cv.CloneImage(im)\n cv.Flip(im, self.corrected_orientation, -1)\n im = self.corrected_orientation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L76_C12", "label": "if", "type": "if", "loc": [76, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L75_C8", "vector": [4, 3, 0.5821, 0.0373, 3, 0.05, 0.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.config['upside_down']:\n if self.corrected_orientation == None:\n self.corrected_orientation = cv.CloneImage(im)\n cv.Flip(im, self.corrected_orientation, -1)\n im = self.corrected_orientation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L77_C16", "label": "if", "type": "if", "loc": [77, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L76_C12", "vector": [4, 4, 0.5784, 0.0149, 4, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.corrected_orientation == None:\n self.corrected_orientation = cv.CloneImage(im)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L78_C20", "label": "self.corrected_orientation = CloneImage()", "type": "assigned_variable", "loc": [78, 78], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L77_C16", "vector": [14, 5, 0.5821, 0.0075, 5, 0.2, 0.0, 771, 3, 1, 0, 0, 436, 10, 1], "semantic": {"name": "self.corrected_orientation", "arg_names": [], "import_names": [], "rhs_call_name": "CloneImage", "annotation": ""}, "snippet": " self.corrected_orientation = cv.CloneImage(im)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L79_C16", "label": "Flip()", "type": "expression", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L76_C12", "vector": [8, 4, 0.5896, 0.0075, 4, 0.19, 0.5, 745, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Flip", "arg_names": [], "import_names": [], "rhs_call_name": "Flip", "annotation": ""}, "snippet": " cv.Flip(im, self.corrected_orientation, -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L80_C16", "label": "im =", "type": "assigned_variable", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L76_C12", "vector": [14, 4, 0.597, 0.0075, 4, 0.19, 1.0, 940, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "im", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " im = self.corrected_orientation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L81_C8", "label": "return", "type": "return", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "vector": [13, 2, 0.6045, 0.0075, 2, 0.47, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return im"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L85_C4", "label": "get_frame_debayered", "type": "function", "loc": [85, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.6418, 0.0224, 1, 0.88, 0.3, 255, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_frame_debayered", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_frame_debayered(self):\n self.raw_image = self.get_raw_frame()\n return self.convert_color()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L86_C8", "label": "self.raw_image = get_raw_frame()", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L85_C4", "vector": [14, 2, 0.6418, 0.0075, 2, 0.22, 0.0, 827, 3, 0, 0, 0, 554, 10, 1], "semantic": {"name": "self.raw_image", "arg_names": [], "import_names": [], "rhs_call_name": "get_raw_frame", "annotation": ""}, "snippet": " self.raw_image = self.get_raw_frame()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L87_C8", "label": "return", "type": "return", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L85_C4", "vector": [13, 2, 0.6493, 0.0075, 2, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.convert_color()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "label": "get_raw_frame", "type": "function", "loc": [89, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.694, 0.0672, 1, 0.88, 0.4, 554, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_raw_frame", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_raw_frame(self):\n # Assumes that we are going to debayer the image later, so\n # returns a single channel image.\n im = cv.QueryFrame(self.capture)\n\n if im == None:\n raise NoFrameException('')\n cv.Split(im, self.gray_image, None, None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L92_C8", "label": "im = QueryFrame()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "vector": [14, 2, 0.6866, 0.0075, 2, 0.99, 0.0, 940, 3, 1, 0, 0, 442, 10, 1], "semantic": {"name": "im", "arg_names": [], "import_names": [], "rhs_call_name": "QueryFrame", "annotation": ""}, "snippet": " im = cv.QueryFrame(self.capture)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L94_C8", "label": "if", "type": "if", "loc": [94, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "vector": [4, 2, 0.7052, 0.0149, 2, 0.99, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if im == None:\n raise NoFrameException('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L96_C8", "label": "Split()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "vector": [8, 2, 0.7164, 0.0075, 2, 0.99, 0.6667, 551, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "Split", "arg_names": [], "import_names": [], "rhs_call_name": "Split", "annotation": ""}, "snippet": " cv.Split(im, self.gray_image, None, None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L97_C8", "label": "return", "type": "return", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "vector": [13, 2, 0.7239, 0.0075, 2, 0.99, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.gray_image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L99_C4", "label": "undistort_frame", "type": "function", "loc": [99, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.7537, 0.0373, 1, 0.88, 0.5, 4, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "undistort_frame", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def undistort_frame(self):\n img = self.convert_color()\n cv.Remap(img, self.undistort_image, self.undistort_mapx, self.undistort_mapy, \n cv.CV_INTER_LINEAR, cv.ScalarAll(0)) \n return self.undistort_image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L100_C8", "label": "img = convert_color()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L99_C4", "vector": [14, 2, 0.7463, 0.0075, 2, 0.77, 0.0, 200, 3, 0, 0, 0, 101, 10, 1], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "convert_color", "annotation": ""}, "snippet": " img = self.convert_color()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L101_C8", "label": "Remap()", "type": "expression", "loc": [101, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L99_C4", "vector": [8, 2, 0.7575, 0.0149, 2, 0.77, 0.5, 988, 3, 6, 0, 0, 0, 0, 2], "semantic": {"name": "Remap", "arg_names": [], "import_names": [], "rhs_call_name": "Remap", "annotation": ""}, "snippet": " cv.Remap(img, self.undistort_image, self.undistort_mapx, self.undistort_mapy, \n cv.CV_INTER_LINEAR, cv.ScalarAll(0)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L103_C8", "label": "return", "type": "return", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L99_C4", "vector": [13, 2, 0.7687, 0.0075, 2, 0.77, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.undistort_image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L105_C4", "label": "convert_color", "type": "function", "loc": [105, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.8022, 0.0448, 1, 0.88, 0.6, 101, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "convert_color", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convert_color(self):\n if self.color == True:\n cv.CvtColor(self.raw_image, self.unbayer_image, self.cvbayer_pattern)\n return self.unbayer_image\n else:\n return self.raw_image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L106_C8", "label": "if", "type": "if", "loc": [106, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L105_C4", "vector": [4, 2, 0.806, 0.0373, 2, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.color == True:\n cv.CvtColor(self.raw_image, self.unbayer_image, self.cvbayer_pattern)\n return self.unbayer_image\n else:\n return self.raw_image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L107_C12", "label": "CvtColor()", "type": "expression", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L106_C8", "vector": [8, 3, 0.7985, 0.0075, 3, 0.34, 0.0, 974, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "CvtColor", "arg_names": [], "import_names": [], "rhs_call_name": "CvtColor", "annotation": ""}, "snippet": " cv.CvtColor(self.raw_image, self.unbayer_image, self.cvbayer_pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L108_C12", "label": "return", "type": "return", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L106_C8", "vector": [13, 3, 0.806, 0.0075, 3, 0.34, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.unbayer_image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L110_C12", "label": "return", "type": "return", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L106_C8", "vector": [13, 3, 0.8209, 0.0075, 3, 0.34, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.raw_image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L117_C4", "label": "set_frame_rate", "type": "function", "loc": [117, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.8769, 0.0149, 1, 0.88, 0.7, 975, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_frame_rate", "arg_names": ["self", "rate"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_frame_rate(self, rate=7.5):\n cv.SetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS, rate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L118_C8", "label": "SetCaptureProperty()", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L117_C4", "vector": [8, 2, 0.8806, 0.0075, 2, 0.71, 0.0, 606, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "SetCaptureProperty", "arg_names": [], "import_names": [], "rhs_call_name": "SetCaptureProperty", "annotation": ""}, "snippet": " cv.SetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS, rate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L121_C4", "label": "get_frame_rate", "type": "function", "loc": [121, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.9104, 0.0224, 1, 0.88, 0.8, 752, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_frame_rate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_frame_rate(self):\n fps = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS)\n return fps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L122_C8", "label": "fps = GetCaptureProperty()", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L121_C4", "vector": [14, 2, 0.9104, 0.0075, 2, 0.3, 0.0, 376, 3, 2, 0, 0, 215, 10, 1], "semantic": {"name": "fps", "arg_names": [], "import_names": [], "rhs_call_name": "GetCaptureProperty", "annotation": ""}, "snippet": " fps = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L123_C8", "label": "return", "type": "return", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L121_C4", "vector": [13, 2, 0.9179, 0.0075, 2, 0.3, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L125_C4", "label": "set_brightness", "type": "function", "loc": [125, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.9403, 0.0224, 1, 0.88, 0.9, 252, 0, 5, 0, 0, 0, 0, 1], "semantic": {"name": "set_brightness", "arg_names": ["self", "brightness", "shutter_time", "gain", "exposure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_brightness(self, brightness=150, shutter_time=97,\n gain=450, exposure=None):\n csl.set_brightness(self.device, brightness, exposure, shutter_time, gain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L127_C8", "label": "set_brightness()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L125_C4", "vector": [8, 2, 0.9478, 0.0075, 2, 0.41, 0.0, 252, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "set_brightness", "arg_names": [], "import_names": [], "rhs_call_name": "set_brightness", "annotation": ""}, "snippet": " csl.set_brightness(self.device, brightness, exposure, shutter_time, gain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L130_C4", "label": "set_auto", "type": "function", "loc": [130, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "vector": [2, 1, 0.9739, 0.0149, 1, 0.88, 1.0, 673, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_auto", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_auto(self):\n csl.set_auto(self.device)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L131_C8", "label": "set_auto()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L130_C4", "vector": [8, 2, 0.9776, 0.0075, 2, 0.67, 0.0, 673, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_auto", "arg_names": [], "import_names": [], "rhs_call_name": "set_auto", "annotation": ""}, "snippet": " csl.set_auto(self.device)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L77_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L77_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L78_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L80_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:If_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Return_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99477:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99477:Expr_L131_C8"}] |
#!/usr/bin/env python
import roslib
roslib.load_manifest('hrl_camera')
import ros_camera as rc
import sys
import cv
import rospy
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'Views images published through ROS.'
print 'Usage: ./image_listener.py ROS_TOPIC_NAME'
else:
ros_topic_name = sys.argv[1]
camera = rc.ROSImageClient(ros_topic_name)
cv.NamedWindow(ros_topic_name, cv.CV_WINDOW_AUTOSIZE)
while not rospy.is_shutdown():
f = camera.get_frame()
cv.ShowImage(ros_topic_name, f)
cv.WaitKey(10)
| ajibawa-2023/Python-Code-Large/train/row_99478 | 17 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0455, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1364, 0.0455, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_camera')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Import_L4_C0", "label": "ros_camera import rc", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0455, 0, 0.66, 0.3333, 590, 0, 1, 0, 0, 590, 0, 0], "semantic": {"name": "ros_camera", "arg_names": [], "import_names": ["rc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ros_camera as rc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2273, 0.0455, 0, 0.66, 0.5, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Import_L6_C0", "label": "cv import cv", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2727, 0.0455, 0, 0.66, 0.6667, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Import_L7_C0", "label": "rospy import rospy", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.3182, 0.0455, 0, 0.66, 0.8333, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L9_C0", "label": "if", "type": "if", "loc": [9, 21], "level": 0, "parent": null, "vector": [4, 0, 0.6818, 0.5909, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n if len(sys.argv) < 2:\n print('Views images published through ROS.')\n print('Usage: ./image_listener.py ROS_TOPIC_NAME')\n else:\n ros_topic_name = sys.argv[1]\n camera = rc.ROSImageClient(ros_topic_name)\n cv.NamedWindow(ros_topic_name, cv.CV_WINDOW_AUTOSIZE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "label": "if", "type": "if", "loc": [10, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L9_C0", "vector": [4, 1, 0.7045, 0.5455, 1, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) < 2:\n print('Views images published through ROS.')\n print('Usage: ./image_listener.py ROS_TOPIC_NAME')\n else:\n ros_topic_name = sys.argv[1]\n camera = rc.ROSImageClient(ros_topic_name)\n cv.NamedWindow(ros_topic_name, cv.CV_WINDOW_AUTOSIZE)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L11_C8", "label": "print()", "type": "expression", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "vector": [8, 2, 0.5, 0.0455, 2, 0.43, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Views images published through ROS.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L12_C8", "label": "print()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "vector": [8, 2, 0.5455, 0.0455, 2, 0.43, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Usage: ./image_listener.py ROS_TOPIC_NAME')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Assign_L14_C8", "label": "ros_topic_name =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "vector": [14, 2, 0.6364, 0.0455, 2, 0.43, 0.4, 278, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ros_topic_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ros_topic_name = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Assign_L15_C8", "label": "camera = ROSImageClient()", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "vector": [14, 2, 0.6818, 0.0455, 2, 0.43, 0.6, 848, 3, 1, 0, 0, 348, 10, 1], "semantic": {"name": "camera", "arg_names": [], "import_names": [], "rhs_call_name": "ROSImageClient", "annotation": ""}, "snippet": " camera = rc.ROSImageClient(ros_topic_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L16_C8", "label": "NamedWindow()", "type": "expression", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "vector": [8, 2, 0.7273, 0.0455, 2, 0.43, 0.8, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "NamedWindow", "arg_names": [], "import_names": [], "rhs_call_name": "NamedWindow", "annotation": ""}, "snippet": " cv.NamedWindow(ros_topic_name, cv.CV_WINDOW_AUTOSIZE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:While_L18_C8", "label": "while", "type": "while", "loc": [18, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "vector": [5, 2, 0.8864, 0.1818, 2, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not rospy.is_shutdown():\n f = camera.get_frame()\n cv.ShowImage(ros_topic_name, f)\n cv.WaitKey(10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Assign_L19_C12", "label": "f = get_frame()", "type": "assigned_variable", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:While_L18_C8", "vector": [14, 3, 0.8636, 0.0455, 3, 0.08, 0.0, 899, 3, 0, 0, 0, 489, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "get_frame", "annotation": ""}, "snippet": " f = camera.get_frame()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L20_C12", "label": "ShowImage()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:While_L18_C8", "vector": [8, 3, 0.9091, 0.0455, 3, 0.08, 0.5, 896, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "ShowImage", "arg_names": [], "import_names": [], "rhs_call_name": "ShowImage", "annotation": ""}, "snippet": " cv.ShowImage(ros_topic_name, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L21_C12", "label": "WaitKey()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99478:While_L18_C8", "vector": [8, 3, 0.9545, 0.0455, 3, 0.08, 1.0, 885, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "WaitKey", "arg_names": [], "import_names": [], "rhs_call_name": "WaitKey", "annotation": ""}, "snippet": " cv.WaitKey(10)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:While_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:While_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:Assign_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:While_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99478:While_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99478:Expr_L21_C12"}] |
## Copyright (c) 2004-2007, Andrew D. Straw. All rights reserved.
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are
## met:
## * Redistributions of source code must retain the above copyright
## notice, this list of conditions and the following disclaimer.
## * Redistributions in binary form must reproduce the above
## copyright notice, this list of conditions and the following
## disclaimer in the documentation and/or other materials provided
## with the distribution.
## * Neither the name of the Andrew D. Straw nor the names of its
## contributors may be used to endorse or promote products derived
## from this software without specific prior written permission.
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
##Original code was modified, PlaneLeastSquaresModel() added:
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import numpy as np
import scipy # use numpy if scipy unavailable
import scipy.linalg # use numpy if scipy unavailable
### Optional imports below
# import processor [Both only for testing obsolete dataset, testPlanePointcloud() ]
# import configuration
# import pylab; import sys
TEST_FOLDER ='/home/jokerman/svn/robot1_data/usr/martin/laser_camera_segmentation/labeling'
def ransac(data,model,n,k,t,d,debug=False,return_all=False):
print 'INFO: running RANSAC for k=',k,'iterations'
"""fit model parameters to data using the RANSAC algorithm
This implementation written from pseudocode found at
http://en.wikipedia.org/w/index.php?title=RANSAC&oldid=116358182
{{{
Given:
data - a set of observed data points
model - a model that can be fitted to data points
n - the minimum number of data values required to fit the model
k - the maximum number of iterations allowed in the algorithm
t - a threshold value for determining when a data point fits a model
d - the number of close data values required to assert that a model fits well to data
Return:
bestfit - model parameters which best fit the data (or nil if no good model is found)
iterations = 0
bestfit = nil
besterr = something really large
while iterations < k {
maybeinliers = n randomly selected values from data
maybemodel = model parameters fitted to maybeinliers
alsoinliers = empty set
for every point in data not in maybeinliers {
if point fits maybemodel with an error smaller than t
add point to alsoinliers
}
if the number of elements in alsoinliers is > d {
% this implies that we may have found a good model
% now test how good it is
bettermodel = model parameters fitted to all points in maybeinliers and alsoinliers
thiserr = a measure of how well model fits these points
if thiserr < besterr {
bestfit = bettermodel
besterr = thiserr
}
}
increment iterations
}
return bestfit
}}}
"""
# iterations = 0
# bestfit = None
# besterr = np.inf
# best_inlier_idxs = None
# while iterations < k:
# maybe_idxs, test_idxs = random_partition(n,data.shape[0])
# print n
# maybeinliers = data[maybe_idxs,:]
# #print 'z',maybeinliers
# test_points = data[test_idxs]
# maybemodel = model.fit(maybeinliers)
# test_err = model.get_error( test_points, maybemodel)
# also_idxs = test_idxs[test_err < t] # select indices of rows with accepted points
# alsoinliers = data[also_idxs,:]
# if debug:
# print 'test_err.min()',test_err.min()
# print 'test_err.max()',test_err.max()
# print 'np.mean(test_err)',np.mean(test_err)
# print 'iteration %d:len(alsoinliers) = %d'%(
# iterations,len(alsoinliers))
# if len(alsoinliers) > d:
# print np.asmatrix(maybeinliers), np.asmatrix(alsoinliers)
# betterdata = np.concatenate( (maybeinliers, np.asmatrix(alsoinliers)) )
# bettermodel = model.fit(np.asarray(betterdata))
# better_errs = model.get_error( betterdata, bettermodel)
# thiserr = np.mean( better_errs )
# if thiserr < besterr:
# bestfit = bettermodel
# besterr = thiserr
# print maybe_idxs, also_idxs
# best_inlier_idxs = np.concatenate( (maybe_idxs, [also_idxs]) )
# iterations+=1
# if bestfit is None:
# raise ValueError("did not meet fit acceptance criteria")
# if return_all:
# return bestfit, {'inliers':best_inlier_idxs}
# else:
# return bestfit
iterations = 0
bestfit = None
besterr = np.inf
best_inlier_idxs = None
while iterations < k:
#print data
maybe_idxs, test_idxs = random_partition(n,data.shape[0])
maybeinliers = data[maybe_idxs,:]
test_points = data[test_idxs]
maybemodel = model.fit(maybeinliers)
test_err = model.get_error( test_points, maybemodel)
also_idxs = test_idxs[test_err < t] # select indices of rows with accepted points
alsoinliers = data[also_idxs,:]
if debug:
print 'test_err.min()',test_err.min()
print 'test_err.max()',test_err.max()
print 'np.mean(test_err)',np.mean(test_err)
print 'iteration %d:len(alsoinliers) = %d'%(
iterations,len(alsoinliers))
if len(alsoinliers) > d:
betterdata = np.concatenate( (maybeinliers, alsoinliers) )
bettermodel = model.fit(betterdata)
better_errs = model.get_error( betterdata, bettermodel)
thiserr = np.mean( better_errs )
if thiserr < besterr:
bestfit = bettermodel
besterr = thiserr
best_inlier_idxs = np.concatenate( (maybe_idxs, also_idxs) )
iterations+=1
if bestfit is None:
print "\n\n[ransac.py - line 152]"
print "Ransac plane fitting did not meet fit accaptance criteria at current settings."
print "Consider editing Ransac Parameters to be more generous or trying scan again."
print "This error often happens when no table is present in front of the robot.\n\n"
import sys;
sys.exit()
#Lets NOT raise an error. raise ValueError("did not meet fit acceptance criteria")
if return_all:
return bestfit, {'inliers':best_inlier_idxs}
else:
return bestfit
def random_partition(n,n_data):
"""return n random rows of data (and also the other len(data)-n rows)"""
all_idxs = np.arange( n_data )
np.random.shuffle(all_idxs)
idxs1 = all_idxs[:n]
idxs2 = all_idxs[n:]
return idxs1, idxs2
class LinearLeastSquaresModel:
"""linear system solved using linear least squares
This class serves as an example that fulfills the model interface
needed by the ransac() function.
"""
def __init__(self,input_columns,output_columns,debug=False):
self.input_columns = input_columns
self.output_columns = output_columns
self.debug = debug
def fit(self, data):
A = np.vstack([data[:,i] for i in self.input_columns]).T
B = np.vstack([data[:,i] for i in self.output_columns]).T
x,resids,rank,s = scipy.linalg.lstsq(A,B)
return x
def get_error( self, data, model):
A = np.vstack([data[:,i] for i in self.input_columns]).T
B = np.vstack([data[:,i] for i in self.output_columns]).T
B_fit = scipy.dot(A,model)
err_per_point = np.sum((B-B_fit)**2,axis=1) # sum squared error per row
print err_per_point
return err_per_point
class PlaneLeastSquaresModel:
def __init__(self, debug=False):
self.debug = debug
def fit(self, data):
#print 'fit',data
model = [data[0],np.cross(data[1] - data[0], data[2] - data[1])] #point, normal
model[1] = model[1] / np.linalg.norm(model[1]) #normalize
return model
def get_error( self, data, model):
#reject model if it's not horizontal
max_angle = 30.0 * np.pi / 180.0
angle = np.arccos(scipy.dot(np.array([0,0,1]),model[1].T)) #normal is normalized
#print 'angle', angle / np.pi * 180.0
if abs(angle) > max_angle:
return np.ones(np.shape(data)[0]) * 999999999999999999999999999999
#http://de.wikipedia.org/wiki/Hessesche_Normalform
#print model[0], model[1]
d = scipy.dot(model[0],model[1].T)
#print 'd',d
s = scipy.dot(data, model[1].T) - d
#print 'dmds',data, model, d, 's',s
#err_per_point = np.sum(np.asarray(s)**2, axis=1) # sum squared error per row
#return err_per_point
return abs(s)
def test():
# generate perfect input data
n_samples = 500
n_inputs = 1
n_outputs = 1
A_exact = 20*np.random.random((n_samples,n_inputs) )
perfect_fit = 60*np.random.normal(size=(n_inputs,n_outputs) ) # the model
B_exact = scipy.dot(A_exact,perfect_fit)
assert B_exact.shape == (n_samples,n_outputs)
# add a little gaussian noise (linear least squares alone should handle this well)
A_noisy = A_exact + np.random.normal(size=A_exact.shape )
B_noisy = B_exact + np.random.normal(size=B_exact.shape )
if 1:
# add some outliers
n_outliers = 100
all_idxs = np.arange( A_noisy.shape[0] )
np.random.shuffle(all_idxs)
outlier_idxs = all_idxs[:n_outliers]
non_outlier_idxs = all_idxs[n_outliers:]
A_noisy[outlier_idxs] = 20*np.random.random((n_outliers,n_inputs) )
B_noisy[outlier_idxs] = 50*np.random.normal(size=(n_outliers,n_outputs) )
# setup model
all_data = np.hstack( (A_noisy,B_noisy) )
input_columns = range(n_inputs) # the first columns of the array
output_columns = [n_inputs+i for i in range(n_outputs)] # the last columns of the array
debug = False
model = LinearLeastSquaresModel(input_columns,output_columns,debug=debug)
linear_fit,resids,rank,s = scipy.linalg.lstsq(all_data[:,input_columns],
all_data[:,output_columns])
# run RANSAC algorithm
ransac_fit, ransac_data = ransac(all_data,model,
50, 1000, 7e3, 300, # misc. parameters
debug=debug,return_all=True)
if 1:
import pylab
sort_idxs = np.argsort(A_exact[:,0])
A_col0_sorted = A_exact[sort_idxs] # maintain as rank-2 array
if 1:
pylab.plot( A_noisy[:,0], B_noisy[:,0], 'k.', label='data' )
pylab.plot( A_noisy[ransac_data['inliers'],0], B_noisy[ransac_data['inliers'],0], 'bx', label='RANSAC data' )
else:
pylab.plot( A_noisy[non_outlier_idxs,0], B_noisy[non_outlier_idxs,0], 'k.', label='noisy data' )
pylab.plot( A_noisy[outlier_idxs,0], B_noisy[outlier_idxs,0], 'r.', label='outlier data' )
pylab.plot( A_col0_sorted[:,0],
np.dot(A_col0_sorted,ransac_fit)[:,0],
label='RANSAC fit' )
pylab.plot( A_col0_sorted[:,0],
np.dot(A_col0_sorted,perfect_fit)[:,0],
label='exact system' )
pylab.plot( A_col0_sorted[:,0],
np.dot(A_col0_sorted,linear_fit)[:,0],
label='linear fit' )
pylab.legend()
pylab.show()
def testPlane():
debug = True
model = PlaneLeastSquaresModel(debug)
data = np.array([[0,0,0],[0,1,0],[0.1,12,0.1],[0,0,12],[1,0,0],[1,2,13]])
# run RANSAC algorithm
ransac_fit, ransac_data = ransac(data,model,
3, 1000, 1, 2, # misc. parameters
debug=debug,return_all=True)
print ransac_fit
print ransac_data
def testPlanePointcloud():
import processor
import configuration
cfg = configuration.configuration(TEST_FOLDER)
#sc = scanner.scanner(cfg)
pc = processor.processor(cfg)
#pc.load_data('2009Oct30_162400')
pc.load_data('2009Nov04_141226')
pc.process_raw_data()
debug = False
model = PlaneLeastSquaresModel(debug)
data = np.asarray(pc.pts3d_bound).T
# run RANSAC algorithm
ransac_fit, ransac_data = ransac(data,model,
3, 1000, 0.02, 300, # misc. parameters
debug=debug,return_all=True)
print ransac_fit
print ransac_data
print 'len inlier',len(ransac_data['inliers']),'shape pts',np.shape(pc.pts3d_bound)
pc.pts3d_bound = pc.pts3d_bound[:,ransac_data['inliers']]
pc.display_3d('height')
if __name__=='__main__':
#testPlane()
testPlanePointcloud()
| ajibawa-2023/Python-Code-Large/train/row_99480 | 145 | 336 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L36_C0", "label": "numpy import np", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.1071, 0.003, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L37_C0", "label": "scipy import scipy", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.1101, 0.003, 0, 0.66, 0.0909, 265, 0, 1, 0, 0, 265, 0, 0], "semantic": {"name": "scipy", "arg_names": [], "import_names": ["scipy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy # use numpy if scipy unavailable"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L38_C0", "label": "scipy.linalg import scipy.linalg", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.1131, 0.003, 0, 0.66, 0.1818, 884, 0, 1, 0, 0, 884, 0, 0], "semantic": {"name": "scipy.linalg", "arg_names": [], "import_names": ["scipy.linalg"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.linalg # use numpy if scipy unavailable"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L46_C0", "label": "TEST_FOLDER =", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.1369, 0.003, 0, 0.66, 0.2727, 933, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TEST_FOLDER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_FOLDER ='/home/jokerman/svn/robot1_data/usr/martin/laser_camera_segmentation/labeling'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "label": "ransac", "type": "function", "loc": [48, 167], "level": 0, "parent": null, "vector": [2, 0, 0.3199, 0.3571, 0, 0.66, 0.3636, 32, 0, 8, 1, 0, 0, 0, 21], "semantic": {"name": "ransac", "arg_names": ["data", "model", "n", "k", "t", "d", "debug", "return_all"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ransac(data,model,n,k,t,d,debug=False,return_all=False):\n print('INFO: running RANSAC for k=',k,'iterations')\n \"\"\"fit model parameters to data using the RANSAC algorithm\n \nThis implementation written from pseudocode found at\nhttp://en.wikipedia.org/w/index.php?title=RANSAC&oldid=116358182\n\n{{{"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L49_C4", "label": "print()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [8, 1, 0.1458, 0.003, 1, 0.23, 0.0, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('INFO: running RANSAC for k=',k,'iterations')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [8, 1, 0.2083, 0.122, 1, 0.23, 0.125, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"fit model parameters to data using the RANSAC algorithm\n \nThis implementation written from pseudocode found at\nhttp://en.wikipedia.org/w/index.php?title=RANSAC&oldid=116358182\n\n{{{\nGiven:\n data - a set of observed data points"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L129_C4", "label": "iterations =", "type": "assigned_variable", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [14, 1, 0.3839, 0.003, 1, 0.23, 0.25, 143, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "iterations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iterations = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L130_C4", "label": "bestfit =", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [14, 1, 0.3869, 0.003, 1, 0.23, 0.375, 706, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "bestfit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bestfit = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L131_C4", "label": "besterr =", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [14, 1, 0.3899, 0.003, 1, 0.23, 0.5, 799, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "besterr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " besterr = np.inf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L132_C4", "label": "best_inlier_idxs =", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [14, 1, 0.3929, 0.003, 1, 0.23, 0.625, 132, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "best_inlier_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " best_inlier_idxs = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "label": "while", "type": "while", "loc": [133, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [5, 1, 0.4286, 0.0685, 1, 0.23, 0.75, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while iterations < k:\n #print data\n maybe_idxs, test_idxs = random_partition(n,data.shape[0])\n maybeinliers = data[maybe_idxs,:]\n test_points = data[test_idxs]\n maybemodel = model.fit(maybeinliers)\n test_err = model.get_error( test_points, maybemodel)\n also_idxs = test_idxs[test_err < t] # select indices of rows with accepted points"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L135_C8", "label": "maybe_idxs, test_idxs = random_partition()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [14, 2, 0.4018, 0.003, 2, 0.21, 0.0, 331, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "maybe_idxs, test_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "random_partition", "annotation": ""}, "snippet": " maybe_idxs, test_idxs = random_partition(n,data.shape[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L136_C8", "label": "maybeinliers =", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [14, 2, 0.4048, 0.003, 2, 0.21, 0.125, 407, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "maybeinliers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " maybeinliers = data[maybe_idxs,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L137_C8", "label": "test_points =", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [14, 2, 0.4077, 0.003, 2, 0.21, 0.25, 293, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "test_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " test_points = data[test_idxs]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L138_C8", "label": "maybemodel = fit()", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [14, 2, 0.4107, 0.003, 2, 0.21, 0.375, 118, 3, 1, 0, 0, 828, 10, 1], "semantic": {"name": "maybemodel", "arg_names": [], "import_names": [], "rhs_call_name": "fit", "annotation": ""}, "snippet": " maybemodel = model.fit(maybeinliers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L139_C8", "label": "test_err = get_error()", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [14, 2, 0.4137, 0.003, 2, 0.21, 0.5, 118, 3, 2, 0, 0, 186, 10, 1], "semantic": {"name": "test_err", "arg_names": [], "import_names": [], "rhs_call_name": "get_error", "annotation": ""}, "snippet": " test_err = model.get_error( test_points, maybemodel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L140_C8", "label": "also_idxs =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [14, 2, 0.4167, 0.003, 2, 0.21, 0.625, 407, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "also_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " also_idxs = test_idxs[test_err < t] # select indices of rows with accepted points"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L141_C8", "label": "alsoinliers =", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [14, 2, 0.4196, 0.003, 2, 0.21, 0.75, 358, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alsoinliers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alsoinliers = data[also_idxs,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L142_C8", "label": "if", "type": "if", "loc": [142, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [4, 2, 0.4271, 0.0119, 2, 0.21, 0.875, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if debug:\n print('test_err.min()',test_err.min())\n print('test_err.max()',test_err.max())\n print('np.mean(test_err)',np.mean(test_err))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L143_C12", "label": "print()", "type": "expression", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L142_C8", "vector": [8, 3, 0.4256, 0.003, 3, 0.71, 0.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('test_err.min()',test_err.min())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L144_C12", "label": "print()", "type": "expression", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L142_C8", "vector": [8, 3, 0.4286, 0.003, 3, 0.71, 0.5, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('test_err.max()',test_err.max())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L145_C12", "label": "print()", "type": "expression", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L142_C8", "vector": [8, 3, 0.4315, 0.003, 3, 0.71, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('np.mean(test_err)',np.mean(test_err))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "label": "if", "type": "if", "loc": [146, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "vector": [4, 2, 0.4464, 0.0268, 2, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(alsoinliers) > d:\n betterdata = np.concatenate( (maybeinliers, alsoinliers) )\n bettermodel = model.fit(betterdata)\n better_errs = model.get_error( betterdata, bettermodel)\n thiserr = np.mean( better_errs )\n if thiserr < besterr:\n bestfit = bettermodel\n besterr = thiserr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L147_C12", "label": "betterdata = concatenate()", "type": "assigned_variable", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "vector": [14, 3, 0.4375, 0.003, 3, 0.12, 0.0, 10, 3, 1, 0, 0, 63, 10, 1], "semantic": {"name": "betterdata", "arg_names": [], "import_names": [], "rhs_call_name": "concatenate", "annotation": ""}, "snippet": " betterdata = np.concatenate( (maybeinliers, alsoinliers) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L148_C12", "label": "bettermodel = fit()", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "vector": [14, 3, 0.4405, 0.003, 3, 0.12, 0.25, 969, 3, 1, 0, 0, 828, 10, 1], "semantic": {"name": "bettermodel", "arg_names": [], "import_names": [], "rhs_call_name": "fit", "annotation": ""}, "snippet": " bettermodel = model.fit(betterdata)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L149_C12", "label": "better_errs = get_error()", "type": "assigned_variable", "loc": [149, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "vector": [14, 3, 0.4435, 0.003, 3, 0.12, 0.5, 117, 3, 2, 0, 0, 186, 10, 1], "semantic": {"name": "better_errs", "arg_names": [], "import_names": [], "rhs_call_name": "get_error", "annotation": ""}, "snippet": " better_errs = model.get_error( betterdata, bettermodel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L150_C12", "label": "thiserr = mean()", "type": "assigned_variable", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "vector": [14, 3, 0.4464, 0.003, 3, 0.12, 0.75, 117, 3, 1, 0, 0, 856, 10, 1], "semantic": {"name": "thiserr", "arg_names": [], "import_names": [], "rhs_call_name": "mean", "annotation": ""}, "snippet": " thiserr = np.mean( better_errs )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L151_C12", "label": "if", "type": "if", "loc": [151, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "vector": [4, 3, 0.4539, 0.0119, 3, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if thiserr < besterr:\n bestfit = bettermodel\n besterr = thiserr\n best_inlier_idxs = np.concatenate( (maybe_idxs, also_idxs) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L152_C16", "label": "bestfit =", "type": "assigned_variable", "loc": [152, 152], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L151_C12", "vector": [14, 4, 0.4524, 0.003, 4, 0.0, 0.0, 706, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bestfit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bestfit = bettermodel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L153_C16", "label": "besterr =", "type": "assigned_variable", "loc": [153, 153], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L151_C12", "vector": [14, 4, 0.4554, 0.003, 4, 0.0, 0.5, 799, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "besterr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " besterr = thiserr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L154_C16", "label": "best_inlier_idxs = concatenate()", "type": "assigned_variable", "loc": [154, 154], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L151_C12", "vector": [14, 4, 0.4583, 0.003, 4, 0.0, 1.0, 132, 3, 1, 0, 0, 63, 10, 1], "semantic": {"name": "best_inlier_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "concatenate", "annotation": ""}, "snippet": " best_inlier_idxs = np.concatenate( (maybe_idxs, also_idxs) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "label": "if", "type": "if", "loc": [156, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [4, 1, 0.4732, 0.0208, 1, 0.23, 0.875, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bestfit is None:\n print(\"\\n\\n[ransac.py - line 152]\")\n print(\"Ransac plane fitting did not meet fit accaptance criteria at current settings.\")\n print(\"Consider editing Ransac Parameters to be more generous or trying scan again.\")\n print(\"This error often happens when no table is present in front of the robot.\\n\\n\")\n import sys; \n sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L157_C8", "label": "print()", "type": "expression", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "vector": [8, 2, 0.4673, 0.003, 2, 0.24, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\n\\n[ransac.py - line 152]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L158_C8", "label": "print()", "type": "expression", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "vector": [8, 2, 0.4702, 0.003, 2, 0.24, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Ransac plane fitting did not meet fit accaptance criteria at current settings.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L159_C8", "label": "print()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "vector": [8, 2, 0.4732, 0.003, 2, 0.24, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Consider editing Ransac Parameters to be more generous or trying scan again.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L160_C8", "label": "print()", "type": "expression", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "vector": [8, 2, 0.4762, 0.003, 2, 0.24, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"This error often happens when no table is present in front of the robot.\\n\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L161_C8", "label": "sys import sys", "type": "import", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "vector": [1, 2, 0.4792, 0.003, 2, 0.24, 0.8, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys; "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L162_C8", "label": "exit()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "vector": [8, 2, 0.4821, 0.003, 2, 0.24, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L164_C4", "label": "if", "type": "if", "loc": [164, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "vector": [4, 1, 0.4926, 0.0119, 1, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if return_all:\n return bestfit, {'inliers':best_inlier_idxs}\n else:\n return bestfit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L165_C8", "label": "return", "type": "return", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L164_C4", "vector": [13, 2, 0.4911, 0.003, 2, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bestfit, {'inliers':best_inlier_idxs}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L167_C8", "label": "return", "type": "return", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L164_C4", "vector": [13, 2, 0.497, 0.003, 2, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bestfit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "label": "random_partition", "type": "function", "loc": [170, 176], "level": 0, "parent": null, "vector": [2, 0, 0.5149, 0.0208, 0, 0.66, 0.4545, 96, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "random_partition", "arg_names": ["n", "n_data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def random_partition(n,n_data):\n \"\"\"return n random rows of data (and also the other len(data)-n rows)\"\"\"\n all_idxs = np.arange( n_data )\n np.random.shuffle(all_idxs)\n idxs1 = all_idxs[:n]\n idxs2 = all_idxs[n:]\n return idxs1, idxs2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L171_C4", "label": "expression", "type": "expression", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "vector": [8, 1, 0.5089, 0.003, 1, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"return n random rows of data (and also the other len(data)-n rows)\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L172_C4", "label": "all_idxs = arange()", "type": "assigned_variable", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "vector": [14, 1, 0.5119, 0.003, 1, 0.48, 0.2, 960, 3, 1, 0, 0, 489, 10, 1], "semantic": {"name": "all_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "arange", "annotation": ""}, "snippet": " all_idxs = np.arange( n_data )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L173_C4", "label": "shuffle()", "type": "expression", "loc": [173, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "vector": [8, 1, 0.5149, 0.003, 1, 0.48, 0.4, 903, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "shuffle", "arg_names": [], "import_names": [], "rhs_call_name": "shuffle", "annotation": ""}, "snippet": " np.random.shuffle(all_idxs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L174_C4", "label": "idxs1 =", "type": "assigned_variable", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "vector": [14, 1, 0.5179, 0.003, 1, 0.48, 0.6, 677, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idxs1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idxs1 = all_idxs[:n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L175_C4", "label": "idxs2 =", "type": "assigned_variable", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "vector": [14, 1, 0.5208, 0.003, 1, 0.48, 0.8, 730, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idxs2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idxs2 = all_idxs[n:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L176_C4", "label": "return", "type": "return", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "vector": [13, 1, 0.5238, 0.003, 1, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return idxs1, idxs2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "label": "LinearLeastSquaresModel", "type": "class", "loc": [178, 200], "level": 0, "parent": null, "vector": [3, 0, 0.5625, 0.0685, 0, 0.66, 0.5455, 613, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "LinearLeastSquaresModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LinearLeastSquaresModel:\n \"\"\"linear system solved using linear least squares\n\n This class serves as an example that fulfills the model interface\n needed by the ransac() function.\n \n \"\"\"\n def __init__(self,input_columns,output_columns,debug=False):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L179_C4", "label": "expression", "type": "expression", "loc": [179, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "vector": [8, 1, 0.5402, 0.0179, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"linear system solved using linear least squares\n\n This class serves as an example that fulfills the model interface\n needed by the ransac() function.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L185_C4", "label": "__init__", "type": "function", "loc": [185, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "vector": [2, 1, 0.5551, 0.0119, 1, 0.76, 0.3333, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "input_columns", "output_columns", "debug"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,input_columns,output_columns,debug=False):\n self.input_columns = input_columns\n self.output_columns = output_columns\n self.debug = debug"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L186_C8", "label": "self.input_columns =", "type": "assigned_variable", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L185_C4", "vector": [14, 2, 0.5536, 0.003, 2, 0.34, 0.0, 438, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.input_columns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.input_columns = input_columns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L187_C8", "label": "self.output_columns =", "type": "assigned_variable", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L185_C4", "vector": [14, 2, 0.5565, 0.003, 2, 0.34, 0.5, 608, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.output_columns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.output_columns = output_columns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L188_C8", "label": "self.debug =", "type": "assigned_variable", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L185_C4", "vector": [14, 2, 0.5595, 0.003, 2, 0.34, 1.0, 168, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.debug", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.debug = debug"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "label": "fit", "type": "function", "loc": [189, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "vector": [2, 1, 0.5685, 0.0149, 1, 0.76, 0.6667, 828, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "fit", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fit(self, data):\n A = np.vstack([data[:,i] for i in self.input_columns]).T\n B = np.vstack([data[:,i] for i in self.output_columns]).T\n x,resids,rank,s = scipy.linalg.lstsq(A,B)\n return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L190_C8", "label": "A =", "type": "assigned_variable", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "vector": [14, 2, 0.5655, 0.003, 2, 0.81, 0.0, 429, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "A", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " A = np.vstack([data[:,i] for i in self.input_columns]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L191_C8", "label": "B =", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "vector": [14, 2, 0.5685, 0.003, 2, 0.81, 0.3333, 197, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "B", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " B = np.vstack([data[:,i] for i in self.output_columns]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L192_C8", "label": "x, resids, rank, s = lstsq()", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "vector": [14, 2, 0.5714, 0.003, 2, 0.81, 0.6667, 868, 3, 2, 0, 0, 318, 10, 1], "semantic": {"name": "x, resids, rank, s", "arg_names": [], "import_names": [], "rhs_call_name": "lstsq", "annotation": ""}, "snippet": " x,resids,rank,s = scipy.linalg.lstsq(A,B)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L193_C8", "label": "return", "type": "return", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "vector": [13, 2, 0.5744, 0.003, 2, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "label": "get_error", "type": "function", "loc": [194, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "vector": [2, 1, 0.5863, 0.0208, 1, 0.76, 1.0, 186, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "get_error", "arg_names": ["self", "data", "model"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_error( self, data, model):\n A = np.vstack([data[:,i] for i in self.input_columns]).T\n B = np.vstack([data[:,i] for i in self.output_columns]).T\n B_fit = scipy.dot(A,model)\n err_per_point = np.sum((B-B_fit)**2,axis=1) # sum squared error per row\n print(err_per_point)\n return err_per_point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L195_C8", "label": "A =", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "vector": [14, 2, 0.5804, 0.003, 2, 0.65, 0.0, 429, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "A", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " A = np.vstack([data[:,i] for i in self.input_columns]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L196_C8", "label": "B =", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "vector": [14, 2, 0.5833, 0.003, 2, 0.65, 0.2, 197, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "B", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " B = np.vstack([data[:,i] for i in self.output_columns]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L197_C8", "label": "B_fit = dot()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "vector": [14, 2, 0.5863, 0.003, 2, 0.65, 0.4, 214, 3, 2, 0, 0, 310, 10, 1], "semantic": {"name": "B_fit", "arg_names": [], "import_names": [], "rhs_call_name": "dot", "annotation": ""}, "snippet": " B_fit = scipy.dot(A,model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L198_C8", "label": "err_per_point = sum()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "vector": [14, 2, 0.5893, 0.003, 2, 0.65, 0.6, 931, 3, 2, 0, 0, 824, 10, 1], "semantic": {"name": "err_per_point", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " err_per_point = np.sum((B-B_fit)**2,axis=1) # sum squared error per row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L199_C8", "label": "print()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "vector": [8, 2, 0.5923, 0.003, 2, 0.65, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(err_per_point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "vector": [13, 2, 0.5952, 0.003, 2, 0.65, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return err_per_point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L202_C0", "label": "PlaneLeastSquaresModel", "type": "class", "loc": [202, 228], "level": 0, "parent": null, "vector": [3, 0, 0.6399, 0.0804, 0, 0.66, 0.6364, 15, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "PlaneLeastSquaresModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PlaneLeastSquaresModel:\n \n def __init__(self, debug=False):\n self.debug = debug\n def fit(self, data):\n #print 'fit',data\n model = [data[0],np.cross(data[1] - data[0], data[2] - data[1])] #point, normal\n model[1] = model[1] / np.linalg.norm(model[1]) #normalize"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L204_C4", "label": "__init__", "type": "function", "loc": [204, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L202_C0", "vector": [2, 1, 0.6086, 0.006, 1, 0.33, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "debug"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, debug=False):\n self.debug = debug"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L205_C8", "label": "self.debug =", "type": "assigned_variable", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L204_C4", "vector": [14, 2, 0.6101, 0.003, 2, 0.12, 0.0, 168, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.debug", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.debug = debug"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L206_C4", "label": "fit", "type": "function", "loc": [206, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L202_C0", "vector": [2, 1, 0.619, 0.0149, 1, 0.33, 0.5, 828, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "fit", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fit(self, data):\n #print 'fit',data\n model = [data[0],np.cross(data[1] - data[0], data[2] - data[1])] #point, normal\n model[1] = model[1] / np.linalg.norm(model[1]) #normalize\n return model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L208_C8", "label": "model =", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L206_C4", "vector": [14, 2, 0.619, 0.003, 2, 0.58, 0.0, 722, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = [data[0],np.cross(data[1] - data[0], data[2] - data[1])] #point, normal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L209_C8", "label": "assign", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L206_C4", "vector": [14, 2, 0.622, 0.003, 2, 0.58, 0.5, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model[1] = model[1] / np.linalg.norm(model[1]) #normalize"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L210_C8", "label": "return", "type": "return", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L206_C4", "vector": [13, 2, 0.625, 0.003, 2, 0.58, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "label": "get_error", "type": "function", "loc": [211, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L202_C0", "vector": [2, 1, 0.6533, 0.0536, 1, 0.33, 1.0, 186, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "get_error", "arg_names": ["self", "data", "model"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_error( self, data, model):\n \n #reject model if it's not horizontal\n max_angle = 30.0 * np.pi / 180.0\n angle = np.arccos(scipy.dot(np.array([0,0,1]),model[1].T)) #normal is normalized\n #print 'angle', angle / np.pi * 180.0\n \n if abs(angle) > max_angle:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L214_C8", "label": "max_angle =", "type": "assigned_variable", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "vector": [14, 2, 0.6369, 0.003, 2, 0.66, 0.0, 451, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_angle", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_angle = 30.0 * np.pi / 180.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L215_C8", "label": "angle = arccos()", "type": "assigned_variable", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "vector": [14, 2, 0.6399, 0.003, 2, 0.66, 0.2, 418, 3, 1, 0, 0, 793, 10, 3], "semantic": {"name": "angle", "arg_names": [], "import_names": [], "rhs_call_name": "arccos", "annotation": ""}, "snippet": " angle = np.arccos(scipy.dot(np.array([0,0,1]),model[1].T)) #normal is normalized"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L218_C8", "label": "if", "type": "if", "loc": [218, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "vector": [4, 2, 0.6503, 0.006, 2, 0.66, 0.4, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if abs(angle) > max_angle:\n return np.ones(np.shape(data)[0]) * 999999999999999999999999999999"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L219_C12", "label": "return", "type": "return", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L218_C8", "vector": [13, 3, 0.6518, 0.003, 3, 0.29, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.ones(np.shape(data)[0]) * 999999999999999999999999999999"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L222_C8", "label": "d = dot()", "type": "assigned_variable", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "vector": [14, 2, 0.6607, 0.003, 2, 0.66, 0.6, 355, 3, 2, 0, 0, 310, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "dot", "annotation": ""}, "snippet": " d = scipy.dot(model[0],model[1].T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L224_C8", "label": "s =", "type": "assigned_variable", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "vector": [14, 2, 0.6667, 0.003, 2, 0.66, 0.8, 553, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = scipy.dot(data, model[1].T) - d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "vector": [13, 2, 0.6786, 0.003, 2, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return abs(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "label": "test", "type": "function", "loc": [230, 292], "level": 0, "parent": null, "vector": [2, 0, 0.7768, 0.1875, 0, 0.66, 0.7273, 224, 0, 0, 0, 0, 0, 0, 28], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n # generate perfect input data\n\n n_samples = 500\n n_inputs = 1\n n_outputs = 1\n A_exact = 20*np.random.random((n_samples,n_inputs) )\n perfect_fit = 60*np.random.normal(size=(n_inputs,n_outputs) ) # the model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L233_C4", "label": "n_samples =", "type": "assigned_variable", "loc": [233, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.6935, 0.003, 1, 0.89, 0.0, 812, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n_samples", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_samples = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L234_C4", "label": "n_inputs =", "type": "assigned_variable", "loc": [234, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.6964, 0.003, 1, 0.89, 0.0625, 424, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n_inputs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_inputs = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L235_C4", "label": "n_outputs =", "type": "assigned_variable", "loc": [235, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.6994, 0.003, 1, 0.89, 0.125, 11, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n_outputs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_outputs = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L236_C4", "label": "A_exact =", "type": "assigned_variable", "loc": [236, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7024, 0.003, 1, 0.89, 0.1875, 889, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "A_exact", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " A_exact = 20*np.random.random((n_samples,n_inputs) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L237_C4", "label": "perfect_fit =", "type": "assigned_variable", "loc": [237, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7054, 0.003, 1, 0.89, 0.25, 405, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "perfect_fit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " perfect_fit = 60*np.random.normal(size=(n_inputs,n_outputs) ) # the model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L238_C4", "label": "B_exact = dot()", "type": "assigned_variable", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7083, 0.003, 1, 0.89, 0.3125, 254, 3, 2, 0, 0, 310, 10, 1], "semantic": {"name": "B_exact", "arg_names": [], "import_names": [], "rhs_call_name": "dot", "annotation": ""}, "snippet": " B_exact = scipy.dot(A_exact,perfect_fit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L242_C4", "label": "A_noisy =", "type": "assigned_variable", "loc": [242, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7202, 0.003, 1, 0.89, 0.375, 126, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "A_noisy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " A_noisy = A_exact + np.random.normal(size=A_exact.shape )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L243_C4", "label": "B_noisy =", "type": "assigned_variable", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7232, 0.003, 1, 0.89, 0.4375, 42, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "B_noisy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " B_noisy = B_exact + np.random.normal(size=B_exact.shape )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "label": "if", "type": "if", "loc": [245, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [4, 1, 0.7411, 0.0268, 1, 0.89, 0.5, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 1:\n # add some outliers\n n_outliers = 100\n all_idxs = np.arange( A_noisy.shape[0] )\n np.random.shuffle(all_idxs)\n outlier_idxs = all_idxs[:n_outliers]\n non_outlier_idxs = all_idxs[n_outliers:]\n A_noisy[outlier_idxs] = 20*np.random.random((n_outliers,n_inputs) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L247_C8", "label": "n_outliers =", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "vector": [14, 2, 0.7351, 0.003, 2, 0.37, 0.0, 587, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n_outliers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_outliers = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L248_C8", "label": "all_idxs = arange()", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "vector": [14, 2, 0.7381, 0.003, 2, 0.37, 0.1667, 960, 3, 1, 0, 0, 489, 10, 1], "semantic": {"name": "all_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "arange", "annotation": ""}, "snippet": " all_idxs = np.arange( A_noisy.shape[0] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L249_C8", "label": "shuffle()", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "vector": [8, 2, 0.7411, 0.003, 2, 0.37, 0.3333, 903, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "shuffle", "arg_names": [], "import_names": [], "rhs_call_name": "shuffle", "annotation": ""}, "snippet": " np.random.shuffle(all_idxs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L250_C8", "label": "outlier_idxs =", "type": "assigned_variable", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "vector": [14, 2, 0.744, 0.003, 2, 0.37, 0.5, 167, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "outlier_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " outlier_idxs = all_idxs[:n_outliers]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L251_C8", "label": "non_outlier_idxs =", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "vector": [14, 2, 0.747, 0.003, 2, 0.37, 0.6667, 913, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "non_outlier_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " non_outlier_idxs = all_idxs[n_outliers:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L252_C8", "label": "assign", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "vector": [14, 2, 0.75, 0.003, 2, 0.37, 0.8333, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " A_noisy[outlier_idxs] = 20*np.random.random((n_outliers,n_inputs) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L253_C8", "label": "assign", "type": "assigned_variable", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "vector": [14, 2, 0.753, 0.003, 2, 0.37, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " B_noisy[outlier_idxs] = 50*np.random.normal(size=(n_outliers,n_outputs) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L257_C4", "label": "all_data = hstack()", "type": "assigned_variable", "loc": [257, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7649, 0.003, 1, 0.89, 0.5625, 688, 3, 1, 0, 0, 85, 10, 1], "semantic": {"name": "all_data", "arg_names": [], "import_names": [], "rhs_call_name": "hstack", "annotation": ""}, "snippet": " all_data = np.hstack( (A_noisy,B_noisy) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L258_C4", "label": "input_columns = range()", "type": "assigned_variable", "loc": [258, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7679, 0.003, 1, 0.89, 0.625, 839, 3, 1, 0, 0, 816, 10, 1], "semantic": {"name": "input_columns", "arg_names": [], "import_names": [], "rhs_call_name": "range", "annotation": ""}, "snippet": " input_columns = range(n_inputs) # the first columns of the array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L259_C4", "label": "output_columns =", "type": "assigned_variable", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7708, 0.003, 1, 0.89, 0.6875, 58, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "output_columns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " output_columns = [n_inputs+i for i in range(n_outputs)] # the last columns of the array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L260_C4", "label": "debug =", "type": "assigned_variable", "loc": [260, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7738, 0.003, 1, 0.89, 0.75, 924, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " debug = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L261_C4", "label": "model = LinearLeastSquaresModel()", "type": "assigned_variable", "loc": [261, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7768, 0.003, 1, 0.89, 0.8125, 722, 3, 3, 0, 0, 613, 10, 1], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "LinearLeastSquaresModel", "annotation": ""}, "snippet": " model = LinearLeastSquaresModel(input_columns,output_columns,debug=debug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L263_C4", "label": "linear_fit, resids, rank, s = lstsq()", "type": "assigned_variable", "loc": [263, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7842, 0.006, 1, 0.89, 0.875, 407, 3, 2, 0, 0, 318, 10, 1], "semantic": {"name": "linear_fit, resids, rank, s", "arg_names": [], "import_names": [], "rhs_call_name": "lstsq", "annotation": ""}, "snippet": " linear_fit,resids,rank,s = scipy.linalg.lstsq(all_data[:,input_columns],\n all_data[:,output_columns])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L267_C4", "label": "ransac_fit, ransac_data = ransac()", "type": "assigned_variable", "loc": [267, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [14, 1, 0.7976, 0.0089, 1, 0.89, 0.9375, 711, 3, 8, 0, 0, 32, 10, 1], "semantic": {"name": "ransac_fit, ransac_data", "arg_names": [], "import_names": [], "rhs_call_name": "ransac", "annotation": ""}, "snippet": " ransac_fit, ransac_data = ransac(all_data,model,\n 50, 1000, 7e3, 300, # misc. parameters\n debug=debug,return_all=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "label": "if", "type": "if", "loc": [270, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "vector": [4, 1, 0.8363, 0.0685, 1, 0.89, 1.0, 0, 1, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 1:\n import pylab\n\n sort_idxs = np.argsort(A_exact[:,0])\n A_col0_sorted = A_exact[sort_idxs] # maintain as rank-2 array\n\n if 1:\n pylab.plot( A_noisy[:,0], B_noisy[:,0], 'k.', label='data' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L271_C8", "label": "pylab import pylab", "type": "import", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [1, 2, 0.8065, 0.003, 2, 0.34, 0.0, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pylab"], "rhs_call_name": "", "annotation": ""}, "snippet": " import pylab"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L273_C8", "label": "sort_idxs = argsort()", "type": "assigned_variable", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [14, 2, 0.8125, 0.003, 2, 0.34, 0.125, 625, 3, 1, 0, 0, 237, 10, 1], "semantic": {"name": "sort_idxs", "arg_names": [], "import_names": [], "rhs_call_name": "argsort", "annotation": ""}, "snippet": " sort_idxs = np.argsort(A_exact[:,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L274_C8", "label": "A_col0_sorted =", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [14, 2, 0.8155, 0.003, 2, 0.34, 0.25, 838, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "A_col0_sorted", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " A_col0_sorted = A_exact[sort_idxs] # maintain as rank-2 array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "label": "if", "type": "if", "loc": [276, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [4, 2, 0.8289, 0.0179, 2, 0.34, 0.375, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 1:\n pylab.plot( A_noisy[:,0], B_noisy[:,0], 'k.', label='data' )\n pylab.plot( A_noisy[ransac_data['inliers'],0], B_noisy[ransac_data['inliers'],0], 'bx', label='RANSAC data' )\n else:\n pylab.plot( A_noisy[non_outlier_idxs,0], B_noisy[non_outlier_idxs,0], 'k.', label='noisy data' )\n pylab.plot( A_noisy[outlier_idxs,0], B_noisy[outlier_idxs,0], 'r.', label='outlier data' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L277_C12", "label": "plot()", "type": "expression", "loc": [277, 277], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "vector": [8, 3, 0.8244, 0.003, 3, 0.15, 0.0, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pylab.plot( A_noisy[:,0], B_noisy[:,0], 'k.', label='data' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L278_C12", "label": "plot()", "type": "expression", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "vector": [8, 3, 0.8274, 0.003, 3, 0.15, 0.3333, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pylab.plot( A_noisy[ransac_data['inliers'],0], B_noisy[ransac_data['inliers'],0], 'bx', label='RANSAC data' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L280_C12", "label": "plot()", "type": "expression", "loc": [280, 280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "vector": [8, 3, 0.8333, 0.003, 3, 0.15, 0.6667, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pylab.plot( A_noisy[non_outlier_idxs,0], B_noisy[non_outlier_idxs,0], 'k.', label='noisy data' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L281_C12", "label": "plot()", "type": "expression", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "vector": [8, 3, 0.8363, 0.003, 3, 0.15, 1.0, 929, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pylab.plot( A_noisy[outlier_idxs,0], B_noisy[outlier_idxs,0], 'r.', label='outlier data' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L282_C8", "label": "plot()", "type": "expression", "loc": [282, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [8, 2, 0.8423, 0.0089, 2, 0.34, 0.5, 929, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pylab.plot( A_col0_sorted[:,0],\n np.dot(A_col0_sorted,ransac_fit)[:,0],\n label='RANSAC fit' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L285_C8", "label": "plot()", "type": "expression", "loc": [285, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [8, 2, 0.8512, 0.0089, 2, 0.34, 0.625, 929, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pylab.plot( A_col0_sorted[:,0],\n np.dot(A_col0_sorted,perfect_fit)[:,0],\n label='exact system' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L288_C8", "label": "plot()", "type": "expression", "loc": [288, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [8, 2, 0.8601, 0.0089, 2, 0.34, 0.75, 929, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pylab.plot( A_col0_sorted[:,0],\n np.dot(A_col0_sorted,linear_fit)[:,0],\n label='linear fit' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L291_C8", "label": "legend()", "type": "expression", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [8, 2, 0.8661, 0.003, 2, 0.34, 0.875, 880, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pylab.legend()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L292_C8", "label": "show()", "type": "expression", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "vector": [8, 2, 0.869, 0.003, 2, 0.34, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " pylab.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "label": "testPlane", "type": "function", "loc": [295, 307], "level": 0, "parent": null, "vector": [2, 0, 0.8958, 0.0387, 0, 0.66, 0.8182, 980, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "testPlane", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def testPlane():\n\n\n\n debug = True\n model = PlaneLeastSquaresModel(debug)\n data = np.array([[0,0,0],[0,1,0],[0.1,12,0.1],[0,0,12],[1,0,0],[1,2,13]])\n # run RANSAC algorithm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L299_C4", "label": "debug =", "type": "assigned_variable", "loc": [299, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "vector": [14, 1, 0.8899, 0.003, 1, 0.82, 0.0, 924, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " debug = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L300_C4", "label": "model = PlaneLeastSquaresModel()", "type": "assigned_variable", "loc": [300, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "vector": [14, 1, 0.8929, 0.003, 1, 0.82, 0.2, 722, 3, 1, 0, 0, 15, 10, 1], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "PlaneLeastSquaresModel", "annotation": ""}, "snippet": " model = PlaneLeastSquaresModel(debug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L301_C4", "label": "data = array()", "type": "assigned_variable", "loc": [301, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "vector": [14, 1, 0.8958, 0.003, 1, 0.82, 0.4, 929, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " data = np.array([[0,0,0],[0,1,0],[0.1,12,0.1],[0,0,12],[1,0,0],[1,2,13]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L303_C4", "label": "ransac_fit, ransac_data = ransac()", "type": "assigned_variable", "loc": [303, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "vector": [14, 1, 0.9048, 0.0089, 1, 0.82, 0.6, 711, 3, 8, 0, 0, 32, 10, 1], "semantic": {"name": "ransac_fit, ransac_data", "arg_names": [], "import_names": [], "rhs_call_name": "ransac", "annotation": ""}, "snippet": " ransac_fit, ransac_data = ransac(data,model,\n 3, 1000, 1, 2, # misc. parameters\n debug=debug,return_all=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L306_C4", "label": "print()", "type": "expression", "loc": [306, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "vector": [8, 1, 0.9107, 0.003, 1, 0.82, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ransac_fit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L307_C4", "label": "print()", "type": "expression", "loc": [307, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "vector": [8, 1, 0.9137, 0.003, 1, 0.82, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ransac_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "label": "testPlanePointcloud", "type": "function", "loc": [309, 332], "level": 0, "parent": null, "vector": [2, 0, 0.9539, 0.0714, 0, 0.66, 0.9091, 762, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "testPlanePointcloud", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def testPlanePointcloud():\n import processor\n import configuration \n\n cfg = configuration.configuration(TEST_FOLDER)\n #sc = scanner.scanner(cfg)\n pc = processor.processor(cfg)\n #pc.load_data('2009Oct30_162400')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L310_C4", "label": "processor import processor", "type": "import", "loc": [310, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [1, 1, 0.9226, 0.003, 1, 0.62, 0.0, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "processor", "arg_names": [], "import_names": ["processor"], "rhs_call_name": "", "annotation": ""}, "snippet": " import processor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L311_C4", "label": "configuration import configuration", "type": "import", "loc": [311, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [1, 1, 0.9256, 0.003, 1, 0.62, 0.0714, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": " import configuration "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L313_C4", "label": "cfg = configuration()", "type": "assigned_variable", "loc": [313, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [14, 1, 0.9315, 0.003, 1, 0.62, 0.1429, 46, 3, 1, 0, 0, 627, 10, 1], "semantic": {"name": "cfg", "arg_names": [], "import_names": [], "rhs_call_name": "configuration", "annotation": ""}, "snippet": " cfg = configuration.configuration(TEST_FOLDER)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L315_C4", "label": "pc = processor()", "type": "assigned_variable", "loc": [315, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [14, 1, 0.9375, 0.003, 1, 0.62, 0.2143, 876, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "pc", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " pc = processor.processor(cfg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L317_C4", "label": "load_data()", "type": "expression", "loc": [317, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [8, 1, 0.9435, 0.003, 1, 0.62, 0.2857, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " pc.load_data('2009Nov04_141226')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L318_C4", "label": "process_raw_data()", "type": "expression", "loc": [318, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [8, 1, 0.9464, 0.003, 1, 0.62, 0.3571, 553, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "process_raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "process_raw_data", "annotation": ""}, "snippet": " pc.process_raw_data()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L321_C4", "label": "debug =", "type": "assigned_variable", "loc": [321, 321], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [14, 1, 0.9554, 0.003, 1, 0.62, 0.4286, 924, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " debug = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L322_C4", "label": "model = PlaneLeastSquaresModel()", "type": "assigned_variable", "loc": [322, 322], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [14, 1, 0.9583, 0.003, 1, 0.62, 0.5, 722, 3, 1, 0, 0, 15, 10, 1], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "PlaneLeastSquaresModel", "annotation": ""}, "snippet": " model = PlaneLeastSquaresModel(debug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L323_C4", "label": "data =", "type": "assigned_variable", "loc": [323, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [14, 1, 0.9613, 0.003, 1, 0.62, 0.5714, 929, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = np.asarray(pc.pts3d_bound).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L325_C4", "label": "ransac_fit, ransac_data = ransac()", "type": "assigned_variable", "loc": [325, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [14, 1, 0.9702, 0.0089, 1, 0.62, 0.6429, 711, 3, 8, 0, 0, 32, 10, 1], "semantic": {"name": "ransac_fit, ransac_data", "arg_names": [], "import_names": [], "rhs_call_name": "ransac", "annotation": ""}, "snippet": " ransac_fit, ransac_data = ransac(data,model,\n 3, 1000, 0.02, 300, # misc. parameters\n debug=debug,return_all=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L328_C4", "label": "print()", "type": "expression", "loc": [328, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [8, 1, 0.9762, 0.003, 1, 0.62, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ransac_fit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L329_C4", "label": "print()", "type": "expression", "loc": [329, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [8, 1, 0.9792, 0.003, 1, 0.62, 0.7857, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ransac_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L330_C4", "label": "print()", "type": "expression", "loc": [330, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [8, 1, 0.9821, 0.003, 1, 0.62, 0.8571, 535, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('len inlier',len(ransac_data['inliers']),'shape pts',np.shape(pc.pts3d_bound))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L331_C4", "label": "pc.pts3d_bound =", "type": "assigned_variable", "loc": [331, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [14, 1, 0.9851, 0.003, 1, 0.62, 0.9286, 228, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pc.pts3d_bound", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pc.pts3d_bound = pc.pts3d_bound[:,ransac_data['inliers']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L332_C4", "label": "display_3d()", "type": "expression", "loc": [332, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "vector": [8, 1, 0.9881, 0.003, 1, 0.62, 1.0, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "display_3d", "arg_names": [], "import_names": [], "rhs_call_name": "display_3d", "annotation": ""}, "snippet": " pc.display_3d('height')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L334_C0", "label": "if", "type": "if", "loc": [334, 336], "level": 0, "parent": null, "vector": [4, 0, 0.997, 0.0089, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__=='__main__':\n #testPlane()\n testPlanePointcloud()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L336_C4", "label": "testPlanePointcloud()", "type": "expression", "loc": [336, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L334_C0", "vector": [8, 1, 1.0, 0.003, 1, 0.44, 0.0, 762, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "testPlanePointcloud", "arg_names": [], "import_names": [], "rhs_call_name": "testPlanePointcloud", "annotation": ""}, "snippet": " testPlanePointcloud()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:While_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L152_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L153_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L154_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L218_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L277_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L280_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L276_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Import_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L321_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L322_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L323_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L328_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Assign_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:FunctionDef_L309_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99480:If_L334_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99480:Expr_L336_C4"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
class label_object(object):
def __init__(self):
'''
Constructor
'''
self.points = []
self.label = 'object'
def get_points(self):
return self.points
def add_point(self, x):
self.points.append(x)
def set_label(self, label):
self.label = label
def get_label(self):
return self.label
def get_type(self):
if self.label == 'edge' or self.label == 'edge_up' or self.label == 'edge_down':
return 'line'
else:
return 'polygon'
def set_type(self, type):
self.type = type
def delete_last_point(self):
self.points.pop()
def is_empty(self):
return len(self.points)==0 | ajibawa-2023/Python-Code-Large/train/row_99481 | 23 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "label": "label_object", "type": "class", "loc": [29, 67], "level": 0, "parent": null, "vector": [3, 0, 0.7164, 0.5821, 0, 0.66, 0.0, 589, 0, 9, 0, 0, 186, 0, 3], "semantic": {"name": "label_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class label_object(object):\n\n\n def __init__(self):\n '''\n Constructor\n '''\n self.points = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L32_C4", "label": "__init__", "type": "function", "loc": [32, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.5149, 0.0896, 1, 0.07, 0.0, 555, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n '''\n Constructor\n '''\n self.points = []\n self.label = 'object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Expr_L33_C8", "label": "expression", "type": "expression", "loc": [33, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L32_C4", "vector": [8, 2, 0.5075, 0.0448, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Assign_L36_C8", "label": "self.points =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L32_C4", "vector": [14, 2, 0.5373, 0.0149, 2, 0.05, 0.5, 831, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.points = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Assign_L37_C8", "label": "self.label =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L32_C4", "vector": [14, 2, 0.5522, 0.0149, 2, 0.05, 1.0, 51, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.label", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.label = 'object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L40_C4", "label": "get_points", "type": "function", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.6045, 0.0299, 1, 0.07, 0.125, 522, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_points", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_points(self):\n return self.points"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L40_C4", "vector": [13, 2, 0.6119, 0.0149, 2, 0.23, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.points"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L44_C4", "label": "add_point", "type": "function", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.6642, 0.0299, 1, 0.07, 0.25, 692, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_point", "arg_names": ["self", "x"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_point(self, x):\n self.points.append(x) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Expr_L45_C8", "label": "append()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L44_C4", "vector": [8, 2, 0.6716, 0.0149, 2, 0.26, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.points.append(x) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L48_C4", "label": "set_label", "type": "function", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.7239, 0.0299, 1, 0.07, 0.375, 88, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_label", "arg_names": ["self", "label"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_label(self, label):\n self.label = label"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Assign_L49_C8", "label": "self.label =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L48_C4", "vector": [14, 2, 0.7313, 0.0149, 2, 0.0, 0.0, 51, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.label", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.label = label"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L51_C4", "label": "get_label", "type": "function", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.7687, 0.0299, 1, 0.07, 0.5, 305, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_label", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_label(self):\n return self.label "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L52_C8", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L51_C4", "vector": [13, 2, 0.7761, 0.0149, 2, 0.56, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.label "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L54_C4", "label": "get_type", "type": "function", "loc": [54, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.8358, 0.0746, 1, 0.07, 0.625, 606, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_type(self):\n if self.label == 'edge' or self.label == 'edge_up' or self.label == 'edge_down':\n return 'line'\n else:\n return 'polygon'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:If_L55_C8", "label": "if", "type": "if", "loc": [55, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L54_C4", "vector": [4, 2, 0.8433, 0.0597, 2, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.label == 'edge' or self.label == 'edge_up' or self.label == 'edge_down':\n return 'line'\n else:\n return 'polygon'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L56_C12", "label": "return", "type": "return", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:If_L55_C8", "vector": [13, 3, 0.8358, 0.0149, 3, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'line'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L58_C12", "label": "return", "type": "return", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:If_L55_C8", "vector": [13, 3, 0.8657, 0.0149, 3, 0.92, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'polygon'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L60_C4", "label": "set_type", "type": "function", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.903, 0.0299, 1, 0.07, 0.75, 316, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_type", "arg_names": ["self", "type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_type(self, type):\n self.type = type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Assign_L61_C8", "label": "self.type =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L60_C4", "vector": [14, 2, 0.9104, 0.0149, 2, 0.32, 0.0, 398, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.type = type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L63_C4", "label": "delete_last_point", "type": "function", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.9478, 0.0299, 1, 0.07, 0.875, 897, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete_last_point", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete_last_point(self): \n self.points.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Expr_L64_C8", "label": "pop()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L63_C4", "vector": [8, 2, 0.9552, 0.0149, 2, 0.66, 0.0, 969, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.points.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L66_C4", "label": "is_empty", "type": "function", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "vector": [2, 1, 0.9925, 0.0299, 1, 0.07, 1.0, 623, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_empty(self):\n return len(self.points)==0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L66_C4", "vector": [13, 2, 1.0, 0.0149, 2, 0.92, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.points)==0"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:If_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99481:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99481:Return_L67_C8"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import label_object, scan_dataset
import util as ut #Uses: load_pickle, save_pickle, formatted_time
import shutil #file operations
class scans_database(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
self.datasets = []
self.current_index = 0
def load(self, path, filename):
self.filename = filename
self.path = path
#try:
dict = ut.load_pickle(self.path+'/'+self.filename)
#except:
# print 'loading of '+self.path+'/'+filename+' failed. WARNING: it will be overwritten on save()!'
# return
self.datasets = dict['datasets']
def save(self):
dict = {'datasets': self.datasets,'version': 0.1}
#for now: make a backup first:
database_filename = self.path+'/'+self.filename
backup_filename = self.path+'/'+self.filename+'_backup_'+ut.formatted_time()
print 'Backing up old database to ' + backup_filename
shutil.copy(database_filename, backup_filename)
print "Saving: "+database_filename
ut.save_pickle(dict,database_filename)
def get_path(self):
return self.path
def get_dataset(self, index):
self.current_index = index
return self.datasets[index]
def get_dataset_by_id(self, id):
#TODO: faster lookup, probably using a dictionary instead of a list?
for dataset in self.datasets:
if dataset.id == id:
return dataset
return False
def set_internal_pointer_to_dataset(self, id):
self.current_index = 0
for dataset in self.datasets:
if dataset.id == id:
return True
self.current_index += 1
return False
def get_next_dataset(self):
if self.current_index < len(self.datasets) - 1:
self.current_index = self.current_index + 1
return self.datasets[self.current_index]
else:
return False
def get_prev_dataset(self):
if self.current_index > 0:
self.current_index = self.current_index - 1
return self.datasets[self.current_index]
else:
return False
def get_first_dataset(self):
if len(self.datasets) > 0:
self.current_index = 0
return self.datasets[self.current_index]
else:
return False
def get_last_dataset(self):
if len(self.datasets) > 0:
self.current_index = len(self.datasets) - 1
return self.datasets[self.current_index]
else:
return False
def get_count(self):
return len(self.datasets)
def add_dataset(self, dataset):
self.datasets.append(dataset)
def delete_current_dataset(self):
del self.datasets[self.current_index]
dataset = self.get_prev_dataset()
if False != dataset:
return dataset
else:
dataset = self.get_next_dataset()
return dataset #TODO: still fails if there is only one dataset!
def add_attribute_to_every_dataset(self, name):
for dataset in self.datasets:
dataset.dict[name]=''
| ajibawa-2023/Python-Code-Large/train/row_99482 | 71 | 144 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Import_L30_C0", "label": "label_object import label_object, scan_dataset", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.2083, 0.0069, 0, 0.66, 0.0, 589, 0, 2, 0, 0, 589, 0, 0], "semantic": {"name": "label_object", "arg_names": [], "import_names": ["label_object", "scan_dataset"], "rhs_call_name": "", "annotation": ""}, "snippet": "import label_object, scan_dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Import_L31_C0", "label": "util import ut", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.2153, 0.0069, 0, 0.66, 0.3333, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util as ut #Uses: load_pickle, save_pickle, formatted_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Import_L32_C0", "label": "shutil import shutil", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.0069, 0, 0.66, 0.6667, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil #file operations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "label": "scans_database", "type": "class", "loc": [34, 142], "level": 0, "parent": null, "vector": [3, 0, 0.6111, 0.7569, 0, 0.66, 1.0, 332, 0, 15, 0, 0, 186, 0, 14], "semantic": {"name": "scans_database", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class scans_database(object):\n '''\n classdocs\n '''\n\n\n def __init__(self):\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L35_C4", "label": "expression", "type": "expression", "loc": [35, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [8, 1, 0.25, 0.0208, 1, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L40_C4", "label": "__init__", "type": "function", "loc": [40, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.2951, 0.0417, 1, 0.5, 0.0667, 555, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n '''\n Constructor\n '''\n self.datasets = []\n self.current_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L40_C4", "vector": [8, 2, 0.2917, 0.0208, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L44_C8", "label": "self.datasets =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L40_C4", "vector": [14, 2, 0.3056, 0.0069, 2, 0.66, 0.5, 863, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.datasets", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.datasets = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L45_C8", "label": "self.current_index =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L40_C4", "vector": [14, 2, 0.3125, 0.0069, 2, 0.66, 1.0, 214, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.current_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "label": "load", "type": "function", "loc": [48, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.3646, 0.0694, 1, 0.5, 0.1333, 37, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "load", "arg_names": ["self", "path", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def load(self, path, filename):\n self.filename = filename\n self.path = path\n #try:\n dict = ut.load_pickle(self.path+'/'+self.filename)\n #except:\n # print 'loading of '+self.path+'/'+filename+' failed. WARNING: it will be overwritten on save()!'\n # return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L49_C8", "label": "self.filename =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "vector": [14, 2, 0.3403, 0.0069, 2, 0.88, 0.0, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filename = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L50_C8", "label": "self.path =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "vector": [14, 2, 0.3472, 0.0069, 2, 0.88, 0.3333, 425, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.path = path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L52_C8", "label": "dict = load_pickle()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "vector": [14, 2, 0.3611, 0.0069, 2, 0.88, 0.6667, 827, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " dict = ut.load_pickle(self.path+'/'+self.filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L57_C8", "label": "self.datasets =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "vector": [14, 2, 0.3958, 0.0069, 2, 0.88, 1.0, 863, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.datasets", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.datasets = dict['datasets']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "label": "save", "type": "function", "loc": [59, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.4444, 0.0764, 1, 0.5, 0.2, 928, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "save", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self):\n dict = {'datasets': self.datasets,'version': 0.1} \n \n #for now: make a backup first:\n database_filename = self.path+'/'+self.filename\n backup_filename = self.path+'/'+self.filename+'_backup_'+ut.formatted_time()\n print('Backing up old database to ' + backup_filename)\n shutil.copy(database_filename, backup_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L60_C8", "label": "dict =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "vector": [14, 2, 0.4167, 0.0069, 2, 0.51, 0.0, 827, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dict = {'datasets': self.datasets,'version': 0.1} "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L63_C8", "label": "database_filename =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "vector": [14, 2, 0.4375, 0.0069, 2, 0.51, 0.1667, 684, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "database_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " database_filename = self.path+'/'+self.filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L64_C8", "label": "backup_filename =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "vector": [14, 2, 0.4444, 0.0069, 2, 0.51, 0.3333, 71, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "backup_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backup_filename = self.path+'/'+self.filename+'_backup_'+ut.formatted_time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L65_C8", "label": "print()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "vector": [8, 2, 0.4514, 0.0069, 2, 0.51, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Backing up old database to ' + backup_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L66_C8", "label": "copy()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "vector": [8, 2, 0.4583, 0.0069, 2, 0.51, 0.6667, 739, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " shutil.copy(database_filename, backup_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L68_C8", "label": "print()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "vector": [8, 2, 0.4722, 0.0069, 2, 0.51, 0.8333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Saving: \"+database_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L69_C8", "label": "save_pickle()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "vector": [8, 2, 0.4792, 0.0069, 2, 0.51, 1.0, 390, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save_pickle", "arg_names": [], "import_names": [], "rhs_call_name": "save_pickle", "annotation": ""}, "snippet": " ut.save_pickle(dict,database_filename) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L72_C4", "label": "get_path", "type": "function", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.5035, 0.0139, 1, 0.5, 0.2667, 601, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_path", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_path(self):\n return self.path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L73_C8", "label": "return", "type": "return", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L72_C4", "vector": [13, 2, 0.5069, 0.0069, 2, 0.73, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L75_C4", "label": "get_dataset", "type": "function", "loc": [75, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.5278, 0.0208, 1, 0.5, 0.3333, 941, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "get_dataset", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_dataset(self, index):\n self.current_index = index\n return self.datasets[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L76_C8", "label": "self.current_index =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L75_C4", "vector": [14, 2, 0.5278, 0.0069, 2, 0.0, 0.0, 214, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_index = index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L77_C8", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L75_C4", "vector": [13, 2, 0.5347, 0.0069, 2, 0.0, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.datasets[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L79_C4", "label": "get_dataset_by_id", "type": "function", "loc": [79, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.5694, 0.0486, 1, 0.5, 0.4, 514, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "get_dataset_by_id", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_dataset_by_id(self, id):\n #TODO: faster lookup, probably using a dictionary instead of a list?\n \n for dataset in self.datasets:\n if dataset.id == id:\n return dataset\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L82_C8", "label": "for dataset", "type": "for", "loc": [82, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L79_C4", "vector": [6, 2, 0.5764, 0.0208, 2, 0.1, 0.0, 603, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for dataset in self.datasets:\n if dataset.id == id:\n return dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L83_C12", "label": "if", "type": "if", "loc": [83, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L82_C8", "vector": [4, 3, 0.5799, 0.0139, 3, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dataset.id == id:\n return dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L84_C16", "label": "return", "type": "return", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L83_C12", "vector": [13, 4, 0.5833, 0.0069, 4, 0.38, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L79_C4", "vector": [13, 2, 0.5903, 0.0069, 2, 0.1, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L87_C4", "label": "set_internal_pointer_to_dataset", "type": "function", "loc": [87, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.625, 0.0486, 1, 0.5, 0.4667, 775, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "set_internal_pointer_to_dataset", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_internal_pointer_to_dataset(self, id):\n self.current_index = 0\n for dataset in self.datasets:\n if dataset.id == id:\n return True\n self.current_index += 1\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L88_C8", "label": "self.current_index =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L87_C4", "vector": [14, 2, 0.6111, 0.0069, 2, 0.79, 0.0, 214, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.current_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L89_C8", "label": "for dataset", "type": "for", "loc": [89, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L87_C4", "vector": [6, 2, 0.6285, 0.0278, 2, 0.79, 0.5, 603, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for dataset in self.datasets:\n if dataset.id == id:\n return True\n self.current_index += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L90_C12", "label": "if", "type": "if", "loc": [90, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L89_C8", "vector": [4, 3, 0.6285, 0.0139, 3, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dataset.id == id:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L91_C16", "label": "return", "type": "return", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L90_C12", "vector": [13, 4, 0.6319, 0.0069, 4, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L93_C8", "label": "return", "type": "return", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L87_C4", "vector": [13, 2, 0.6458, 0.0069, 2, 0.79, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L95_C4", "label": "get_next_dataset", "type": "function", "loc": [95, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.6771, 0.0417, 1, 0.5, 0.5333, 672, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_next_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_next_dataset(self):\n if self.current_index < len(self.datasets) - 1:\n self.current_index = self.current_index + 1\n return self.datasets[self.current_index]\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L96_C8", "label": "if", "type": "if", "loc": [96, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L95_C4", "vector": [4, 2, 0.6806, 0.0347, 2, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_index < len(self.datasets) - 1:\n self.current_index = self.current_index + 1\n return self.datasets[self.current_index]\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L97_C12", "label": "self.current_index =", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L96_C8", "vector": [14, 3, 0.6736, 0.0069, 3, 0.97, 0.0, 214, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_index = self.current_index + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L98_C12", "label": "return", "type": "return", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L96_C8", "vector": [13, 3, 0.6806, 0.0069, 3, 0.97, 0.5, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.datasets[self.current_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L100_C12", "label": "return", "type": "return", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L96_C8", "vector": [13, 3, 0.6944, 0.0069, 3, 0.97, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L102_C4", "label": "get_prev_dataset", "type": "function", "loc": [102, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.7257, 0.0417, 1, 0.5, 0.6, 58, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_prev_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_prev_dataset(self):\n if self.current_index > 0:\n self.current_index = self.current_index - 1\n return self.datasets[self.current_index]\n else:\n return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L103_C8", "label": "if", "type": "if", "loc": [103, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L102_C4", "vector": [4, 2, 0.7292, 0.0347, 2, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_index > 0:\n self.current_index = self.current_index - 1\n return self.datasets[self.current_index]\n else:\n return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L104_C12", "label": "self.current_index =", "type": "assigned_variable", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L103_C8", "vector": [14, 3, 0.7222, 0.0069, 3, 0.35, 0.0, 214, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_index = self.current_index - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L105_C12", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L103_C8", "vector": [13, 3, 0.7292, 0.0069, 3, 0.35, 0.5, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.datasets[self.current_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L107_C12", "label": "return", "type": "return", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L103_C8", "vector": [13, 3, 0.7431, 0.0069, 3, 0.35, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L109_C4", "label": "get_first_dataset", "type": "function", "loc": [109, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.7743, 0.0417, 1, 0.5, 0.6667, 189, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_first_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_first_dataset(self):\n if len(self.datasets) > 0:\n self.current_index = 0\n return self.datasets[self.current_index]\n else:\n return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L110_C8", "label": "if", "type": "if", "loc": [110, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L109_C4", "vector": [4, 2, 0.7778, 0.0347, 2, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self.datasets) > 0:\n self.current_index = 0\n return self.datasets[self.current_index]\n else:\n return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L111_C12", "label": "self.current_index =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L110_C8", "vector": [14, 3, 0.7708, 0.0069, 3, 0.04, 0.0, 214, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.current_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L112_C12", "label": "return", "type": "return", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L110_C8", "vector": [13, 3, 0.7778, 0.0069, 3, 0.04, 0.5, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.datasets[self.current_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L114_C12", "label": "return", "type": "return", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L110_C8", "vector": [13, 3, 0.7917, 0.0069, 3, 0.04, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L116_C4", "label": "get_last_dataset", "type": "function", "loc": [116, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.8229, 0.0417, 1, 0.5, 0.7333, 863, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_last_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_last_dataset(self):\n if len(self.datasets) > 0:\n self.current_index = len(self.datasets) - 1\n return self.datasets[self.current_index]\n else:\n return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L117_C8", "label": "if", "type": "if", "loc": [117, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L116_C4", "vector": [4, 2, 0.8264, 0.0347, 2, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self.datasets) > 0:\n self.current_index = len(self.datasets) - 1\n return self.datasets[self.current_index]\n else:\n return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L118_C12", "label": "self.current_index =", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L117_C8", "vector": [14, 3, 0.8194, 0.0069, 3, 0.02, 0.0, 214, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.current_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_index = len(self.datasets) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L119_C12", "label": "return", "type": "return", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L117_C8", "vector": [13, 3, 0.8264, 0.0069, 3, 0.02, 0.5, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.datasets[self.current_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L121_C12", "label": "return", "type": "return", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L117_C8", "vector": [13, 3, 0.8403, 0.0069, 3, 0.02, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L124_C4", "label": "get_count", "type": "function", "loc": [124, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.8646, 0.0139, 1, 0.5, 0.8, 338, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_count(self):\n return len(self.datasets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L125_C8", "label": "return", "type": "return", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L124_C4", "vector": [13, 2, 0.8681, 0.0069, 2, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.datasets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L127_C4", "label": "add_dataset", "type": "function", "loc": [127, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.8854, 0.0139, 1, 0.5, 0.8667, 326, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_dataset", "arg_names": ["self", "dataset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_dataset(self, dataset):\n self.datasets.append(dataset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L128_C8", "label": "append()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L127_C4", "vector": [8, 2, 0.8889, 0.0069, 2, 0.26, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.datasets.append(dataset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L130_C4", "label": "delete_current_dataset", "type": "function", "loc": [130, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.9271, 0.0556, 1, 0.5, 0.9333, 145, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "delete_current_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete_current_dataset(self):\n del self.datasets[self.current_index]\n dataset = self.get_prev_dataset()\n if False != dataset:\n return dataset\n else: \n dataset = self.get_next_dataset()\n return dataset #TODO: still fails if there is only one dataset!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L132_C8", "label": "dataset = get_prev_dataset()", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L130_C4", "vector": [14, 2, 0.9167, 0.0069, 2, 0.59, 0.0, 603, 3, 0, 0, 0, 58, 10, 1], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "get_prev_dataset", "annotation": ""}, "snippet": " dataset = self.get_prev_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L133_C8", "label": "if", "type": "if", "loc": [133, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L130_C4", "vector": [4, 2, 0.934, 0.0278, 2, 0.59, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False != dataset:\n return dataset\n else: \n dataset = self.get_next_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L134_C12", "label": "return", "type": "return", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L133_C8", "vector": [13, 3, 0.9306, 0.0069, 3, 0.64, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L136_C12", "label": "dataset = get_next_dataset()", "type": "assigned_variable", "loc": [136, 136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L133_C8", "vector": [14, 3, 0.9444, 0.0069, 3, 0.64, 1.0, 603, 3, 0, 0, 0, 672, 10, 1], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "get_next_dataset", "annotation": ""}, "snippet": " dataset = self.get_next_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L137_C8", "label": "return", "type": "return", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L130_C4", "vector": [13, 2, 0.9514, 0.0069, 2, 0.59, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dataset #TODO: still fails if there is only one dataset!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L140_C4", "label": "add_attribute_to_every_dataset", "type": "function", "loc": [140, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "vector": [2, 1, 0.9792, 0.0208, 1, 0.5, 1.0, 636, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "add_attribute_to_every_dataset", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_attribute_to_every_dataset(self, name):\n for dataset in self.datasets:\n dataset.dict[name]=''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L141_C8", "label": "for dataset", "type": "for", "loc": [141, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L140_C4", "vector": [6, 2, 0.9826, 0.0139, 2, 0.27, 0.0, 603, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for dataset in self.datasets:\n dataset.dict[name]=''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L142_C12", "label": "assign", "type": "assigned_variable", "loc": [142, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L141_C8", "vector": [14, 3, 0.9861, 0.0069, 3, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dataset.dict[name]=''"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L83_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L84_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L90_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Return_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99482:For_L141_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99482:Assign_L142_C12"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
from classifier import classifier
import util as ut #Uses: load_pickle, getTime
import numpy as np
import processor ###
# Other Imports (classify_baseline_code):
# x import hrl_tilting_hokuyo.processing_3d as p3d
# import hrl_tilting_hokuyo.occupancy_grid_3d as og3d [for occupancy_grid_3d()]
# x import hrl_tilting_hokuyo.display_3d_mayavi as d3m
class baseline_classifier(classifier):
'''
classdocs
'''
#def __init__(selfparams):
# '''
# Constructor
# '''
def test(self, feature_data = None):
#test on current scan:
print ut.getTime(), 'test on:', self.processor.scan_dataset.id
if feature_data == None:
filename = self.processor.get_features_filename()
dict = ut.load_pickle(filename)
else:
dict = feature_data
baseline_labels = self.classify_baseline_code()
return baseline_labels, self.test_results(dict, baseline_labels)
def classify_baseline_code(self):
###import hrl_tilting_hokuyo.processing_3d as p3d
###import hrl_tilting_hokuyo.display_3d_mayavi as d3m
import hrl_tilting_hokuyo.occupancy_grid_3d as og3d
pt = np.matrix(self.processor.point_of_interest).T
#define VOI
width_half = self.processor.voi_width / 2.0
brf = pt+np.matrix([-width_half,-width_half,-width_half]).T
tlb = pt+np.matrix([width_half, width_half, width_half]).T
resolution = np.matrix([0.1,0.1,0.0025]).T
max_dist = 15
min_dist = -15
gr = og3d.occupancy_grid_3d(brf,tlb,resolution)
print 'filling grid...'
gr.fill_grid(self.processor.pts3d_bound)
print '...filled.'
gr.to_binary(1)
l = gr.find_plane_indices(assume_plane=True,hmin=0.3,hmax=2)
z_min = min(l)*gr.resolution[2,0]+gr.brf[2,0]
z_max = max(l)*gr.resolution[2,0]+gr.brf[2,0]
pts = np.asarray(self.processor.pts3d_bound)
conditions_surface = np.multiply(pts[2,:] > z_min, pts[2,:] < z_max)
print 'cf',conditions_surface
conditions_clutter = np.invert(conditions_surface)
conditions_surface = np.multiply(conditions_surface, np.array(self.processor.map_polys) > 0)
print 'cf',conditions_surface
idx_surface = np.where(conditions_surface)
conditions_clutter = np.multiply(conditions_clutter, np.array(self.processor.map_polys) > 0)
idx_clutter = np.where(conditions_clutter)
n, m = np.shape(self.processor.pts3d_bound)
print n,m
labels = np.zeros(m)
print np.shape(labels), labels
print np.shape(idx_surface), idx_surface
labels[idx_surface] = processor.LABEL_SURFACE
labels[idx_clutter] = processor.LABEL_CLUTTER
print labels
return labels
| ajibawa-2023/Python-Code-Large/train/row_99483 | 49 | 114 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99483:ImportFrom_L30_C0", "label": "from classifier import classifier", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.2632, 0.0088, 0, 0.66, 0.0, 71, 0, 1, 0, 0, 71, 0, 0], "semantic": {"name": "classifier", "arg_names": [], "import_names": ["classifier"], "rhs_call_name": "", "annotation": ""}, "snippet": "from classifier import classifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Import_L32_C0", "label": "util import ut", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.2807, 0.0088, 0, 0.66, 0.25, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util as ut #Uses: load_pickle, getTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Import_L33_C0", "label": "numpy import np", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.2895, 0.0088, 0, 0.66, 0.5, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Import_L35_C0", "label": "processor import processor", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.307, 0.0088, 0, 0.66, 0.75, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "processor", "arg_names": [], "import_names": ["processor"], "rhs_call_name": "", "annotation": ""}, "snippet": "import processor ###"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:ClassDef_L43_C0", "label": "baseline_classifier", "type": "class", "loc": [43, 112], "level": 0, "parent": null, "vector": [3, 0, 0.6798, 0.614, 0, 0.66, 1.0, 700, 0, 2, 0, 0, 71, 0, 37], "semantic": {"name": "baseline_classifier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class baseline_classifier(classifier):\n '''\n classdocs\n '''\n\n\n #def __init__(selfparams):\n # '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:ClassDef_L43_C0", "vector": [8, 1, 0.3947, 0.0263, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "label": "test", "type": "function", "loc": [55, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:ClassDef_L43_C0", "vector": [2, 1, 0.5351, 0.114, 1, 0.09, 0.5, 224, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "test", "arg_names": ["self", "feature_data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test(self, feature_data = None):\n #test on current scan:\n print(ut.getTime(), 'test on:', self.processor.scan_dataset.id)\n \n if feature_data == None:\n filename = self.processor.get_features_filename()\n dict = ut.load_pickle(filename)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L57_C8", "label": "print()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "vector": [8, 2, 0.5, 0.0088, 2, 0.64, 0.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'test on:', self.processor.scan_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:If_L59_C8", "label": "if", "type": "if", "loc": [59, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "vector": [4, 2, 0.5351, 0.0439, 2, 0.64, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if feature_data == None:\n filename = self.processor.get_features_filename()\n dict = ut.load_pickle(filename)\n else:\n dict = feature_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L60_C12", "label": "filename = get_features_filename()", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:If_L59_C8", "vector": [14, 3, 0.5263, 0.0088, 3, 0.89, 0.0, 275, 3, 0, 0, 0, 49, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "get_features_filename", "annotation": ""}, "snippet": " filename = self.processor.get_features_filename()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L61_C12", "label": "dict = load_pickle()", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:If_L59_C8", "vector": [14, 3, 0.5351, 0.0088, 3, 0.89, 0.5, 827, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " dict = ut.load_pickle(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L63_C12", "label": "dict =", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:If_L59_C8", "vector": [14, 3, 0.5526, 0.0088, 3, 0.89, 1.0, 827, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dict = feature_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L65_C8", "label": "baseline_labels = classify_baseline_code()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "vector": [14, 2, 0.5702, 0.0088, 2, 0.64, 0.6667, 85, 3, 0, 0, 0, 822, 10, 1], "semantic": {"name": "baseline_labels", "arg_names": [], "import_names": [], "rhs_call_name": "classify_baseline_code", "annotation": ""}, "snippet": " baseline_labels = self.classify_baseline_code()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "vector": [13, 2, 0.5877, 0.0088, 2, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return baseline_labels, self.test_results(dict, baseline_labels) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "label": "classify_baseline_code", "type": "function", "loc": [70, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:ClassDef_L43_C0", "vector": [2, 1, 0.7982, 0.3772, 1, 0.09, 1.0, 822, 0, 1, 1, 0, 0, 0, 31], "semantic": {"name": "classify_baseline_code", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def classify_baseline_code(self):\n ###import hrl_tilting_hokuyo.processing_3d as p3d\n ###import hrl_tilting_hokuyo.display_3d_mayavi as d3m\n import hrl_tilting_hokuyo.occupancy_grid_3d as og3d\n\n pt = np.matrix(self.processor.point_of_interest).T\n #define VOI\n width_half = self.processor.voi_width / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Import_L73_C8", "label": "hrl_tilting_hokuyo.occupancy_grid_3d import og3d", "type": "import", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [1, 2, 0.6404, 0.0088, 2, 0.19, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "hrl_tilting_hokuyo.occupancy_grid_3d", "arg_names": [], "import_names": ["og3d"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hrl_tilting_hokuyo.occupancy_grid_3d as og3d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L75_C8", "label": "pt =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.6579, 0.0088, 2, 0.19, 0.0303, 989, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pt = np.matrix(self.processor.point_of_interest).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L77_C8", "label": "width_half =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.6754, 0.0088, 2, 0.19, 0.0606, 821, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "width_half", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width_half = self.processor.voi_width / 2.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L78_C8", "label": "brf =", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.6842, 0.0088, 2, 0.19, 0.0909, 17, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "brf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " brf = pt+np.matrix([-width_half,-width_half,-width_half]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L79_C8", "label": "tlb =", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.693, 0.0088, 2, 0.19, 0.1212, 90, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tlb", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tlb = pt+np.matrix([width_half, width_half, width_half]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L80_C8", "label": "resolution =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.7018, 0.0088, 2, 0.19, 0.1515, 615, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "resolution", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resolution = np.matrix([0.1,0.1,0.0025]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L81_C8", "label": "max_dist =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.7105, 0.0088, 2, 0.19, 0.1818, 822, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "max_dist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_dist = 15"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L82_C8", "label": "min_dist =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.7193, 0.0088, 2, 0.19, 0.2121, 109, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "min_dist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " min_dist = -15"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L83_C8", "label": "gr = occupancy_grid_3d()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.7281, 0.0088, 2, 0.19, 0.2424, 8, 3, 3, 0, 0, 222, 10, 1], "semantic": {"name": "gr", "arg_names": [], "import_names": [], "rhs_call_name": "occupancy_grid_3d", "annotation": ""}, "snippet": " gr = og3d.occupancy_grid_3d(brf,tlb,resolution)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L84_C8", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.7368, 0.0088, 2, 0.19, 0.2727, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('filling grid...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L85_C8", "label": "fill_grid()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.7456, 0.0088, 2, 0.19, 0.303, 619, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "fill_grid", "arg_names": [], "import_names": [], "rhs_call_name": "fill_grid", "annotation": ""}, "snippet": " gr.fill_grid(self.processor.pts3d_bound)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L86_C8", "label": "print()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.7544, 0.0088, 2, 0.19, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('...filled.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L87_C8", "label": "to_binary()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.7632, 0.0088, 2, 0.19, 0.3636, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "to_binary", "arg_names": [], "import_names": [], "rhs_call_name": "to_binary", "annotation": ""}, "snippet": " gr.to_binary(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L88_C8", "label": "l = find_plane_indices()", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.7719, 0.0088, 2, 0.19, 0.3939, 810, 3, 3, 0, 0, 383, 10, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "find_plane_indices", "annotation": ""}, "snippet": " l = gr.find_plane_indices(assume_plane=True,hmin=0.3,hmax=2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L89_C8", "label": "z_min =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.7807, 0.0088, 2, 0.19, 0.4242, 566, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "z_min", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " z_min = min(l)*gr.resolution[2,0]+gr.brf[2,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L90_C8", "label": "z_max =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.7895, 0.0088, 2, 0.19, 0.4545, 465, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "z_max", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " z_max = max(l)*gr.resolution[2,0]+gr.brf[2,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L92_C8", "label": "pts = asarray()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.807, 0.0088, 2, 0.19, 0.4848, 195, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " pts = np.asarray(self.processor.pts3d_bound)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L93_C8", "label": "conditions_surface = multiply()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.8158, 0.0088, 2, 0.19, 0.5152, 692, 3, 2, 0, 0, 960, 10, 1], "semantic": {"name": "conditions_surface", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " conditions_surface = np.multiply(pts[2,:] > z_min, pts[2,:] < z_max)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L94_C8", "label": "print()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.8246, 0.0088, 2, 0.19, 0.5455, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('cf',conditions_surface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L95_C8", "label": "conditions_clutter = invert()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.8333, 0.0088, 2, 0.19, 0.5758, 955, 3, 1, 0, 0, 317, 10, 1], "semantic": {"name": "conditions_clutter", "arg_names": [], "import_names": [], "rhs_call_name": "invert", "annotation": ""}, "snippet": " conditions_clutter = np.invert(conditions_surface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L96_C8", "label": "conditions_surface = multiply()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.8421, 0.0088, 2, 0.19, 0.6061, 692, 3, 2, 0, 0, 960, 10, 2], "semantic": {"name": "conditions_surface", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " conditions_surface = np.multiply(conditions_surface, np.array(self.processor.map_polys) > 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L97_C8", "label": "print()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.8509, 0.0088, 2, 0.19, 0.6364, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('cf',conditions_surface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L98_C8", "label": "idx_surface = where()", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.8596, 0.0088, 2, 0.19, 0.6667, 729, 3, 1, 0, 0, 169, 10, 1], "semantic": {"name": "idx_surface", "arg_names": [], "import_names": [], "rhs_call_name": "where", "annotation": ""}, "snippet": " idx_surface = np.where(conditions_surface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L99_C8", "label": "conditions_clutter = multiply()", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.8684, 0.0088, 2, 0.19, 0.697, 955, 3, 2, 0, 0, 960, 10, 2], "semantic": {"name": "conditions_clutter", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " conditions_clutter = np.multiply(conditions_clutter, np.array(self.processor.map_polys) > 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L100_C8", "label": "idx_clutter = where()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.8772, 0.0088, 2, 0.19, 0.7273, 566, 3, 1, 0, 0, 169, 10, 1], "semantic": {"name": "idx_clutter", "arg_names": [], "import_names": [], "rhs_call_name": "where", "annotation": ""}, "snippet": " idx_clutter = np.where(conditions_clutter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L102_C8", "label": "n, m = shape()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.8947, 0.0088, 2, 0.19, 0.7576, 51, 3, 1, 0, 0, 381, 10, 1], "semantic": {"name": "n, m", "arg_names": [], "import_names": [], "rhs_call_name": "shape", "annotation": ""}, "snippet": " n, m = np.shape(self.processor.pts3d_bound)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L103_C8", "label": "print()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.9035, 0.0088, 2, 0.19, 0.7879, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(n,m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L104_C8", "label": "labels = zeros()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.9123, 0.0088, 2, 0.19, 0.8182, 283, 3, 1, 0, 0, 213, 10, 1], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "zeros", "annotation": ""}, "snippet": " labels = np.zeros(m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L105_C8", "label": "print()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.9211, 0.0088, 2, 0.19, 0.8485, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(np.shape(labels), labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L106_C8", "label": "print()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.9298, 0.0088, 2, 0.19, 0.8788, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(np.shape(idx_surface), idx_surface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L107_C8", "label": "assign", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.9386, 0.0088, 2, 0.19, 0.9091, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " labels[idx_surface] = processor.LABEL_SURFACE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L108_C8", "label": "assign", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [14, 2, 0.9474, 0.0088, 2, 0.19, 0.9394, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " labels[idx_clutter] = processor.LABEL_CLUTTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L110_C8", "label": "print()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [8, 2, 0.9649, 0.0088, 2, 0.19, 0.9697, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99483:Return_L112_C8", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "vector": [13, 2, 0.9825, 0.0088, 2, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return labels "}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99483:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Return_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Import_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99483:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99483:Return_L112_C8"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
class features(object):
'''
classdocs
'''
processor = None
def __init__(self,processor):
'''
Constructor
'''
self.processor = processor
def get_indexvector(self):
return None
#get the feature vector for a specific point
def get_featurevector(self):
return None
def prepare(self, features_k_nearest_neighbors):
return None
| ajibawa-2023/Python-Code-Large/train/row_99484 | 12 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "label": "features", "type": "class", "loc": [29, 53], "level": 0, "parent": null, "vector": [3, 0, 0.7593, 0.463, 0, 0.66, 0.0, 479, 0, 4, 0, 0, 186, 0, 0], "semantic": {"name": "features", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class features(object):\n '''\n classdocs\n '''\n\n\n processor = None\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:Expr_L30_C4", "label": "expression", "type": "expression", "loc": [30, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "vector": [8, 1, 0.5741, 0.0556, 1, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:Assign_L35_C4", "label": "processor =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "vector": [14, 1, 0.6481, 0.0185, 1, 0.6, 0.2, 177, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "processor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " processor = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L37_C4", "label": "__init__", "type": "function", "loc": [37, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "vector": [2, 1, 0.7222, 0.0926, 1, 0.6, 0.4, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "processor"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,processor):\n '''\n Constructor\n '''\n self.processor = processor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:Expr_L38_C8", "label": "expression", "type": "expression", "loc": [38, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L37_C4", "vector": [8, 2, 0.7222, 0.0556, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:Assign_L41_C8", "label": "self.processor =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L37_C4", "vector": [14, 2, 0.7593, 0.0185, 2, 0.38, 1.0, 855, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.processor = processor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L44_C4", "label": "get_indexvector", "type": "function", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "vector": [2, 1, 0.8241, 0.037, 1, 0.6, 0.6, 770, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_indexvector", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_indexvector(self):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:Return_L45_C8", "label": "return", "type": "return", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L44_C4", "vector": [13, 2, 0.8333, 0.0185, 2, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L49_C4", "label": "get_featurevector", "type": "function", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "vector": [2, 1, 0.9167, 0.037, 1, 0.6, 0.8, 16, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_featurevector", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_featurevector(self):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:Return_L50_C8", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L49_C4", "vector": [13, 2, 0.9259, 0.0185, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L52_C4", "label": "prepare", "type": "function", "loc": [52, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "vector": [2, 1, 0.9722, 0.037, 1, 0.6, 1.0, 556, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "prepare", "arg_names": ["self", "features_k_nearest_neighbors"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prepare(self, features_k_nearest_neighbors):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99484:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L52_C4", "vector": [13, 2, 0.9815, 0.0185, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:Return_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:Return_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99484:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99484:Return_L53_C8"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import numpy as np, math
import roslib; roslib.load_manifest('hrl_lib')
import hrl_lib.transforms as tr
def residualXform( residuals ):
'''
residuals are np.array([ Rz2, Rx, Rz1, dx, dy, dz ])
returns rotResid, dispResid
'''
rotResid = tr.Rz( residuals[0] ) * tr.Rx( residuals[1] ) * tr.Rz( residuals[2] )
dispResid = np.matrix([ residuals[3], residuals[4], residuals[5] ]).T
return rotResid, dispResid
def camTlaser( res = np.zeros(7) ):
# @ Duke, res = np.array([0.8, 0.9, -1.7, 3.1, 0.061, 0.032, -0.035 ])
rot = tr.Ry( math.radians( 0.0 + res[0] )) * tr.Rz( math.radians( 0.0 + res[1] )) * tr.Rx( math.radians( -90.0 + res[2] )) * tr.Rz( math.radians( -90.0 + res[3]))
disp = np.matrix([ res[4], res[5], res[6] ]).T + np.matrix([ 0.0, 0.0, 0.0 ]).T
return tr.composeHomogeneousTransform(rot, disp)
def rollTtool_pointer( residuals = np.zeros(6) ):
rotResid, dispResid = residualXform( residuals )
rot = rotResid * tr.Rz( math.radians( -10.0 ))
disp = dispResid + np.matrix([ 0.008, 0.0, 0.0 ]).T
return tr.composeHomogeneousTransform(rot, disp)
def rollTtool_MA( residuals = np.zeros(6) ):
rotResid, dispResid = residualXform( residuals )
rot = rotResid * tr.Ry( math.radians( -90.0 ))
disp = dispResid + np.matrix([ 0.0476, 0.0, 0.0 ]).T
return tr.composeHomogeneousTransform(rot, disp)
def panTroll(rollAng, residuals = np.zeros(6) ):
rotResid, dispResid = residualXform( residuals )
rot = rotResid * tr.Rx( -1.0 * rollAng )
disp = dispResid + np.matrix([0.02021, 0.0, 0.04236 ]).T
return tr.composeHomogeneousTransform(rot, disp)
def tiltTpan(panAng, residuals = np.zeros(6) ):
rotResid, dispResid = residualXform( residuals )
rot = rotResid * tr.Rz( -1.0 * panAng )
disp = dispResid + np.matrix([ 0.07124, 0.0, 0.02243 ]).T
return tr.composeHomogeneousTransform(rot, disp)
def laserTtilt(tiltAng, residuals = np.zeros(6) ):
rotResid, dispResid = residualXform( residuals )
rot = rotResid * tr.Ry( +1.0 * tiltAng )
disp = dispResid + np.matrix([ 0.03354, 0.0, 0.23669 ]).T
return tr.composeHomogeneousTransform(rot, disp)
def laserTtool_pointer(rollAng, panAng, tiltAng, residuals = np.zeros([4,6])):
'''
This is specifically for the off-axis laser pointer! Tool coordinate frame will change for each tool.
Here, residuals are 4x6 array where:
res[0] = rollTtool
res[1] = panTroll
res[2] = tiltTpan
res[3] = laserTtilt
'''
res = residuals
return laserTtilt(tiltAng, res[3] ) * tiltTpan(panAng, res[2] ) * panTroll(rollAng, res[1] ) * rollTtool_pointer(res[0])
def tool_pointerTlaser(rollAng, panAng, tiltAng, residuals = np.zeros([4,6])):
return tr.invertHomogeneousTransform( laserTtool_pointer(rollAng, panAng, tiltAng, residuals) )
def laserTtool_MA(rollAng, panAng, tiltAng, residuals = np.zeros([4,6])):
'''
This is specifically for the multi-antenna (MA) tool attachment! Tool coordinate frame will change for each tool.
Here, residuals are 4x6 array where:
res[0] = rollTtool
res[1] = panTroll
res[2] = tiltTpan
res[3] = laserTtilt
'''
res = residuals
return laserTtilt(tiltAng, res[3] ) * tiltTpan(panAng, res[2] ) * panTroll(rollAng, res[1] ) * rollTtool_MA(res[0])
def tool_MATlaser(rollAng, panAng, tiltAng, residuals = np.zeros([4,6])):
return tr.invertHomogeneousTransform( laserTtool_MA(rollAng, panAng, tiltAng, residuals) )
| ajibawa-2023/Python-Code-Large/train/row_99485 | 50 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Import_L28_C0", "label": "numpy import np, math", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.2545, 0.0091, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Import_L29_C0", "label": "roslib import roslib", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.2636, 0.0091, 0, 0.66, 0.0714, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Expr_L29_C15", "label": "load_manifest()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.2636, 0.0091, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hrl_lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Import_L30_C0", "label": "hrl_lib.transforms import tr", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.2727, 0.0091, 0, 0.66, 0.2143, 82, 0, 1, 0, 0, 82, 0, 0], "semantic": {"name": "hrl_lib.transforms", "arg_names": [], "import_names": ["tr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.transforms as tr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "label": "residualXform", "type": "function", "loc": [34, 41], "level": 0, "parent": null, "vector": [2, 0, 0.3409, 0.0727, 0, 0.66, 0.2857, 522, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "residualXform", "arg_names": ["residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def residualXform( residuals ):\n '''\n residuals are np.array([ Rz2, Rx, Rz1, dx, dy, dz ])\n returns rotResid, dispResid\n '''\n rotResid = tr.Rz( residuals[0] ) * tr.Rx( residuals[1] ) * tr.Rz( residuals[2] )\n dispResid = np.matrix([ residuals[3], residuals[4], residuals[5] ]).T\n return rotResid, dispResid "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Expr_L35_C4", "label": "expression", "type": "expression", "loc": [35, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "vector": [8, 1, 0.3318, 0.0364, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n residuals are np.array([ Rz2, Rx, Rz1, dx, dy, dz ])\n returns rotResid, dispResid\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L39_C4", "label": "rotResid =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "vector": [14, 1, 0.3545, 0.0091, 1, 0.73, 0.3333, 64, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "rotResid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rotResid = tr.Rz( residuals[0] ) * tr.Rx( residuals[1] ) * tr.Rz( residuals[2] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L40_C4", "label": "dispResid =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "vector": [14, 1, 0.3636, 0.0091, 1, 0.73, 0.6667, 207, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dispResid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dispResid = np.matrix([ residuals[3], residuals[4], residuals[5] ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L41_C4", "label": "return", "type": "return", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "vector": [13, 1, 0.3727, 0.0091, 1, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rotResid, dispResid "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L43_C0", "label": "camTlaser", "type": "function", "loc": [43, 47], "level": 0, "parent": null, "vector": [2, 0, 0.4091, 0.0455, 0, 0.66, 0.3571, 184, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "camTlaser", "arg_names": ["res"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def camTlaser( res = np.zeros(7) ):\n # @ Duke, res = np.array([0.8, 0.9, -1.7, 3.1, 0.061, 0.032, -0.035 ])\n rot = tr.Ry( math.radians( 0.0 + res[0] )) * tr.Rz( math.radians( 0.0 + res[1] )) * tr.Rx( math.radians( -90.0 + res[2] )) * tr.Rz( math.radians( -90.0 + res[3]))\n disp = np.matrix([ res[4], res[5], res[6] ]).T + np.matrix([ 0.0, 0.0, 0.0 ]).T\n return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L45_C4", "label": "rot =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L43_C0", "vector": [14, 1, 0.4091, 0.0091, 1, 0.25, 0.0, 812, 4, 0, 0, 0, 0, 0, 8], "semantic": {"name": "rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rot = tr.Ry( math.radians( 0.0 + res[0] )) * tr.Rz( math.radians( 0.0 + res[1] )) * tr.Rx( math.radians( -90.0 + res[2] )) * tr.Rz( math.radians( -90.0 + res[3]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L46_C4", "label": "disp =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L43_C0", "vector": [14, 1, 0.4182, 0.0091, 1, 0.25, 0.5, 654, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "disp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " disp = np.matrix([ res[4], res[5], res[6] ]).T + np.matrix([ 0.0, 0.0, 0.0 ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L43_C0", "vector": [13, 1, 0.4273, 0.0091, 1, 0.25, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "label": "rollTtool_pointer", "type": "function", "loc": [49, 53], "level": 0, "parent": null, "vector": [2, 0, 0.4636, 0.0455, 0, 0.66, 0.4286, 452, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "rollTtool_pointer", "arg_names": ["residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def rollTtool_pointer( residuals = np.zeros(6) ):\n rotResid, dispResid = residualXform( residuals )\n rot = rotResid * tr.Rz( math.radians( -10.0 ))\n disp = dispResid + np.matrix([ 0.008, 0.0, 0.0 ]).T\n return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L50_C4", "label": "rotResid, dispResid = residualXform()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "vector": [14, 1, 0.4545, 0.0091, 1, 0.88, 0.0, 134, 3, 1, 0, 0, 522, 10, 1], "semantic": {"name": "rotResid, dispResid", "arg_names": [], "import_names": [], "rhs_call_name": "residualXform", "annotation": ""}, "snippet": " rotResid, dispResid = residualXform( residuals )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L51_C4", "label": "rot =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "vector": [14, 1, 0.4636, 0.0091, 1, 0.88, 0.3333, 812, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rot = rotResid * tr.Rz( math.radians( -10.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L52_C4", "label": "disp =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "vector": [14, 1, 0.4727, 0.0091, 1, 0.88, 0.6667, 654, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " disp = dispResid + np.matrix([ 0.008, 0.0, 0.0 ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L53_C4", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "vector": [13, 1, 0.4818, 0.0091, 1, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "label": "rollTtool_MA", "type": "function", "loc": [55, 59], "level": 0, "parent": null, "vector": [2, 0, 0.5182, 0.0455, 0, 0.66, 0.5, 485, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "rollTtool_MA", "arg_names": ["residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def rollTtool_MA( residuals = np.zeros(6) ):\n rotResid, dispResid = residualXform( residuals )\n rot = rotResid * tr.Ry( math.radians( -90.0 ))\n disp = dispResid + np.matrix([ 0.0476, 0.0, 0.0 ]).T\n return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L56_C4", "label": "rotResid, dispResid = residualXform()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "vector": [14, 1, 0.5091, 0.0091, 1, 0.64, 0.0, 134, 3, 1, 0, 0, 522, 10, 1], "semantic": {"name": "rotResid, dispResid", "arg_names": [], "import_names": [], "rhs_call_name": "residualXform", "annotation": ""}, "snippet": " rotResid, dispResid = residualXform( residuals )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L57_C4", "label": "rot =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "vector": [14, 1, 0.5182, 0.0091, 1, 0.64, 0.3333, 812, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rot = rotResid * tr.Ry( math.radians( -90.0 ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L58_C4", "label": "disp =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "vector": [14, 1, 0.5273, 0.0091, 1, 0.64, 0.6667, 654, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " disp = dispResid + np.matrix([ 0.0476, 0.0, 0.0 ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L59_C4", "label": "return", "type": "return", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "vector": [13, 1, 0.5364, 0.0091, 1, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "label": "panTroll", "type": "function", "loc": [62, 66], "level": 0, "parent": null, "vector": [2, 0, 0.5818, 0.0455, 0, 0.66, 0.5714, 892, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "panTroll", "arg_names": ["rollAng", "residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def panTroll(rollAng, residuals = np.zeros(6) ):\n rotResid, dispResid = residualXform( residuals )\n rot = rotResid * tr.Rx( -1.0 * rollAng )\n disp = dispResid + np.matrix([0.02021, 0.0, 0.04236 ]).T\n return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L63_C4", "label": "rotResid, dispResid = residualXform()", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "vector": [14, 1, 0.5727, 0.0091, 1, 0.66, 0.0, 134, 3, 1, 0, 0, 522, 10, 1], "semantic": {"name": "rotResid, dispResid", "arg_names": [], "import_names": [], "rhs_call_name": "residualXform", "annotation": ""}, "snippet": " rotResid, dispResid = residualXform( residuals )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L64_C4", "label": "rot =", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "vector": [14, 1, 0.5818, 0.0091, 1, 0.66, 0.3333, 812, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rot = rotResid * tr.Rx( -1.0 * rollAng )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L65_C4", "label": "disp =", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "vector": [14, 1, 0.5909, 0.0091, 1, 0.66, 0.6667, 654, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " disp = dispResid + np.matrix([0.02021, 0.0, 0.04236 ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L66_C4", "label": "return", "type": "return", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "vector": [13, 1, 0.6, 0.0091, 1, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "label": "tiltTpan", "type": "function", "loc": [68, 72], "level": 0, "parent": null, "vector": [2, 0, 0.6364, 0.0455, 0, 0.66, 0.6429, 119, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "tiltTpan", "arg_names": ["panAng", "residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def tiltTpan(panAng, residuals = np.zeros(6) ):\n rotResid, dispResid = residualXform( residuals )\n rot = rotResid * tr.Rz( -1.0 * panAng )\n disp = dispResid + np.matrix([ 0.07124, 0.0, 0.02243 ]).T\n return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L69_C4", "label": "rotResid, dispResid = residualXform()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "vector": [14, 1, 0.6273, 0.0091, 1, 0.08, 0.0, 134, 3, 1, 0, 0, 522, 10, 1], "semantic": {"name": "rotResid, dispResid", "arg_names": [], "import_names": [], "rhs_call_name": "residualXform", "annotation": ""}, "snippet": " rotResid, dispResid = residualXform( residuals )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L70_C4", "label": "rot =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "vector": [14, 1, 0.6364, 0.0091, 1, 0.08, 0.3333, 812, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rot = rotResid * tr.Rz( -1.0 * panAng )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L71_C4", "label": "disp =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "vector": [14, 1, 0.6455, 0.0091, 1, 0.08, 0.6667, 654, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " disp = dispResid + np.matrix([ 0.07124, 0.0, 0.02243 ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L72_C4", "label": "return", "type": "return", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "vector": [13, 1, 0.6545, 0.0091, 1, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "label": "laserTtilt", "type": "function", "loc": [74, 78], "level": 0, "parent": null, "vector": [2, 0, 0.6909, 0.0455, 0, 0.66, 0.7143, 724, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "laserTtilt", "arg_names": ["tiltAng", "residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def laserTtilt(tiltAng, residuals = np.zeros(6) ):\n rotResid, dispResid = residualXform( residuals )\n rot = rotResid * tr.Ry( +1.0 * tiltAng )\n disp = dispResid + np.matrix([ 0.03354, 0.0, 0.23669 ]).T\n return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L75_C4", "label": "rotResid, dispResid = residualXform()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "vector": [14, 1, 0.6818, 0.0091, 1, 0.78, 0.0, 134, 3, 1, 0, 0, 522, 10, 1], "semantic": {"name": "rotResid, dispResid", "arg_names": [], "import_names": [], "rhs_call_name": "residualXform", "annotation": ""}, "snippet": " rotResid, dispResid = residualXform( residuals )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L76_C4", "label": "rot =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "vector": [14, 1, 0.6909, 0.0091, 1, 0.78, 0.3333, 812, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "rot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rot = rotResid * tr.Ry( +1.0 * tiltAng )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L77_C4", "label": "disp =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "vector": [14, 1, 0.7, 0.0091, 1, 0.78, 0.6667, 654, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " disp = dispResid + np.matrix([ 0.03354, 0.0, 0.23669 ]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L78_C4", "label": "return", "type": "return", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "vector": [13, 1, 0.7091, 0.0091, 1, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tr.composeHomogeneousTransform(rot, disp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L80_C0", "label": "laserTtool_pointer", "type": "function", "loc": [80, 90], "level": 0, "parent": null, "vector": [2, 0, 0.7727, 0.1, 0, 0.66, 0.7857, 594, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "laserTtool_pointer", "arg_names": ["rollAng", "panAng", "tiltAng", "residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def laserTtool_pointer(rollAng, panAng, tiltAng, residuals = np.zeros([4,6])):\n '''\n This is specifically for the off-axis laser pointer! Tool coordinate frame will change for each tool.\n Here, residuals are 4x6 array where:\n res[0] = rollTtool\n res[1] = panTroll\n res[2] = tiltTpan\n res[3] = laserTtilt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Expr_L81_C4", "label": "expression", "type": "expression", "loc": [81, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L80_C0", "vector": [8, 1, 0.7682, 0.0727, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n This is specifically for the off-axis laser pointer! Tool coordinate frame will change for each tool.\n Here, residuals are 4x6 array where:\n res[0] = rollTtool\n res[1] = panTroll\n res[2] = tiltTpan\n res[3] = laserTtilt\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L89_C4", "label": "res =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L80_C0", "vector": [14, 1, 0.8091, 0.0091, 1, 0.81, 0.5, 413, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = residuals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L90_C4", "label": "return", "type": "return", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L80_C0", "vector": [13, 1, 0.8182, 0.0091, 1, 0.81, 1.0, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return laserTtilt(tiltAng, res[3] ) * tiltTpan(panAng, res[2] ) * panTroll(rollAng, res[1] ) * rollTtool_pointer(res[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L92_C0", "label": "tool_pointerTlaser", "type": "function", "loc": [92, 93], "level": 0, "parent": null, "vector": [2, 0, 0.8409, 0.0182, 0, 0.66, 0.8571, 212, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "tool_pointerTlaser", "arg_names": ["rollAng", "panAng", "tiltAng", "residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def tool_pointerTlaser(rollAng, panAng, tiltAng, residuals = np.zeros([4,6])):\n return tr.invertHomogeneousTransform( laserTtool_pointer(rollAng, panAng, tiltAng, residuals) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L92_C0", "vector": [13, 1, 0.8455, 0.0091, 1, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tr.invertHomogeneousTransform( laserTtool_pointer(rollAng, panAng, tiltAng, residuals) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L96_C0", "label": "laserTtool_MA", "type": "function", "loc": [96, 106], "level": 0, "parent": null, "vector": [2, 0, 0.9182, 0.1, 0, 0.66, 0.9286, 893, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "laserTtool_MA", "arg_names": ["rollAng", "panAng", "tiltAng", "residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def laserTtool_MA(rollAng, panAng, tiltAng, residuals = np.zeros([4,6])):\n '''\n This is specifically for the multi-antenna (MA) tool attachment! Tool coordinate frame will change for each tool.\n Here, residuals are 4x6 array where:\n res[0] = rollTtool\n res[1] = panTroll\n res[2] = tiltTpan\n res[3] = laserTtilt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Expr_L97_C4", "label": "expression", "type": "expression", "loc": [97, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L96_C0", "vector": [8, 1, 0.9136, 0.0727, 1, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n This is specifically for the multi-antenna (MA) tool attachment! Tool coordinate frame will change for each tool.\n Here, residuals are 4x6 array where:\n res[0] = rollTtool\n res[1] = panTroll\n res[2] = tiltTpan\n res[3] = laserTtilt\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L105_C4", "label": "res =", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L96_C0", "vector": [14, 1, 0.9545, 0.0091, 1, 0.18, 0.5, 413, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = residuals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L106_C4", "label": "return", "type": "return", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L96_C0", "vector": [13, 1, 0.9636, 0.0091, 1, 0.18, 1.0, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return laserTtilt(tiltAng, res[3] ) * tiltTpan(panAng, res[2] ) * panTroll(rollAng, res[1] ) * rollTtool_MA(res[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L108_C0", "label": "tool_MATlaser", "type": "function", "loc": [108, 109], "level": 0, "parent": null, "vector": [2, 0, 0.9864, 0.0182, 0, 0.66, 1.0, 62, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "tool_MATlaser", "arg_names": ["rollAng", "panAng", "tiltAng", "residuals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def tool_MATlaser(rollAng, panAng, tiltAng, residuals = np.zeros([4,6])):\n return tr.invertHomogeneousTransform( laserTtool_MA(rollAng, panAng, tiltAng, residuals) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L109_C4", "label": "return", "type": "return", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L108_C0", "vector": [13, 1, 0.9909, 0.0091, 1, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tr.invertHomogeneousTransform( laserTtool_MA(rollAng, panAng, tiltAng, residuals) )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99485:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99485:Return_L109_C4"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import numpy as np,math
import roslib; roslib.load_manifest('tf')
from tf import transformations
# Optional imports below:
# import scanr_transforms as trs [for camTlaser(cam_vec) , when "DesktopScanner"]
# x import codyRobot_camera_config as cc [for camera properties when "CodyRobot"]
# WARNING: THE "PR2" configurations are for a fixed demo setup. Actual values are
# populated by "acquire_pr2_data.py", or something similar
class configuration(object):
'''
Define camera properties matrix: fx, fy, and optical center in x,y
Define rotation/translation matrix between camera origin and laser cloud origin
Three types of robot/device accepted:
"desktopScanner" -- used to collect dataset of tablescans
"codyRobot" -- demonstrated object placement in clutter first on this platform
"dummyScanner" -- esentially same as codyRobot, with no dependancies.
"Other" -- quits with warning
"PR2" or -- requires tf_msg (geometry_msgs.msg.StampedTransform) to be passed
also. This is because the Transform is dynamic, unlike our other robots which have had a
fixed relative placement between the camera and tilting hokuyo.
"PR2example" -- initialized with a fixed transform between pointcloud
and camera, good for example data only.
'''
def __init__(self, path = '../data/', device = 'desktopScanner', tf_msg = None):
'''
set default values
'''
self.path = path
self.pointcloud_max_dist = 5.0
self.pointcloud_min_dist = 0.1
self.device = device
if device == 'PR2' or device == 'PR2example':
self.cam_name = 'wide_stereo/right/image_rect_color'
fx = 428.48 #focal lengths in pixels
fy = 428.35
self.cam_proj_mat = np.matrix([[fx, 0, 0, 0],
[0, fy, 0, 0],
[0, 0, 1, 0]])
cx = 323.4 #in pixels
cy = 242.9 #in pixels
self.cam_centers = (cx, cy)
self.cam_image_height= 480 #px
self.cam_image_width= 640 #px
#Transform properties will depend on wide_stereo_optical_frame
# -to-base_footprint TF since the PR2
#can move its head relative to the tilting hokuyo.
#
######### EXAMPLE result from TF on PR2 ##############
# header: --
# frame_id: /base_footprint
# child_frame_id: /wide_stereo_optical_frame
# transform:
# translation:
x = 0.111181322026
y= 0.0201393251186 #-0.09 #Using right camera is shifted over by 9cm.
z= 1.39969502374 #+0.051 #- 1.32 #****MY data was in BASE_LINK FRAME??
# rotation: (rotation same as optical frame of Gazebo_R and Gazebo_L_ optical)
rx= -0.625821685412
ry= 0.66370971141
rz= -0.30689909515
rw= 0.271384565597
#euler_angles = transformations.euler_from_quaternion([rx,ry,rz,rw])
#In euler: (-132, -1.4, -94) in degrees.
#####################################################
#kill soon
# Initialize THOK
self.thok_l1 = 0
self.thok_l2 = -0.055
self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))
self.thok_devname = '/dev/robot/servo0'
self.thok_servonum = 5
self.thok_hoknum = 0
self.thok_scan_speed = math.radians(10.0) #speed=10 in lpi
if device == 'PR2' and tf_msg:
#requires an appropriate TF message (type=TransformStamped) called tf_msg.
#Condition: header.frame_id = '/base_footprint', child_frame_id = '/wide_stereo_optical_frame'
t = tf_msg.transform.translation
r = tf_msg.transform.rotation
(x,y,z) = (t.x, t.y, t.z)
(rx, ry, rz, rw) = (r.x, r.y, r.z, r.w)
T = transformations.translation_matrix([x,y,z])
R = transformations.quaternion_matrix([rx,ry,rz,rw])
print 'R=',R
print 'T=',T
M = np.matrix(R);
M[:3,3] = np.matrix(T)[:3,3]
print 'M=',M
#hack
M = np.linalg.inv(M)
self.camTlaser = M
# (wrong) TRmatrix = [[-0.06939527, -0.66415251, 0.74436936, 0.11118132],
# [-0.99730322, 0.02832033, -0.06770713, -0.06986067],
# [ 0.02388707, -0.74706051, -0.66432673, 1.39969502],
# [ 0. , 0. , 0. , 1. ]]
#Result is a 4x4 array: [ R | t ]
# [ 0 | 1 ]
# np.array([[ 0.74436936, 0.06939527, 0.66415251, 0. ],
# [-0.06770713, 0.99730322, -0.02832033, 0. ],
# [-0.66432673, -0.02388707, 0.74706051, 0. ],
# [ 0. , 0. , 0. , 1. ]])
elif device == 'desktopScanner':
import scanr_transforms as trs
self.webcam_id = 1
#From webcam_config definition formerly in robot1-->hrl_lib
# Parameter definitions for camera used on desktopScanner
webcam_parameters = {
'DesktopWebcam':
{
'calibration_image_width' : 960.0,
'calibration_image_height' : 720.0,
'focal_length_x_in_pixels' : 794.985,
'focal_length_y_in_pixels' : 797.122,
'optical_center_x_in_pixels' : 491.555,
'optical_center_y_in_pixels' : 344.289,
'lens_distortion_radial_1' : 0.0487641,
'lens_distortion_radial_2' : -0.128722,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : None,
'color': True,
}
}
#most code from travis scanr-class:
# Initialize webcam
self.cam_name = 'DesktopWebcam'
cp = webcam_parameters[self.cam_name]
fx = cp['focal_length_x_in_pixels']
fy = cp['focal_length_y_in_pixels']
self.cam_proj_mat = np.matrix([[fx, 0, 0, 0],
[0, fy, 0, 0],
[0, 0, 1, 0]])
self.cam_centers = ( cp['optical_center_x_in_pixels'], cp['optical_center_y_in_pixels'] )
self.cam_deltas = np.array([0.1, 0.1, 0.1, 0.1, 0.001, 0.001, 0.001 ])
self.cam_names = ['Ry_0', 'Rz_0', 'Rx_-90', 'Rz_-90', 'dx', 'dy', 'dz']
self.cam_vec = np.array([ 1.8000 , 1.7000 , -2.6000 , 4.7500 , 0.0620 , 0.0320 , -0.0270 ])
self.camTlaser = trs.camTlaser(self.cam_vec)
self.scanner_metal_plate_offset = 0.05 #TODO
# Initialize THOK
self.thok_l1 = 0
self.thok_l2 = 0.035
self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))
self.thok_devname = '/dev/robot/desktopServos'
self.thok_servonum = 19
self.thok_hoknum = 0
self.thok_scan_speed = math.radians(5.0)
elif device == 'codyRobot' or device == 'dummyScanner':
#just for testing/demonstration without dependencies outside of gt-ros-pkg
self.webcam_id = 0
#values from equilibrium_point_control/lpi.py
self.cam_name = 'mekabotUTM' #also: 'dummyUTM'
#Values copied from Cody
#Please update with current values if they are expected to have changed.
cp = {'calibration_image_width' : 640.0,
'calibration_image_height' : 480.0,
'focal_length_x_in_pixels' : 362.381,
'focal_length_y_in_pixels' : 362.260,
'optical_center_x_in_pixels' : 275.630,
'optical_center_y_in_pixels' : 267.914,
'lens_distortion_radial_1' : -0.270544,
'lens_distortion_radial_2' : 0.0530850,
'lens_distortion_tangential_1' : 0,
'lens_distortion_tangential_2' : 0,
'opencv_bayer_pattern' : 48, #same as cv.CV_BayerBG2BGR
'color': True,
'uid': 8520228
}
fx = cp['focal_length_x_in_pixels']
fy = cp['focal_length_y_in_pixels']
self.cam_proj_mat = np.matrix([[fx, 0, 0, 0],
[0, fy, 0, 0],
[0, 0, 1, 0]])
self.cam_centers = ( cp['optical_center_x_in_pixels'], cp['optical_center_y_in_pixels'] )
#self.camTlaser = mcf.utmcam0Tglobal(mcf.globalTthok0(m),self.image_angle)
# Initialize THOK
self.thok_l1 = 0
self.thok_l2 = -0.055
self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))
self.thok_devname = '/dev/robot/servo0'
self.thok_servonum = 5
self.thok_hoknum = 0
self.thok_scan_speed = math.radians(10.0) #speed=10 in lpi
else:
print '[configuration] ERROR: configuration.py: Device "%s" not recognized:' %( device )
print 'Exiting. Cannot fetch transformation and camera properties for this device.'
| ajibawa-2023/Python-Code-Large/train/row_99486 | 89 | 244 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Import_L31_C0", "label": "numpy import np, math", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.127, 0.0041, 0, 0.66, 0.0, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np,math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Import_L32_C0", "label": "roslib import roslib", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.1311, 0.0041, 0, 0.66, 0.25, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L32_C15", "label": "load_manifest()", "type": "expression", "loc": [32, 32], "level": 0, "parent": null, "vector": [8, 0, 0.1311, 0.0041, 0, 0.66, 0.5, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('tf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:ImportFrom_L33_C0", "label": "from tf import transformations", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.1352, 0.0041, 0, 0.66, 0.75, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["transformations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from tf import transformations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:ClassDef_L43_C0", "label": "configuration", "type": "class", "loc": [43, 242], "level": 0, "parent": null, "vector": [3, 0, 0.584, 0.8197, 0, 0.66, 1.0, 627, 0, 1, 0, 0, 186, 0, 25], "semantic": {"name": "configuration", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class configuration(object):\n '''\n Define camera properties matrix: fx, fy, and optical center in x,y\n Define rotation/translation matrix between camera origin and laser cloud origin\n Three types of robot/device accepted:\n \"desktopScanner\" -- used to collect dataset of tablescans\n \"codyRobot\" -- demonstrated object placement in clutter first on this platform\n \"dummyScanner\" -- esentially same as codyRobot, with no dependancies."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:ClassDef_L43_C0", "vector": [8, 1, 0.209, 0.0615, 1, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Define camera properties matrix: fx, fy, and optical center in x,y\n Define rotation/translation matrix between camera origin and laser cloud origin\n Three types of robot/device accepted:\n \"desktopScanner\" -- used to collect dataset of tablescans\n \"codyRobot\" -- demonstrated object placement in clutter first on this platform\n \"dummyScanner\" -- esentially same as codyRobot, with no dependancies.\n \"Other\" -- quits with warning"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "label": "__init__", "type": "function", "loc": [60, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:ClassDef_L43_C0", "vector": [2, 1, 0.6189, 0.75, 1, 0.0, 1.0, 555, 0, 4, 0, 0, 0, 0, 25], "semantic": {"name": "__init__", "arg_names": ["self", "path", "device", "tf_msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, path = '../data/', device = 'desktopScanner', tf_msg = None):\n '''\n set default values\n '''\n self.path = path\n self.pointcloud_max_dist = 5.0\n self.pointcloud_min_dist = 0.1 \n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L61_C8", "label": "expression", "type": "expression", "loc": [61, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "vector": [8, 2, 0.2541, 0.0123, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n set default values\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L64_C8", "label": "self.path =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "vector": [14, 2, 0.2623, 0.0041, 2, 0.27, 0.2, 425, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.path = path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L65_C8", "label": "self.pointcloud_max_dist =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "vector": [14, 2, 0.2664, 0.0041, 2, 0.27, 0.4, 340, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.pointcloud_max_dist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pointcloud_max_dist = 5.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L66_C8", "label": "self.pointcloud_min_dist =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "vector": [14, 2, 0.2705, 0.0041, 2, 0.27, 0.6, 42, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.pointcloud_min_dist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pointcloud_min_dist = 0.1 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L68_C8", "label": "self.device =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "vector": [14, 2, 0.2787, 0.0041, 2, 0.27, 0.8, 993, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.device", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.device = device"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "label": "if", "type": "if", "loc": [70, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "vector": [4, 2, 0.6393, 0.709, 2, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 0, 25], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if device == 'PR2' or device == 'PR2example':\n \n self.cam_name = 'wide_stereo/right/image_rect_color'\n fx = 428.48 #focal lengths in pixels\n fy = 428.35\n self.cam_proj_mat = np.matrix([[fx, 0, 0, 0],\n [0, fy, 0, 0],\n [0, 0, 1, 0]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L72_C12", "label": "self.cam_name =", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.2951, 0.0041, 3, 0.62, 0.0, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.cam_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_name = 'wide_stereo/right/image_rect_color'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L73_C12", "label": "fx =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.2992, 0.0041, 3, 0.62, 0.0303, 322, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "fx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fx = 428.48 #focal lengths in pixels"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L74_C12", "label": "fy =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3033, 0.0041, 3, 0.62, 0.0606, 8, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "fy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fy = 428.35"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L75_C12", "label": "self.cam_proj_mat = matrix()", "type": "assigned_variable", "loc": [75, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3115, 0.0123, 3, 0.62, 0.0909, 245, 3, 1, 0, 0, 162, 10, 1], "semantic": {"name": "self.cam_proj_mat", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " self.cam_proj_mat = np.matrix([[fx, 0, 0, 0],\n [0, fy, 0, 0],\n [0, 0, 1, 0]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L78_C12", "label": "cx =", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3197, 0.0041, 3, 0.62, 0.1212, 425, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "cx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cx = 323.4 #in pixels"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L79_C12", "label": "cy =", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3238, 0.0041, 3, 0.62, 0.1515, 628, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "cy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cy = 242.9 #in pixels"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L80_C12", "label": "self.cam_centers =", "type": "assigned_variable", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3279, 0.0041, 3, 0.62, 0.1818, 76, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self.cam_centers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_centers = (cx, cy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L81_C12", "label": "self.cam_image_height =", "type": "assigned_variable", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.332, 0.0041, 3, 0.62, 0.2121, 12, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.cam_image_height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_image_height= 480 #px"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L82_C12", "label": "self.cam_image_width =", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3361, 0.0041, 3, 0.62, 0.2424, 804, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.cam_image_width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_image_width= 640 #px"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L95_C12", "label": "x =", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3893, 0.0041, 3, 0.62, 0.2727, 190, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = 0.111181322026"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L96_C12", "label": "y =", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3934, 0.0041, 3, 0.62, 0.303, 304, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " y= 0.0201393251186 #-0.09 #Using right camera is shifted over by 9cm."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L97_C12", "label": "z =", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.3975, 0.0041, 3, 0.62, 0.3333, 859, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " z= 1.39969502374 #+0.051 #- 1.32 #****MY data was in BASE_LINK FRAME??"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L99_C12", "label": "rx =", "type": "assigned_variable", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4057, 0.0041, 3, 0.62, 0.3636, 179, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rx= -0.625821685412"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L100_C12", "label": "ry =", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4098, 0.0041, 3, 0.62, 0.3939, 987, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "ry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ry= 0.66370971141"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L101_C12", "label": "rz =", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4139, 0.0041, 3, 0.62, 0.4242, 289, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rz= -0.30689909515"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L102_C12", "label": "rw =", "type": "assigned_variable", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.418, 0.0041, 3, 0.62, 0.4545, 273, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "rw", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rw= 0.271384565597"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L109_C12", "label": "self.thok_l1 =", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4467, 0.0041, 3, 0.62, 0.4848, 475, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_l1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_l1 = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L110_C12", "label": "self.thok_l2 =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4508, 0.0041, 3, 0.62, 0.5152, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.thok_l2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_l2 = -0.055"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L111_C12", "label": "self.thok_tilt_angles =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4549, 0.0041, 3, 0.62, 0.5455, 884, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "self.thok_tilt_angles", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L112_C12", "label": "self.thok_devname =", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.459, 0.0041, 3, 0.62, 0.5758, 404, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.thok_devname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_devname = '/dev/robot/servo0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L113_C12", "label": "self.thok_servonum =", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4631, 0.0041, 3, 0.62, 0.6061, 81, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_servonum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_servonum = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L114_C12", "label": "self.thok_hoknum =", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4672, 0.0041, 3, 0.62, 0.6364, 168, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_hoknum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_hoknum = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L115_C12", "label": "self.thok_scan_speed = radians()", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.4713, 0.0041, 3, 0.62, 0.6667, 362, 3, 1, 0, 0, 383, 10, 1], "semantic": {"name": "self.thok_scan_speed", "arg_names": [], "import_names": [], "rhs_call_name": "radians", "annotation": ""}, "snippet": " self.thok_scan_speed = math.radians(10.0) #speed=10 in lpi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "label": "if", "type": "if", "loc": [117, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [4, 3, 0.4918, 0.0287, 3, 0.62, 0.697, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if device == 'PR2' and tf_msg: \n #requires an appropriate TF message (type=TransformStamped) called tf_msg.\n #Condition: header.frame_id = '/base_footprint', child_frame_id = '/wide_stereo_optical_frame'\n t = tf_msg.transform.translation\n r = tf_msg.transform.rotation\n (x,y,z) = (t.x, t.y, t.z)\n (rx, ry, rz, rw) = (r.x, r.y, r.z, r.w) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L120_C16", "label": "t =", "type": "assigned_variable", "loc": [120, 120], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "vector": [14, 4, 0.4918, 0.0041, 4, 0.09, 0.0, 15, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = tf_msg.transform.translation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L121_C16", "label": "r =", "type": "assigned_variable", "loc": [121, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "vector": [14, 4, 0.4959, 0.0041, 4, 0.09, 0.3333, 436, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = tf_msg.transform.rotation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L122_C16", "label": "x, y, z =", "type": "assigned_variable", "loc": [122, 122], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "vector": [14, 4, 0.5, 0.0041, 4, 0.09, 0.6667, 971, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "x, y, z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (x,y,z) = (t.x, t.y, t.z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L123_C16", "label": "rx, ry, rz, rw =", "type": "assigned_variable", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "vector": [14, 4, 0.5041, 0.0041, 4, 0.09, 1.0, 145, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "rx, ry, rz, rw", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (rx, ry, rz, rw) = (r.x, r.y, r.z, r.w) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L124_C12", "label": "T = translation_matrix()", "type": "assigned_variable", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.5082, 0.0041, 3, 0.62, 0.7273, 716, 3, 1, 0, 0, 868, 10, 1], "semantic": {"name": "T", "arg_names": [], "import_names": [], "rhs_call_name": "translation_matrix", "annotation": ""}, "snippet": " T = transformations.translation_matrix([x,y,z])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L125_C12", "label": "R = quaternion_matrix()", "type": "assigned_variable", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.5123, 0.0041, 3, 0.62, 0.7576, 467, 3, 1, 0, 0, 752, 10, 1], "semantic": {"name": "R", "arg_names": [], "import_names": [], "rhs_call_name": "quaternion_matrix", "annotation": ""}, "snippet": " R = transformations.quaternion_matrix([rx,ry,rz,rw])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L126_C12", "label": "print()", "type": "expression", "loc": [126, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [8, 3, 0.5164, 0.0041, 3, 0.62, 0.7879, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('R=',R)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L127_C12", "label": "print()", "type": "expression", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [8, 3, 0.5205, 0.0041, 3, 0.62, 0.8182, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('T=',T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L128_C12", "label": "M = matrix()", "type": "assigned_variable", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.5246, 0.0041, 3, 0.62, 0.8485, 727, 3, 1, 0, 0, 162, 10, 1], "semantic": {"name": "M", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " M = np.matrix(R);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L129_C12", "label": "assign", "type": "assigned_variable", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.5287, 0.0041, 3, 0.62, 0.8788, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " M[:3,3] = np.matrix(T)[:3,3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L130_C12", "label": "print()", "type": "expression", "loc": [130, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [8, 3, 0.5328, 0.0041, 3, 0.62, 0.9091, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('M=',M)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L132_C12", "label": "M = inv()", "type": "assigned_variable", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.541, 0.0041, 3, 0.62, 0.9394, 727, 3, 1, 0, 0, 761, 10, 1], "semantic": {"name": "M", "arg_names": [], "import_names": [], "rhs_call_name": "inv", "annotation": ""}, "snippet": " M = np.linalg.inv(M)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L133_C12", "label": "self.camTlaser =", "type": "assigned_variable", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [14, 3, 0.5451, 0.0041, 3, 0.62, 0.9697, 451, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.camTlaser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.camTlaser = M"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "label": "if", "type": "if", "loc": [146, 242], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "vector": [4, 3, 0.7951, 0.3975, 3, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif device == 'desktopScanner':\n import scanr_transforms as trs\n self.webcam_id = 1\n \n #From webcam_config definition formerly in robot1-->hrl_lib\n # Parameter definitions for camera used on desktopScanner\n webcam_parameters = {\n 'DesktopWebcam':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Import_L147_C12", "label": "scanr_transforms import trs", "type": "import", "loc": [147, 147], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [1, 4, 0.6025, 0.0041, 4, 0.93, 0.0, 488, 0, 1, 0, 0, 488, 0, 0], "semantic": {"name": "scanr_transforms", "arg_names": [], "import_names": ["trs"], "rhs_call_name": "", "annotation": ""}, "snippet": " import scanr_transforms as trs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L148_C12", "label": "self.webcam_id =", "type": "assigned_variable", "loc": [148, 148], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.6066, 0.0041, 4, 0.93, 0.0476, 890, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.webcam_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.webcam_id = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L152_C12", "label": "webcam_parameters =", "type": "assigned_variable", "loc": [152, 168], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.6557, 0.0697, 4, 0.93, 0.0952, 791, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "webcam_parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " webcam_parameters = {\n 'DesktopWebcam':\n { \n 'calibration_image_width' : 960.0,\n 'calibration_image_height' : 720.0, \n 'focal_length_x_in_pixels' : 794.985,\n 'focal_length_y_in_pixels' : 797.122,\n 'optical_center_x_in_pixels' : 491.555,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L172_C12", "label": "self.cam_name =", "type": "assigned_variable", "loc": [172, 172], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7049, 0.0041, 4, 0.93, 0.1429, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.cam_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_name = 'DesktopWebcam'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L173_C12", "label": "cp =", "type": "assigned_variable", "loc": [173, 173], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.709, 0.0041, 4, 0.93, 0.1905, 70, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cp = webcam_parameters[self.cam_name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L174_C12", "label": "fx =", "type": "assigned_variable", "loc": [174, 174], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7131, 0.0041, 4, 0.93, 0.2381, 322, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fx = cp['focal_length_x_in_pixels']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L175_C12", "label": "fy =", "type": "assigned_variable", "loc": [175, 175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7172, 0.0041, 4, 0.93, 0.2857, 8, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fy = cp['focal_length_y_in_pixels']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L176_C12", "label": "self.cam_proj_mat = matrix()", "type": "assigned_variable", "loc": [176, 178], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7254, 0.0123, 4, 0.93, 0.3333, 245, 3, 1, 0, 0, 162, 10, 1], "semantic": {"name": "self.cam_proj_mat", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " self.cam_proj_mat = np.matrix([[fx, 0, 0, 0],\n [0, fy, 0, 0],\n [0, 0, 1, 0]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L180_C12", "label": "self.cam_centers =", "type": "assigned_variable", "loc": [180, 180], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7377, 0.0041, 4, 0.93, 0.381, 76, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self.cam_centers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_centers = ( cp['optical_center_x_in_pixels'], cp['optical_center_y_in_pixels'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L181_C12", "label": "self.cam_deltas = array()", "type": "assigned_variable", "loc": [181, 181], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7418, 0.0041, 4, 0.93, 0.4286, 687, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "self.cam_deltas", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " self.cam_deltas = np.array([0.1, 0.1, 0.1, 0.1, 0.001, 0.001, 0.001 ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L182_C12", "label": "self.cam_names =", "type": "assigned_variable", "loc": [182, 182], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7459, 0.0041, 4, 0.93, 0.4762, 649, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.cam_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_names = ['Ry_0', 'Rz_0', 'Rx_-90', 'Rz_-90', 'dx', 'dy', 'dz']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L183_C12", "label": "self.cam_vec = array()", "type": "assigned_variable", "loc": [183, 183], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.75, 0.0041, 4, 0.93, 0.5238, 23, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "self.cam_vec", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " self.cam_vec = np.array([ 1.8000 , 1.7000 , -2.6000 , 4.7500 , 0.0620 , 0.0320 , -0.0270 ]) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L185_C12", "label": "self.camTlaser = camTlaser()", "type": "assigned_variable", "loc": [185, 185], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7582, 0.0041, 4, 0.93, 0.5714, 451, 3, 1, 0, 0, 184, 10, 1], "semantic": {"name": "self.camTlaser", "arg_names": [], "import_names": [], "rhs_call_name": "camTlaser", "annotation": ""}, "snippet": " self.camTlaser = trs.camTlaser(self.cam_vec)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L187_C12", "label": "self.scanner_metal_plate_offset =", "type": "assigned_variable", "loc": [187, 187], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7664, 0.0041, 4, 0.93, 0.619, 665, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.scanner_metal_plate_offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scanner_metal_plate_offset = 0.05 #TODO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L190_C12", "label": "self.thok_l1 =", "type": "assigned_variable", "loc": [190, 190], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7787, 0.0041, 4, 0.93, 0.6667, 475, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_l1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_l1 = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L191_C12", "label": "self.thok_l2 =", "type": "assigned_variable", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7828, 0.0041, 4, 0.93, 0.7143, 623, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.thok_l2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_l2 = 0.035"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L192_C12", "label": "self.thok_tilt_angles =", "type": "assigned_variable", "loc": [192, 192], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7869, 0.0041, 4, 0.93, 0.7619, 884, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "self.thok_tilt_angles", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L193_C12", "label": "self.thok_devname =", "type": "assigned_variable", "loc": [193, 193], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.791, 0.0041, 4, 0.93, 0.8095, 404, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.thok_devname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_devname = '/dev/robot/desktopServos'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L194_C12", "label": "self.thok_servonum =", "type": "assigned_variable", "loc": [194, 194], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7951, 0.0041, 4, 0.93, 0.8571, 81, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_servonum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_servonum = 19"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L195_C12", "label": "self.thok_hoknum =", "type": "assigned_variable", "loc": [195, 195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.7992, 0.0041, 4, 0.93, 0.9048, 168, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_hoknum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_hoknum = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L196_C12", "label": "self.thok_scan_speed = radians()", "type": "assigned_variable", "loc": [196, 196], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [14, 4, 0.8033, 0.0041, 4, 0.93, 0.9524, 362, 3, 1, 0, 0, 383, 10, 1], "semantic": {"name": "self.thok_scan_speed", "arg_names": [], "import_names": [], "rhs_call_name": "radians", "annotation": ""}, "snippet": " self.thok_scan_speed = math.radians(5.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "label": "if", "type": "if", "loc": [198, 242], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "vector": [4, 4, 0.9016, 0.1844, 4, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif device == 'codyRobot' or device == 'dummyScanner': \n #just for testing/demonstration without dependencies outside of gt-ros-pkg \n self.webcam_id = 0\n \n #values from equilibrium_point_control/lpi.py\n self.cam_name = 'mekabotUTM' #also: 'dummyUTM'\n\n #Values copied from Cody"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L200_C12", "label": "self.webcam_id =", "type": "assigned_variable", "loc": [200, 200], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.8197, 0.0041, 5, 0.9, 0.0, 890, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.webcam_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.webcam_id = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L203_C12", "label": "self.cam_name =", "type": "assigned_variable", "loc": [203, 203], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.832, 0.0041, 5, 0.9, 0.0667, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.cam_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_name = 'mekabotUTM' #also: 'dummyUTM'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L207_C12", "label": "cp =", "type": "assigned_variable", "loc": [207, 220], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.875, 0.0574, 5, 0.9, 0.1333, 70, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cp = {'calibration_image_width' : 640.0,\n 'calibration_image_height' : 480.0, \n 'focal_length_x_in_pixels' : 362.381,\n 'focal_length_y_in_pixels' : 362.260,\n 'optical_center_x_in_pixels' : 275.630,\n 'optical_center_y_in_pixels' : 267.914,\n 'lens_distortion_radial_1' : -0.270544,\n 'lens_distortion_radial_2' : 0.0530850,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L221_C12", "label": "fx =", "type": "assigned_variable", "loc": [221, 221], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9057, 0.0041, 5, 0.9, 0.2, 322, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fx = cp['focal_length_x_in_pixels']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L222_C12", "label": "fy =", "type": "assigned_variable", "loc": [222, 222], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9098, 0.0041, 5, 0.9, 0.2667, 8, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fy = cp['focal_length_y_in_pixels']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L224_C12", "label": "self.cam_proj_mat = matrix()", "type": "assigned_variable", "loc": [224, 226], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9221, 0.0123, 5, 0.9, 0.3333, 245, 3, 1, 0, 0, 162, 10, 1], "semantic": {"name": "self.cam_proj_mat", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " self.cam_proj_mat = np.matrix([[fx, 0, 0, 0],\n [0, fy, 0, 0],\n [0, 0, 1, 0]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L227_C12", "label": "self.cam_centers =", "type": "assigned_variable", "loc": [227, 227], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9303, 0.0041, 5, 0.9, 0.4, 76, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self.cam_centers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cam_centers = ( cp['optical_center_x_in_pixels'], cp['optical_center_y_in_pixels'] )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L232_C12", "label": "self.thok_l1 =", "type": "assigned_variable", "loc": [232, 232], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9508, 0.0041, 5, 0.9, 0.4667, 475, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_l1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_l1 = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L233_C12", "label": "self.thok_l2 =", "type": "assigned_variable", "loc": [233, 233], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9549, 0.0041, 5, 0.9, 0.5333, 623, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.thok_l2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_l2 = -0.055"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L234_C12", "label": "self.thok_tilt_angles =", "type": "assigned_variable", "loc": [234, 234], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.959, 0.0041, 5, 0.9, 0.6, 884, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "self.thok_tilt_angles", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_tilt_angles = (math.radians(40.0),math.radians(-40.0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L235_C12", "label": "self.thok_devname =", "type": "assigned_variable", "loc": [235, 235], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9631, 0.0041, 5, 0.9, 0.6667, 404, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.thok_devname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_devname = '/dev/robot/servo0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L236_C12", "label": "self.thok_servonum =", "type": "assigned_variable", "loc": [236, 236], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9672, 0.0041, 5, 0.9, 0.7333, 81, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_servonum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_servonum = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L237_C12", "label": "self.thok_hoknum =", "type": "assigned_variable", "loc": [237, 237], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9713, 0.0041, 5, 0.9, 0.8, 168, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.thok_hoknum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thok_hoknum = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L238_C12", "label": "self.thok_scan_speed = radians()", "type": "assigned_variable", "loc": [238, 238], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [14, 5, 0.9754, 0.0041, 5, 0.9, 0.8667, 362, 3, 1, 0, 0, 383, 10, 1], "semantic": {"name": "self.thok_scan_speed", "arg_names": [], "import_names": [], "rhs_call_name": "radians", "annotation": ""}, "snippet": " self.thok_scan_speed = math.radians(10.0) #speed=10 in lpi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L241_C12", "label": "print()", "type": "expression", "loc": [241, 241], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [8, 5, 0.9877, 0.0041, 5, 0.9, 0.9333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('[configuration] ERROR: configuration.py: Device \"%s\" not recognized:' %( device ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L242_C12", "label": "print()", "type": "expression", "loc": [242, 242], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "vector": [8, 5, 0.9918, 0.0041, 5, 0.9, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Exiting. Cannot fetch transformation and camera properties for this device.')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99486:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L120_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L121_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L122_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L123_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L130_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Import_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L180_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L191_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L192_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L193_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L194_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L207_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L222_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L227_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L233_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L235_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L236_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Assign_L238_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99486:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99486:Expr_L242_C12"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import label_object
class scan_dataset(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
self.dict = {}
self.dict['title'] = ''
self.dict['id'] = ''
self.dict['polygons'] = [label_object.label_object()]
self.dict['scan_filename'] = ''
self.dict['image_filename'] = ''
self.dict['image_artag_filename'] = ''
self.dict['surface_id'] = ''
self.dict['surface_height'] = ''
self.dict['camera_height'] = ''
self.dict['camera_angle'] = ''
self.dict['surface_type'] = ''
self.dict['ground_plane_normal'] = ''
self.dict['ground_plane_three_points'] = ''
self.dict['is_training_set'] = False
self.dict['is_test_set'] = False
self.dict['is_labeled'] = False
self.dict['ground_plane_rotation'] = ''
#Auto creates: ['table_plane_translation'] = np.matrix([0,0,0]).T
# ['ground_plane_translation'] = np.matrix([0,0,1.25]).T
# [id] = <unique scan name>
def __setattr__(self, name, value):
if not name == 'dict':
self.dict[name] = value
else:
object.__setattr__(self, name, value)
def __getattr__(self, name):
if not name == 'dict' and name in self.dict:
return self.dict[name]
else:
return object.__getattribute__(self, name)
| ajibawa-2023/Python-Code-Large/train/row_99487 | 31 | 78 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Import_L29_C0", "label": "label_object import label_object", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.3718, 0.0128, 0, 0.66, 0.0, 589, 0, 1, 0, 0, 589, 0, 0], "semantic": {"name": "label_object", "arg_names": [], "import_names": ["label_object"], "rhs_call_name": "", "annotation": ""}, "snippet": "import label_object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "label": "scan_dataset", "type": "class", "loc": [31, 77], "level": 0, "parent": null, "vector": [3, 0, 0.6923, 0.6026, 0, 0.66, 1.0, 727, 0, 3, 0, 0, 186, 0, 3], "semantic": {"name": "scan_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class scan_dataset(object):\n '''\n classdocs\n '''\n\n\n def __init__(self):\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Expr_L32_C4", "label": "expression", "type": "expression", "loc": [32, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "vector": [8, 1, 0.4231, 0.0385, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "label": "__init__", "type": "function", "loc": [37, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "vector": [2, 1, 0.6282, 0.3205, 1, 0.1, 0.3333, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n '''\n Constructor\n '''\n self.dict = {}\n self.dict['title'] = ''\n self.dict['id'] = ''\n self.dict['polygons'] = [label_object.label_object()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Expr_L38_C8", "label": "expression", "type": "expression", "loc": [38, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [8, 2, 0.5, 0.0385, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L41_C8", "label": "self.dict =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.5256, 0.0128, 2, 0.15, 0.0556, 313, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L42_C8", "label": "assign", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.5385, 0.0128, 2, 0.15, 0.1111, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['title'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L43_C8", "label": "assign", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.5513, 0.0128, 2, 0.15, 0.1667, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['id'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L44_C8", "label": "assign", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.5641, 0.0128, 2, 0.15, 0.2222, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['polygons'] = [label_object.label_object()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L45_C8", "label": "assign", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.5769, 0.0128, 2, 0.15, 0.2778, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['scan_filename'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L46_C8", "label": "assign", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.5897, 0.0128, 2, 0.15, 0.3333, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['image_filename'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L47_C8", "label": "assign", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.6026, 0.0128, 2, 0.15, 0.3889, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['image_artag_filename'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L49_C8", "label": "assign", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.6282, 0.0128, 2, 0.15, 0.4444, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['surface_id'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L50_C8", "label": "assign", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.641, 0.0128, 2, 0.15, 0.5, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['surface_height'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L51_C8", "label": "assign", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.6538, 0.0128, 2, 0.15, 0.5556, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['camera_height'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L52_C8", "label": "assign", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.6667, 0.0128, 2, 0.15, 0.6111, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['camera_angle'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L53_C8", "label": "assign", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.6795, 0.0128, 2, 0.15, 0.6667, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['surface_type'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L55_C8", "label": "assign", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.7051, 0.0128, 2, 0.15, 0.7222, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['ground_plane_normal'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L56_C8", "label": "assign", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.7179, 0.0128, 2, 0.15, 0.7778, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['ground_plane_three_points'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L58_C8", "label": "assign", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.7436, 0.0128, 2, 0.15, 0.8333, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['is_training_set'] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L59_C8", "label": "assign", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.7564, 0.0128, 2, 0.15, 0.8889, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['is_test_set'] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L60_C8", "label": "assign", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.7692, 0.0128, 2, 0.15, 0.9444, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['is_labeled'] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L61_C8", "label": "assign", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "vector": [14, 2, 0.7821, 0.0128, 2, 0.15, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict['ground_plane_rotation'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L67_C4", "label": "__setattr__", "type": "function", "loc": [67, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "vector": [2, 1, 0.8846, 0.0641, 1, 0.1, 0.6667, 112, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setattr__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setattr__(self, name, value): \n if not name == 'dict':\n self.dict[name] = value\n else:\n object.__setattr__(self, name, value) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L68_C8", "label": "if", "type": "if", "loc": [68, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L67_C4", "vector": [4, 2, 0.891, 0.0513, 2, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not name == 'dict':\n self.dict[name] = value\n else:\n object.__setattr__(self, name, value) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L69_C12", "label": "assign", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L68_C8", "vector": [14, 3, 0.8846, 0.0128, 3, 0.9, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dict[name] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Expr_L71_C12", "label": "__setattr__()", "type": "expression", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L68_C8", "vector": [8, 3, 0.9103, 0.0128, 3, 0.9, 1.0, 112, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setattr__", "arg_names": [], "import_names": [], "rhs_call_name": "__setattr__", "annotation": ""}, "snippet": " object.__setattr__(self, name, value) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L73_C4", "label": "__getattr__", "type": "function", "loc": [73, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "vector": [2, 1, 0.9615, 0.0641, 1, 0.1, 1.0, 210, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getattr__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, name):\n if not name == 'dict' and name in self.dict:\n return self.dict[name]\n else:\n return object.__getattribute__(self, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L74_C8", "label": "if", "type": "if", "loc": [74, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L73_C4", "vector": [4, 2, 0.9679, 0.0513, 2, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not name == 'dict' and name in self.dict:\n return self.dict[name]\n else:\n return object.__getattribute__(self, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Return_L75_C12", "label": "return", "type": "return", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L74_C8", "vector": [13, 3, 0.9615, 0.0128, 3, 0.48, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.dict[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99487:Return_L77_C12", "label": "return", "type": "return", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L74_C8", "vector": [13, 3, 0.9872, 0.0128, 3, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object.__getattribute__(self, name)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Expr_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Return_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99487:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99487:Return_L77_C12"}] |
#!/usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
# \author (new edits) Jason Okerman (Healthcare Robotics Lab, Georgia Tech.)
'''
This source file is not currently supported.
It was made to help generate classifiers and label the clutter table datasets.
'''
#---------------
# Define Import Location Variables
LOC_DATA_LABELING = '/home/jokerman/svn/robot1_data/usr/martin/laser_camera_segmentation/labeling'
#
import roslib; roslib.load_manifest('clutter_segmentation')
from opencv.highgui import cvLoadImage #unneeded?
from PyQt4 import QtGui, QtCore
import opencv.cv as cv
import opencv.highgui as hg
import sys
import shutil #file operations
import os
import label_object, scan_dataset, scans_database
#take scans:
import canner
import processor
import configuration
import util as ut
#Formerly: import hrl_lib.util as ut
class labeling_tool(QtGui.QWidget):
draw_widget = None
display_mode = 'image'
display_3d_type = 'height'
def __init__(self, path, parent=None):
self.init_in_progress = True
self.path = path
# load configs for taking scans, etc:
self.config = configuration.configuration(path)
#create scanner and processor when needed:
self.scanner = False
self.processor = False
#
# load database:
self.scans_database = scans_database.scans_database()
self.scans_database.load(path,'database.pkl')
#get first dataset:
self.current_dataset = self.scans_database.get_dataset(0)
QtGui.QWidget.__init__(self, parent)
self.setWindowTitle('labeling tool')
left_layout = QtGui.QVBoxLayout()
self.draw_widget = draw_widget(self.current_dataset.polygons, self.scans_database.get_path() + '/' + self.current_dataset.image_filename, self)
title_layout = QtGui.QHBoxLayout()
take_scan_button = QtGui.QPushButton('Scan')
take_scan_button.setMaximumWidth(50)
title_layout.addWidget(take_scan_button)
self.connect(take_scan_button, QtCore.SIGNAL('clicked()'), self.slot_take_scan )
take_artag_image_button = QtGui.QPushButton('ARTag')
take_artag_image_button.setMaximumWidth(50)
title_layout.addWidget(take_artag_image_button)
self.connect(take_artag_image_button, QtCore.SIGNAL('clicked()'), self.slot_take_artag_image )
button = QtGui.QPushButton('Import Img')
title_layout.addWidget(button)
self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_import_image )
label = QtGui.QLabel("View: ")
title_layout.addWidget(label)
self.display_3d_button = QtGui.QPushButton('3D')
self.display_3d_button.setMaximumWidth(40)
title_layout.addWidget(self.display_3d_button)
self.connect(self.display_3d_button, QtCore.SIGNAL('clicked()'), self.slot_display_3d )
combobox = QtGui.QComboBox()
combobox.addItem("Height", QtCore.QVariant("height"))
combobox.addItem("Intensities", QtCore.QVariant("intensities"))
#combobox.addItem("objects", QtCore.QVariant("objects"))
combobox.addItem("Labels", QtCore.QVariant("labels"))
combobox.addItem("Classifier range", QtCore.QVariant("range"))
combobox.addItem("Classifier color", QtCore.QVariant("color"))
combobox.addItem("Classifier all", QtCore.QVariant("all"))
combobox.addItem("Classifier all+post", QtCore.QVariant("all_post"))
combobox.addItem("Baseline algo", QtCore.QVariant("baseline"))
combobox.addItem("h", QtCore.QVariant("h"))
combobox.addItem("s", QtCore.QVariant("s"))
combobox.addItem("v", QtCore.QVariant("v"))
self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'), self.slot_update_display_3d_type)
title_layout.addWidget(combobox)
self.display_3d_type_combobox = combobox;
self.display_3d_spheres_button = QtGui.QPushButton('3D_Spheres')
title_layout.addWidget(self.display_3d_spheres_button)
self.connect(self.display_3d_spheres_button, QtCore.SIGNAL('clicked()'), self.slot_display_3d_spheres )
self.display_intensity_button = QtGui.QPushButton('Intensity')
self.display_intensity_button.setMaximumWidth(50)
title_layout.addWidget(self.display_intensity_button)
self.connect(self.display_intensity_button, QtCore.SIGNAL('clicked()'), self.slot_display_intensity )
self.display_features_button = QtGui.QPushButton('Features')
title_layout.addWidget(self.display_features_button)
self.display_features_button.setMaximumWidth(50)
self.connect(self.display_features_button, QtCore.SIGNAL('clicked()'), self.slot_display_features )
self.display_labels_button = QtGui.QPushButton('Labels')
title_layout.addWidget(self.display_labels_button)
self.display_labels_button.setMaximumWidth(50)
self.connect(self.display_labels_button, QtCore.SIGNAL('clicked()'), self.slot_display_labels )
###
self.display_masks_button = QtGui.QPushButton('Masks')
title_layout.addWidget(self.display_masks_button)
self.display_masks_button.setMaximumWidth(50)
self.connect(self.display_masks_button, QtCore.SIGNAL('clicked()'), self.slot_display_masks )
###
self.display_stats_button = QtGui.QPushButton('Stats')
title_layout.addWidget(self.display_stats_button)
self.display_stats_button.setMaximumWidth(50)
self.connect(self.display_stats_button, QtCore.SIGNAL('clicked()'), self.slot_display_stats )
self.display_global_stats_button = QtGui.QPushButton('Global Stats')
title_layout.addWidget(self.display_global_stats_button)
self.display_global_stats_button.setMaximumWidth(50)
self.connect(self.display_global_stats_button, QtCore.SIGNAL('clicked()'), self.slot_display_global_stats )
self.line_edits = []
self.add_line_edit('Title:',title_layout,'title')
first_dataset_button = QtGui.QPushButton('<<')
first_dataset_button.setMaximumWidth(30)
title_layout.addWidget(first_dataset_button)
self.connect(first_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_first_dataset )
prev_dataset_button = QtGui.QPushButton('<')
prev_dataset_button.setMaximumWidth(30)
title_layout.addWidget(prev_dataset_button)
self.connect(prev_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_prev_dataset )
next_dataset_button = QtGui.QPushButton('>')
next_dataset_button.setMaximumWidth(30)
title_layout.addWidget(next_dataset_button)
self.connect(next_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_next_dataset )
last_dataset_button = QtGui.QPushButton('>>')
last_dataset_button.setMaximumWidth(30)
title_layout.addWidget(last_dataset_button)
self.connect(last_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_last_dataset )
save_button = QtGui.QPushButton('Save')
title_layout.addWidget(save_button)
save_button.setMaximumWidth(50)
self.connect(save_button, QtCore.SIGNAL('clicked()'), self.slot_save )
delete_button = QtGui.QPushButton('Delete')
title_layout.addWidget(delete_button)
delete_button.setMaximumWidth(50)
self.connect(delete_button, QtCore.SIGNAL('clicked()'), self.slot_delete )
self.connect(self.draw_widget, QtCore.SIGNAL('sigPolyChanged'), self.slot_update_polygons)
self.connect(self.draw_widget, QtCore.SIGNAL('sigPolyLabelChanged'), self.slot_update_polygon_label)
self.connect(self.draw_widget, QtCore.SIGNAL('sigDefineGroundPlane'), self.slot_define_ground_plane)
left_layout.addLayout(title_layout)
#second row:
row2_layout = QtGui.QHBoxLayout()
left_layout.addLayout(row2_layout)
label = QtGui.QLabel("Id:")
row2_layout.addWidget(label)
self.id_label = QtGui.QLabel("")
row2_layout.addWidget(self.id_label)
self.add_line_edit('Surface: ID:',row2_layout,'surface_id')
self.add_line_edit('Height',row2_layout,'surface_height')
label = QtGui.QLabel("Type: ")
row2_layout.addWidget(label)
combobox = QtGui.QComboBox()
combobox.addItem("Table Office", QtCore.QVariant("table_office"))
combobox.addItem("Table Dorm", QtCore.QVariant("table_dorm"))
combobox.addItem("Table House", QtCore.QVariant("table_house"))
combobox.addItem("Shelf Office", QtCore.QVariant("shelf_office"))
combobox.addItem("Shelf Dorm", QtCore.QVariant("shelf_dorm"))
combobox.addItem("Shelf House", QtCore.QVariant("shelf_house"))
self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'), self.slot_update_surface_type)
row2_layout.addWidget(combobox)
self.surface_type_combobox = combobox;
self.add_line_edit('Camera: Height:',row2_layout,'camera_height')
self.add_line_edit('Camera: Angle:',row2_layout,'camera_angle')
#####################################
#thrid row:
row3_layout = QtGui.QHBoxLayout()
left_layout.addLayout(row3_layout)
#checkboxes:
button = QtGui.QPushButton("&gen'n'save features")
row3_layout.addWidget(button)
self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_generate_save_features )
checkbox = QtGui.QCheckBox('&Training Set')
row3_layout.addWidget(checkbox)
self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_training_set)
self.checkbox_training_set = checkbox
checkbox = QtGui.QCheckBox('Te&st Set')
row3_layout.addWidget(checkbox)
self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_test_set)
self.checkbox_test_set = checkbox
checkbox = QtGui.QCheckBox('Labels, Groundp. checked')
row3_layout.addWidget(checkbox)
self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_is_labeled)
self.checkbox_is_labeled = checkbox
button = QtGui.QPushButton("Train'n'save Classifiers (training set)")
row3_layout.addWidget(button)
self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_train_and_save_Classifiers )
button = QtGui.QPushButton('Test Classifiers (on current)')
row3_layout.addWidget(button)
self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_test_Classifiers )
button = QtGui.QPushButton('Test Classifiers (on testset)')
row3_layout.addWidget(button)
self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_test_Classifiers_on_testset )
button = QtGui.QPushButton('Load Classifiers')
row3_layout.addWidget(button)
self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_load_Classifiers )
# button = QtGui.QPushButton('Save Classifier')
# row3_layout.addWidget(button)
# self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_save_Classifier )
#####################################
left_layout.addWidget(self.draw_widget)
self.right_layout = QtGui.QVBoxLayout()
self.right_layout.setAlignment(QtCore.Qt.AlignTop)
self.outer_layout = QtGui.QHBoxLayout()
self.outer_layout.addLayout(left_layout)
self.outer_layout.addLayout(self.right_layout)
self.polygon_comboboxes = []
self.add_polygon_combobox()
self.slot_update_polygons(self.current_dataset.polygons,0)
self.setLayout(self.outer_layout)
self.resize(900, 700)
self.load_values_from_dataset()
self.init_in_progress = False
#at startup, display newest:
self.slot_last_dataset()
def slot_update_training_set(self, checkState):
if checkState:
self.current_dataset.is_training_set = True
else:
self.current_dataset.is_training_set = False
def slot_update_test_set(self, checkState):
if checkState:
self.current_dataset.is_test_set = True
else:
self.current_dataset.is_test_set = False
def slot_update_is_labeled(self, checkState):
if checkState:
self.current_dataset.is_labeled = True
else:
self.current_dataset.is_labeled = False
def closeEvent(self, x):
print "Exit: saving database..."
self.slot_save()
def slot_import_image(self):
fileName = QtGui.QFileDialog.getOpenFileName(self,"Open Image", self.path, "Image Files (*.png)")
print "Import image into new dataset:" + fileName
name = ut.formatted_time()
new_dataset = scan_dataset.scan_dataset()
new_dataset.id = name
new_dataset.image_filename = 'data/'+name+'_image.png'
shutil.copy(fileName,self.path+'/'+new_dataset.image_filename)
self.scans_database.add_dataset(new_dataset)
#proceed to new dataset:
while True == self.slot_next_dataset():
pass
def add_line_edit(self,label, layout, variable):
label = QtGui.QLabel(label)
line_edit = QtGui.QLineEdit()
line_edit.setMinimumWidth(80)
self.line_edits.append((line_edit,variable))
layout.addWidget(label)
layout.addWidget(line_edit)
self.connect(line_edit, QtCore.SIGNAL('textEdited (const QString&)'), self.slot_line_edit_changed )
return line_edit
def slot_line_edit_changed(self,text):
if True == self.init_in_progress:
return
for (line_edit, variable) in self.line_edits:
self.current_dataset.dict[variable] = str(line_edit.text())
def slot_next_dataset(self):
dataset = self.scans_database.get_next_dataset()
if False != dataset:
self.current_dataset = dataset
self.load_values_from_dataset()
return True
return False
def slot_prev_dataset(self):
dataset = self.scans_database.get_prev_dataset()
if False != dataset:
self.current_dataset = dataset
self.load_values_from_dataset()
return True
return False
def slot_first_dataset(self):
dataset = self.scans_database.get_first_dataset()
if False != dataset:
self.current_dataset = dataset
self.load_values_from_dataset()
return True
return False
def slot_last_dataset(self):
dataset = self.scans_database.get_last_dataset()
if False != dataset:
self.current_dataset = dataset
self.load_values_from_dataset()
return True
return False
def load_values_from_dataset(self):
self.init_in_progress = True
self.id_label.setText(self.current_dataset.id)
for (line_edit, variable) in self.line_edits:
line_edit.setText(self.current_dataset.dict[variable])
for index, box in enumerate(self.polygon_comboboxes):
if index < len(self.current_dataset.polygons):
print str(index) + " load label:" + self.current_dataset.polygons[index].get_label()
boxindex = box.findData(QtCore.QVariant(self.current_dataset.polygons[index].get_label()))
box.setCurrentIndex(boxindex)
else: #set default to first:
box.setCurrentIndex(0)
box = self.surface_type_combobox
boxindex = box.findData(QtCore.QVariant(self.current_dataset.surface_type))
box.setCurrentIndex(boxindex)
print self.current_dataset.is_training_set
if self.current_dataset.is_training_set:
self.checkbox_training_set.setCheckState(QtCore.Qt.Checked)
else:
self.checkbox_training_set.setCheckState(QtCore.Qt.Unchecked)
if self.current_dataset.is_test_set:
self.checkbox_test_set.setCheckState(QtCore.Qt.Checked)
else:
self.checkbox_test_set.setCheckState(QtCore.Qt.Unchecked)
if self.current_dataset.is_labeled:
self.checkbox_is_labeled.setCheckState(QtCore.Qt.Checked)
else:
self.checkbox_is_labeled.setCheckState(QtCore.Qt.Unchecked)
#hide button if there is no 3d data:
print self.current_dataset.scan_filename
if '' == self.current_dataset.scan_filename:
self.display_3d_button.setEnabled(False)
self.display_3d_spheres_button.setEnabled(False)
self.display_intensity_button.setEnabled(False)
else:
self.display_3d_button.setEnabled(True)
self.display_3d_spheres_button.setEnabled(True)
self.display_intensity_button.setEnabled(True)
self.display_mode = 'image'
self.draw_widget.set_polygons(self.current_dataset.polygons)
self.draw_widget.set_image(self.scans_database.get_path() + '/' + self.current_dataset.image_filename)
self.init_in_progress = False
def slot_take_artag_image(self):
if False == self.scanner:
self.scanner = scanner.scanner(self.config)
if False == self.processor:
self.processor = processor.processor(self.config)
img = self.scanner.take_artag_image()
self.current_dataset.image_artag_filename = self.scanner.save_artag_image(self.current_dataset.id)
self.slot_save() #save for consistency with files
if self.processor.read_artag(img).any():
print "SUCCESS in reading ARTag"
else:
print "FAILURE in reading ARTag - try again!"
def slot_take_scan(self):
#save database, let scanner add dataset, reload it then
self.slot_save()
if False == self.scanner:
self.scanner = scanner.scanner(self.config)
if False == self.processor:
self.processor = processor.processor(self.config)
name = ut.formatted_time()
self.scanner.capture_and_save(name)
#self.processor.load_raw_data(name)
#self.processor.load_metadata(name)
#self.processor.process_raw_data()
#self.processor.save_mapped_image(name)
#self.processor.display_all_data()
print 'scan ' + name + ' taken'
self.scans_database.load(self.path,'database.pkl')
#proceed to new scan:
while True == self.slot_next_dataset():
pass
def slot_display_intensity(self):
if self.display_mode != 'intensities':
if False == self.processor:
self.processor = processor.processor(self.config)
#reset ground plane:
self.current_dataset.ground_plane_normal = ''
self.current_dataset.ground_plane_three_points = ''
self.slot_save()
self.processor.load_data(self.current_dataset.id)
self.processor.process_intensities()
filename = self.processor.save_intensity_image(self.current_dataset.id)
#self.processor.display_intensities()
self.display_mode = 'intensities'
self.draw_widget.set_image(filename)
else:
#display normal image
self.display_mode = 'image'
self.draw_widget.set_image(self.scans_database.get_path() + '/' + self.current_dataset.image_filename)
def slot_display_features(self):
if self.display_mode != 'features':
if False == self.processor:
self.processor = processor.processor(self.config)
self.processor.load_data(self.current_dataset.id)
self.processor.process_intensities()
filename = self.processor.save_intensity_image(self.current_dataset.id)
self.display_mode = 'features'
self.draw_widget.set_image(filename)
else:
#display normal image
self.display_mode = 'image'
self.draw_widget.set_image(self.scans_database.get_path() + '/' + self.current_dataset.image_filename)
def slot_display_labels(self):
if self.display_mode != 'labels':
if False == self.processor:
self.processor = processor.processor(self.config)
self.processor.load_data(self.current_dataset.id)
self.processor.process_labels(self.display_3d_type)
filename = self.processor.save_labels_image(self.display_3d_type)
self.draw_widget.set_image(filename)
self.display_mode = 'labels'
else:
#display normal image
self.draw_widget.set_image(self.scans_database.get_path() + '/' + self.current_dataset.image_filename)
self.display_mode = 'image'
###
def slot_display_masks(self):
if False == self.processor:
self.processor = processor.processor(self.config)
self.processor.load_data(self.current_dataset.id)
if self.display_mode != 'labels':
self.processor.process_masks(self.display_3d_type)
self.display_mode = 'labels'
filename = self.processor.save_masks_image(self.display_3d_type) #saves pic in results
else:
self.processor.process_masks(self.display_3d_type, True) #show clutter mask NOT placement mask
self.display_mode = 'image'
filename = self.processor.save_masks_image(self.display_3d_type, True) #saves pic in results
self.draw_widget.set_image(filename) #loads picture saved previously
###
def slot_display_stats(self):
if False == self.processor:
self.processor = processor.processor(self.config)
self.processor.load_data(self.current_dataset.id)
self.processor.display_stats()
def slot_display_global_stats(self):
if False == self.processor:
self.processor = processor.processor(self.config)
self.processor.load_data(self.current_dataset.id)
self.processor.display_stats(True)
def slot_display_3d_spheres(self):
self.slot_display_3d(True)
def slot_display_3d(self, spheres = False):
print 'Inside slot_display_3d'
if False == self.processor:
self.processor = processor.processor(self.config)
#save data first so the processor can load it:
print 'Before slot_save'
self.slot_save()
print 'Before load_data'
self.processor.load_data(self.current_dataset.id)
#self.processor.create_polygon_images()
print 'Before process_raw_data'
self.processor.process_raw_data()
#pc.save_mapped_image(name)
print 'Before display_3d'
self.processor.display_3d(self.display_3d_type, spheres)
print 'After display_3d'
def slot_train_and_save_Classifiers(self):
if False == self.processor:
self.processor = processor.processor(self.config)
#save data first so the processor can load it:
self.slot_save()
self.processor.load_data(self.current_dataset.id)
self.processor.train_and_save_Classifiers()
def slot_generate_save_features(self):
if False == self.processor:
self.processor = processor.processor(self.config)
#save data first so the processor can load it:
self.slot_save()
self.processor.load_data(self.current_dataset.id)
self.processor.generate_save_features()
def slot_test_Classifiers(self):
if False == self.processor:
self.processor = processor.processor(self.config)
self.slot_save() #save data first so the processor can load it:
self.processor.load_data(self.current_dataset.id)
self.processor.train_and_save_Classifiers()
self.processor.test_Classifiers()
def slot_test_Classifiers_on_testset(self):
if False == self.processor:
self.processor = processor.processor(self.config)
self.slot_save() #save data first so the processor can load it:
self.processor.load_data(self.current_dataset.id)
self.processor.train_and_save_Classifiers()
self.processor.test_classifiers_on_testset()
def slot_load_Classifiers(self):
if False == self.processor:
self.processor = processor.processor(self.config)
self.processor.load_Classifiers()
def slot_save_Classifier(self):
if False == self.processor:
print 'ERROR: no processor object exists -> no Classifier to save!'
return
self.processor.save_Classifier()
def add_polygon_combobox(self):
combobox = QtGui.QComboBox()
combobox.addItem("Object", QtCore.QVariant("object"))
combobox.addItem("Surface", QtCore.QVariant("surface"))
combobox.addItem("Region of Interest (ROI)", QtCore.QVariant("roi"))
combobox.addItem("Background", QtCore.QVariant("background"))
combobox.addItem("Visible Surface-Edge", QtCore.QVariant("edge"))
combobox.addItem("Wall-Surface-Edge", QtCore.QVariant("edge_up"))
combobox.addItem("Downward-Surface-Edge", QtCore.QVariant("edge_down"))
combobox.setCurrentIndex(0)
self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'), self.slot_update_polygon_labels)
self.polygon_comboboxes.append(combobox)
self.right_layout.addWidget(combobox, QtCore.Qt.AlignTop)
self.slot_update_polygon_labels()
def slot_delete(self):
#delete scan-files:
if os.path.isfile(self.current_dataset.scan_filename):
os.remove(self.path + '/' + self.current_dataset.scan_filename);
if os.path.isfile(self.current_dataset.image_filename):
os.remove(self.path + '/' + self.current_dataset.image_filename);
if os.path.isfile(self.current_dataset.image_artag_filename):
os.remove(self.path + '/' + self.current_dataset.image_artag_filename);
#delete metadata
self.current_dataset = self.scans_database.delete_current_dataset()
self.load_values_from_dataset()
self.slot_save() #save for consistency with files
def slot_save(self):
self.scans_database.save()
def slot_update_surface_type(self):
if True == self.init_in_progress:
return
box = self.surface_type_combobox
self.current_dataset.surface_type = str(box.itemData(box.currentIndex()).toString())
def slot_update_display_3d_type(self):
if True == self.init_in_progress:
return
box = self.display_3d_type_combobox
self.display_3d_type = str(box.itemData(box.currentIndex()).toString())
def slot_update_polygon_label(self, index, label):
if True == self.init_in_progress:
return
box = self.polygon_comboboxes[index]
boxindex = box.findData(QtCore.QVariant(label))
box.setCurrentIndex(boxindex)
self.draw_widget.update()
def slot_update_polygon_labels(self):
if True == self.init_in_progress:
return
for index, box in enumerate(self.polygon_comboboxes):
if index < len(self.current_dataset.polygons):
self.current_dataset.polygons[index].set_label(str(box.itemData(box.currentIndex()).toString()))
print str(index) + " xx " + str(box.itemData(box.currentIndex()).toString())
self.draw_widget.update()
def slot_update_polygons(self, polygons, current_index):
while len(self.polygon_comboboxes) < len(polygons):
self.add_polygon_combobox()
#self.polygon_comboboxes[self.current_polygon_index].x()
for index, box in enumerate(self.polygon_comboboxes):
if index < len(polygons):
self.polygon_comboboxes[index].show()
else:
self.polygon_comboboxes[index].hide()
self.update()
def paintEvent(self, event):
painter = QtGui.QPainter()
painter.begin(self)
x = self.polygon_comboboxes[self.draw_widget.get_current_polygon_index()].x()
y = self.polygon_comboboxes[self.draw_widget.get_current_polygon_index()].y()
color = QtGui.QColor(255,0,0)
painter.setPen(color)
painter.setBrush(color)
painter.drawEllipse(QtCore.QRectF(x-8,y+8,6,6))
painter.end()
def get_display_mode(self):
return self.display_mode
def slot_define_ground_plane(self, ground_plane_points):
#assumes that intensity image is loaded in processor!
(self.current_dataset.ground_plane_normal, self.current_dataset.ground_plane_three_points) = self.processor.get_3d_plane_normal(ground_plane_points)
self.slot_display_intensity() #switch back to image mode
class draw_widget(QtGui.QLabel):
ground_plane_points = []
def __init__(self,polygons, image_filename, parent=None):
QtGui.QWidget.__init__(self, parent)
self.scaleFactor = False #init is done later
self.setBackgroundRole(QtGui.QPalette.Base)
#self.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored)
self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.setScaledContents(True)
self.set_polygons(polygons)
self.set_image(image_filename)
self.setScaleFactor(0.8)
def setScaleFactor(self, f):
self.scaleFactor = f
self.updateImageSize()
def updateImageSize(self):
if self.parent().get_display_mode() == 'intensities' or self.parent().get_display_mode() == 'features':
self.scaleFactor = 1
else:
self.scaleFactor = 0.8
self.parent().resize(900, 700)
self.setMinimumHeight(self.image.height() * self.scaleFactor)
self.setMinimumWidth(self.image.width() * self.scaleFactor)
self.setMaximumHeight(self.image.height() * self.scaleFactor)
self.setMaximumWidth(self.image.width() * self.scaleFactor)
pixmap = QtGui.QPixmap.fromImage(self.image)
self.resize(self.scaleFactor * pixmap.size());
self.setPixmap(pixmap);
def set_polygons(self, polygons):
self.polygons = polygons
self.current_polygon_index = 0
self.update()
self.emit(QtCore.SIGNAL("sigPolyChanged"), self.polygons, self.current_polygon_index)
def set_image(self, filename):
print filename
if os.path.isfile(filename):
self.image = QtGui.QImage(filename)
else:
self.image = QtGui.QImage('noimage.png')
self.updateImageSize()
self.update()
def paintEvent(self, event):
# draw image as label-pixmap
QtGui.QLabel.paintEvent(self,event)
painter = QtGui.QPainter()
painter.begin(self)
if self.parent().get_display_mode() == 'image' or self.parent().get_display_mode() == 'labels':
color = QtGui.QColor(0,0,255)
color_surface = QtGui.QColor(0,255,0)
color_roi = QtGui.QColor(255,255,255)
color_edge = QtGui.QColor(255,255,0)
color_edge_up = QtGui.QColor(255,255,255)
color_edge_down = QtGui.QColor(255,150,255)
color_background = QtGui.QColor(255,0,255)
color_current = QtGui.QColor(255,0,0)
for index, polygon in enumerate(self.polygons):
last_point = (-1,-1)
first = True;
if self.current_polygon_index != index or self.parent().get_display_mode() != 'image':
if polygon.get_label() == 'surface':
painter.setPen(color_surface)
elif polygon.get_label() == 'roi':
painter.setPen(color_roi)
elif polygon.get_label() == 'edge':
painter.setPen(color_edge)
elif polygon.get_label() == 'edge_up':
painter.setPen(color_edge_up)
elif polygon.get_label() == 'edge_down':
painter.setPen(color_edge_down)
elif polygon.get_label() == 'background':
painter.setPen(color_background)
else:
painter.setPen(color)
else:
painter.setPen(color_current)
for point in polygon.get_points():
if False == first:
painter.drawLine(QtCore.QPointF(point[0],point[1]) * self.scaleFactor, QtCore.QPointF(last_point[0],last_point[1]) * self.scaleFactor)
last_point = point
first = False
if (self.parent().get_display_mode() != 'image' or self.current_polygon_index != index ) and polygon.get_type() == 'polygon' and len(polygon.get_points()) :
painter.drawLine(QtCore.QPointF(last_point[0],last_point[1]) * self.scaleFactor, QtCore.QPointF(polygon.get_points()[0][0],polygon.get_points()[0][1]) * self.scaleFactor)
else:
for point in polygon.get_points():
painter.drawEllipse(QtCore.QRectF(point[0] * self.scaleFactor-3,point[1] * self.scaleFactor-3,6,6))
elif self.parent().get_display_mode() == 'intensities':
color = QtGui.QColor(255,0,255)
painter.setPen(color)
for point in self.ground_plane_points:
painter.drawEllipse(QtCore.QRectF(point[0] * self.scaleFactor-3,point[1] * self.scaleFactor-3,6,6))
painter.end()
def mousePressEvent(self,event):
if self.hasFocus():
if self.parent().get_display_mode() == 'image':
if event.button() == QtCore.Qt.LeftButton:
#print 'coords:', x,' ',y
point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)
self.polygons[self.current_polygon_index].add_point(point)
self.update()
self.emit(QtCore.SIGNAL("sigPolyChanged"), self.polygons, self.current_polygon_index)
if event.button() == QtCore.Qt.RightButton:
if False == self.polygons[self.current_polygon_index].is_empty():
self.polygons[self.current_polygon_index].delete_last_point()
self.update()
self.emit(QtCore.SIGNAL("sigPolyChanged"), self.polygons, self.current_polygon_index)
elif self.parent().get_display_mode() == 'intensities':
point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)
print 'point:', point
if True == self.parent().processor.check_3d_plane_point(point):
self.ground_plane_points.append(point)
if len(self.ground_plane_points) < 3:
self.update()
else:
self.emit(QtCore.SIGNAL("sigDefineGroundPlane"), self.ground_plane_points)
self.ground_plane_points = []
elif self.parent().get_display_mode() == 'features':
point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)
if True == self.parent().processor.check_3d_plane_point(point):
print 'point:', point
point3d = self.parent().processor.get_3d_point(point)
print 'point3d',point3d
index = self.parent().processor.get_3d_point_index_in_unrotated(point3d)
self.parent().processor.load_data(self.parent().current_dataset.id)
self.parent().processor.process_raw_data()
self.parent().processor.features.prepare([index])
self.parent().processor.feature_type = 'gaussian_histograms'
fv = self.parent().processor.features.get_featurevector(index,0)
print 'fv',fv
self.parent().processor.display_featurevector(fv)
#reload intensity data for next click
self.parent().processor.load_data(self.parent().current_dataset.id)
self.parent().processor.process_intensities()
#print 'fv:', self.parent().processor.get_point_featurevector(index, self.parent().processor.pts3d_int)
#print 'WARNING: THIS IS NOT WORKING YET BECAUSE OF MISSING INTENSITY INDEX MAPPING FOR GRAZEEFFCT REMOVED PTS'
else:
self.setFocus()
def mouseDoubleClickEvent(self,event):
if self.parent().get_display_mode() == 'image':
if event.button() == QtCore.Qt.LeftButton:
self.start_new_polygon()
self.update()
self.emit(QtCore.SIGNAL("sigPolyChanged"), self.polygons, self.current_polygon_index)
def start_new_polygon(self):
if False == self.polygons[self.current_polygon_index].is_empty():
# if self.current_polygon_index == len(self.polygons) - 1:
self.polygons.append(label_object.label_object()) #last one, append new
self.current_polygon_index = len(self.polygons) - 1
print "new poly index: ", self.current_polygon_index
def delete_empty_polygon(self):
if True == self.polygons[self.current_polygon_index].is_empty():
#and it isn't the only one:
if 1 != len(self.polygons):
del self.polygons[self.current_polygon_index]
if 0 != self.current_polygon_index:
self.current_polygon_index -= 1
print "new poly index: ", self.current_polygon_index
return True
return False
def keyPressEvent(self, event):
key = event.key()
if key == QtCore.Qt.Key_Right:
print 'right'
if self.current_polygon_index < len(self.polygons) - 1:
self.delete_empty_polygon()
self.current_polygon_index += 1
print "czurrent poly index: ", self.current_polygon_index
else:
self.start_new_polygon()
self.parent().slot_update_polygon_labels()
self.update()
self.emit(QtCore.SIGNAL("sigPolyChanged"), self.polygons, self.current_polygon_index)
elif key == QtCore.Qt.Key_Left:
print 'left'
if self.current_polygon_index > 0:
if False == self.delete_empty_polygon():
self.current_polygon_index -= 1
print "current poly index: ", self.current_polygon_index
self.update()
self.emit(QtCore.SIGNAL("sigPolyChanged"), self.polygons, self.current_polygon_index)
elif key == QtCore.Qt.Key_O:
print 'o'
self.emit(QtCore.SIGNAL("sigPolyLabelChanged"), self.current_polygon_index, 'object')
elif key == QtCore.Qt.Key_S:
print 's'
self.emit(QtCore.SIGNAL("sigPolyLabelChanged"), self.current_polygon_index, 'surface')
elif key == QtCore.Qt.Key_R:
print 'r'
self.emit(QtCore.SIGNAL("sigPolyLabelChanged"), self.current_polygon_index, 'roi')
elif key == QtCore.Qt.Key_B:
print 'b'
self.emit(QtCore.SIGNAL("sigPolyLabelChanged"), self.current_polygon_index, 'background')
elif key == QtCore.Qt.Key_E:
print 'e'
self.emit(QtCore.SIGNAL("sigPolyLabelChanged"), self.current_polygon_index, 'edge')
elif key == QtCore.Qt.Key_U:
print 'u'
self.emit(QtCore.SIGNAL("sigPolyLabelChanged"), self.current_polygon_index, 'edge_up')
elif key == QtCore.Qt.Key_D:
print 'd'
self.emit(QtCore.SIGNAL("sigPolyLabelChanged"), self.current_polygon_index, 'edge_down')
elif key == QtCore.Qt.Key_Plus:
print '+'
self.setScaleFactor(self.scaleFactor * 1.25)
self.update()
elif key == QtCore.Qt.Key_Minus:
print '-'
self.setScaleFactor(self.scaleFactor * 0.8)
self.update()
else:
QtGui.QWidget.keyPressEvent(self, event)
def get_polygons(self):
return self.polygons
def get_current_polygon_index(self):
return self.current_polygon_index
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
labeling_tool = labeling_tool(LOC_DATA_LABELING);#
labeling_tool.show()
sys.exit(app.exec_())
| ajibawa-2023/Python-Code-Large/train/row_99488 | 693 | 1,028 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L32_C0", "label": "expression", "type": "expression", "loc": [32, 36], "level": 0, "parent": null, "vector": [8, 0, 0.0331, 0.0049, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\n This source file is not currently supported.\n It was made to help generate classifiers and label the clutter table datasets.\n\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L41_C0", "label": "LOC_DATA_LABELING =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.0399, 0.001, 0, 0.66, 0.0556, 800, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LOC_DATA_LABELING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOC_DATA_LABELING = '/home/jokerman/svn/robot1_data/usr/martin/laser_camera_segmentation/labeling'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L45_C0", "label": "roslib import roslib", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.0438, 0.001, 0, 0.66, 0.1111, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('clutter_segmentation')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L45_C15", "label": "load_manifest()", "type": "expression", "loc": [45, 45], "level": 0, "parent": null, "vector": [8, 0, 0.0438, 0.001, 0, 0.66, 0.1667, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('clutter_segmentation')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:ImportFrom_L46_C0", "label": "from opencv.highgui import cvLoadImage", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.0447, 0.001, 0, 0.66, 0.2222, 453, 0, 1, 0, 0, 453, 0, 0], "semantic": {"name": "opencv.highgui", "arg_names": [], "import_names": ["cvLoadImage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from opencv.highgui import cvLoadImage #unneeded?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:ImportFrom_L48_C0", "label": "from PyQt4 import QtGui, QtCore", "type": "import", "loc": [48, 48], "level": 0, "parent": null, "vector": [1, 0, 0.0467, 0.001, 0, 0.66, 0.2778, 154, 0, 2, 0, 0, 154, 0, 0], "semantic": {"name": "PyQt4", "arg_names": [], "import_names": ["QtGui", "QtCore"], "rhs_call_name": "", "annotation": ""}, "snippet": "from PyQt4 import QtGui, QtCore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L50_C0", "label": "opencv.cv import cv", "type": "import", "loc": [50, 50], "level": 0, "parent": null, "vector": [1, 0, 0.0486, 0.001, 0, 0.66, 0.3333, 718, 0, 1, 0, 0, 718, 0, 0], "semantic": {"name": "opencv.cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import opencv.cv as cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L51_C0", "label": "opencv.highgui import hg", "type": "import", "loc": [51, 51], "level": 0, "parent": null, "vector": [1, 0, 0.0496, 0.001, 0, 0.66, 0.3889, 453, 0, 1, 0, 0, 453, 0, 0], "semantic": {"name": "opencv.highgui", "arg_names": [], "import_names": ["hg"], "rhs_call_name": "", "annotation": ""}, "snippet": "import opencv.highgui as hg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L53_C0", "label": "sys import sys", "type": "import", "loc": [53, 53], "level": 0, "parent": null, "vector": [1, 0, 0.0516, 0.001, 0, 0.66, 0.4444, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L54_C0", "label": "shutil import shutil", "type": "import", "loc": [54, 54], "level": 0, "parent": null, "vector": [1, 0, 0.0525, 0.001, 0, 0.66, 0.5, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil #file operations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L55_C0", "label": "os import os", "type": "import", "loc": [55, 55], "level": 0, "parent": null, "vector": [1, 0, 0.0535, 0.001, 0, 0.66, 0.5556, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L57_C0", "label": "label_object import label_object, scan_dataset, scans_database", "type": "import", "loc": [57, 57], "level": 0, "parent": null, "vector": [1, 0, 0.0554, 0.001, 0, 0.66, 0.6111, 589, 0, 3, 0, 0, 589, 0, 0], "semantic": {"name": "label_object", "arg_names": [], "import_names": ["label_object", "scan_dataset", "scans_database"], "rhs_call_name": "", "annotation": ""}, "snippet": "import label_object, scan_dataset, scans_database"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L60_C0", "label": "canner import canner", "type": "import", "loc": [60, 60], "level": 0, "parent": null, "vector": [1, 0, 0.0584, 0.001, 0, 0.66, 0.6667, 619, 0, 1, 0, 0, 619, 0, 0], "semantic": {"name": "canner", "arg_names": [], "import_names": ["canner"], "rhs_call_name": "", "annotation": ""}, "snippet": "import canner "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L61_C0", "label": "processor import processor", "type": "import", "loc": [61, 61], "level": 0, "parent": null, "vector": [1, 0, 0.0593, 0.001, 0, 0.66, 0.7222, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "processor", "arg_names": [], "import_names": ["processor"], "rhs_call_name": "", "annotation": ""}, "snippet": "import processor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L62_C0", "label": "configuration import configuration", "type": "import", "loc": [62, 62], "level": 0, "parent": null, "vector": [1, 0, 0.0603, 0.001, 0, 0.66, 0.7778, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "import configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Import_L63_C0", "label": "util import ut", "type": "import", "loc": [63, 63], "level": 0, "parent": null, "vector": [1, 0, 0.0613, 0.001, 0, 0.66, 0.8333, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util as ut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "label": "labeling_tool", "type": "class", "loc": [67, 764], "level": 0, "parent": null, "vector": [3, 0, 0.4042, 0.679, 0, 0.66, 0.8889, 408, 0, 40, 0, 0, 246, 0, 99], "semantic": {"name": "labeling_tool", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class labeling_tool(QtGui.QWidget):\n \n draw_widget = None\n display_mode = 'image'\n \n display_3d_type = 'height'\n \n def __init__(self, path, parent=None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L69_C4", "label": "draw_widget =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [14, 1, 0.0671, 0.001, 1, 0.65, 0.0, 636, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "draw_widget", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " draw_widget = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L70_C4", "label": "display_mode =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [14, 1, 0.0681, 0.001, 1, 0.65, 0.0238, 530, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " display_mode = 'image'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L72_C4", "label": "display_3d_type =", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [14, 1, 0.07, 0.001, 1, 0.65, 0.0476, 368, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "display_3d_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " display_3d_type = 'height'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "label": "__init__", "type": "function", "loc": [74, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.1897, 0.2364, 1, 0.65, 0.0714, 555, 0, 3, 0, 0, 0, 0, 99], "semantic": {"name": "__init__", "arg_names": ["self", "path", "parent"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, path, parent=None):\n \n self.init_in_progress = True\n \n self.path = path\n \n # load configs for taking scans, etc:\n self.config = configuration.configuration(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L76_C8", "label": "self.init_in_progress =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0739, 0.001, 2, 0.12, 0.0, 140, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init_in_progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init_in_progress = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L78_C8", "label": "self.path =", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0759, 0.001, 2, 0.12, 0.006, 425, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.path = path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L81_C8", "label": "self.config = configuration()", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0788, 0.001, 2, 0.12, 0.012, 663, 3, 1, 0, 0, 627, 10, 1], "semantic": {"name": "self.config", "arg_names": [], "import_names": [], "rhs_call_name": "configuration", "annotation": ""}, "snippet": " self.config = configuration.configuration(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L83_C8", "label": "self.scanner =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0807, 0.001, 2, 0.12, 0.0181, 509, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scanner = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L84_C8", "label": "self.processor =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0817, 0.001, 2, 0.12, 0.0241, 855, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.processor = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L88_C8", "label": "self.scans_database = scans_database()", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0856, 0.001, 2, 0.12, 0.0301, 180, 3, 0, 0, 0, 332, 10, 1], "semantic": {"name": "self.scans_database", "arg_names": [], "import_names": [], "rhs_call_name": "scans_database", "annotation": ""}, "snippet": " self.scans_database = scans_database.scans_database()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L89_C8", "label": "load()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.0866, 0.001, 2, 0.12, 0.0361, 37, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "load", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " self.scans_database.load(path,'database.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L92_C8", "label": "self.current_dataset = get_dataset()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0895, 0.001, 2, 0.12, 0.0422, 782, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "self.current_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "get_dataset", "annotation": ""}, "snippet": " self.current_dataset = self.scans_database.get_dataset(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L94_C8", "label": "__init__()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.0914, 0.001, 2, 0.12, 0.0482, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " QtGui.QWidget.__init__(self, parent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L95_C8", "label": "setWindowTitle()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.0924, 0.001, 2, 0.12, 0.0542, 38, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setWindowTitle", "arg_names": [], "import_names": [], "rhs_call_name": "setWindowTitle", "annotation": ""}, "snippet": " self.setWindowTitle('labeling tool')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L98_C8", "label": "left_layout = QVBoxLayout()", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0953, 0.001, 2, 0.12, 0.0602, 625, 3, 0, 0, 0, 282, 10, 1], "semantic": {"name": "left_layout", "arg_names": [], "import_names": [], "rhs_call_name": "QVBoxLayout", "annotation": ""}, "snippet": " left_layout = QtGui.QVBoxLayout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L99_C8", "label": "self.draw_widget = draw_widget()", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0963, 0.001, 2, 0.12, 0.0663, 967, 3, 3, 0, 0, 636, 10, 2], "semantic": {"name": "self.draw_widget", "arg_names": [], "import_names": [], "rhs_call_name": "draw_widget", "annotation": ""}, "snippet": " self.draw_widget = draw_widget(self.current_dataset.polygons, self.scans_database.get_path() + '/' + self.current_dataset.image_filename, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L102_C8", "label": "title_layout = QHBoxLayout()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.0992, 0.001, 2, 0.12, 0.0723, 874, 3, 0, 0, 0, 792, 10, 1], "semantic": {"name": "title_layout", "arg_names": [], "import_names": [], "rhs_call_name": "QHBoxLayout", "annotation": ""}, "snippet": " title_layout = QtGui.QHBoxLayout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L104_C8", "label": "take_scan_button = QPushButton()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1012, 0.001, 2, 0.12, 0.0783, 512, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "take_scan_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " take_scan_button = QtGui.QPushButton('Scan')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L105_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1021, 0.001, 2, 0.12, 0.0843, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " take_scan_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L106_C8", "label": "addWidget()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1031, 0.001, 2, 0.12, 0.0904, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(take_scan_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L107_C8", "label": "connect()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1041, 0.001, 2, 0.12, 0.0964, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(take_scan_button, QtCore.SIGNAL('clicked()'), self.slot_take_scan ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L109_C8", "label": "take_artag_image_button = QPushButton()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.106, 0.001, 2, 0.12, 0.1024, 684, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "take_artag_image_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " take_artag_image_button = QtGui.QPushButton('ARTag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L110_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.107, 0.001, 2, 0.12, 0.1084, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " take_artag_image_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L111_C8", "label": "addWidget()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.108, 0.001, 2, 0.12, 0.1145, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(take_artag_image_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L112_C8", "label": "connect()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1089, 0.001, 2, 0.12, 0.1205, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(take_artag_image_button, QtCore.SIGNAL('clicked()'), self.slot_take_artag_image ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L114_C8", "label": "button = QPushButton()", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1109, 0.001, 2, 0.12, 0.1265, 95, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " button = QtGui.QPushButton('Import Img')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L115_C8", "label": "addWidget()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1119, 0.001, 2, 0.12, 0.1325, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L116_C8", "label": "connect()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1128, 0.001, 2, 0.12, 0.1386, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_import_image ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L118_C8", "label": "label = QLabel()", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1148, 0.001, 2, 0.12, 0.1446, 811, 3, 1, 0, 0, 495, 10, 1], "semantic": {"name": "label", "arg_names": [], "import_names": [], "rhs_call_name": "QLabel", "annotation": ""}, "snippet": " label = QtGui.QLabel(\"View: \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L119_C8", "label": "addWidget()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1158, 0.001, 2, 0.12, 0.1506, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(label)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L120_C8", "label": "self.display_3d_button = QPushButton()", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1167, 0.001, 2, 0.12, 0.1566, 811, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "self.display_3d_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " self.display_3d_button = QtGui.QPushButton('3D')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L121_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1177, 0.001, 2, 0.12, 0.1627, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " self.display_3d_button.setMaximumWidth(40)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L122_C8", "label": "addWidget()", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1187, 0.001, 2, 0.12, 0.1687, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(self.display_3d_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L123_C8", "label": "connect()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1196, 0.001, 2, 0.12, 0.1747, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.display_3d_button, QtCore.SIGNAL('clicked()'), self.slot_display_3d )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L125_C8", "label": "combobox = QComboBox()", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1216, 0.001, 2, 0.12, 0.1807, 460, 3, 0, 0, 0, 556, 10, 1], "semantic": {"name": "combobox", "arg_names": [], "import_names": [], "rhs_call_name": "QComboBox", "annotation": ""}, "snippet": " combobox = QtGui.QComboBox()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L126_C8", "label": "addItem()", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1226, 0.001, 2, 0.12, 0.1867, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Height\", QtCore.QVariant(\"height\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L127_C8", "label": "addItem()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1235, 0.001, 2, 0.12, 0.1928, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Intensities\", QtCore.QVariant(\"intensities\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L129_C8", "label": "addItem()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1255, 0.001, 2, 0.12, 0.1988, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Labels\", QtCore.QVariant(\"labels\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L130_C8", "label": "addItem()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1265, 0.001, 2, 0.12, 0.2048, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Classifier range\", QtCore.QVariant(\"range\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L131_C8", "label": "addItem()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1274, 0.001, 2, 0.12, 0.2108, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Classifier color\", QtCore.QVariant(\"color\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L132_C8", "label": "addItem()", "type": "expression", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1284, 0.001, 2, 0.12, 0.2169, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Classifier all\", QtCore.QVariant(\"all\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L133_C8", "label": "addItem()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1294, 0.001, 2, 0.12, 0.2229, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Classifier all+post\", QtCore.QVariant(\"all_post\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L134_C8", "label": "addItem()", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1304, 0.001, 2, 0.12, 0.2289, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Baseline algo\", QtCore.QVariant(\"baseline\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L135_C8", "label": "addItem()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1313, 0.001, 2, 0.12, 0.2349, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"h\", QtCore.QVariant(\"h\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L136_C8", "label": "addItem()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1323, 0.001, 2, 0.12, 0.241, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"s\", QtCore.QVariant(\"s\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L137_C8", "label": "addItem()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1333, 0.001, 2, 0.12, 0.247, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"v\", QtCore.QVariant(\"v\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L138_C8", "label": "connect()", "type": "expression", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1342, 0.001, 2, 0.12, 0.253, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'), self.slot_update_display_3d_type) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L139_C8", "label": "addWidget()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1352, 0.001, 2, 0.12, 0.259, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(combobox)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L140_C8", "label": "self.display_3d_type_combobox =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1362, 0.001, 2, 0.12, 0.2651, 882, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.display_3d_type_combobox", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_3d_type_combobox = combobox; "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L143_C8", "label": "self.display_3d_spheres_button = QPushButton()", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1391, 0.001, 2, 0.12, 0.2711, 6, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "self.display_3d_spheres_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " self.display_3d_spheres_button = QtGui.QPushButton('3D_Spheres')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L144_C8", "label": "addWidget()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1401, 0.001, 2, 0.12, 0.2771, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(self.display_3d_spheres_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L145_C8", "label": "connect()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1411, 0.001, 2, 0.12, 0.2831, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.display_3d_spheres_button, QtCore.SIGNAL('clicked()'), self.slot_display_3d_spheres ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L146_C8", "label": "self.display_intensity_button = QPushButton()", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.142, 0.001, 2, 0.12, 0.2892, 740, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "self.display_intensity_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " self.display_intensity_button = QtGui.QPushButton('Intensity')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L147_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.143, 0.001, 2, 0.12, 0.2952, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " self.display_intensity_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L148_C8", "label": "addWidget()", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.144, 0.001, 2, 0.12, 0.3012, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(self.display_intensity_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L149_C8", "label": "connect()", "type": "expression", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1449, 0.001, 2, 0.12, 0.3072, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.display_intensity_button, QtCore.SIGNAL('clicked()'), self.slot_display_intensity ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L150_C8", "label": "self.display_features_button = QPushButton()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1459, 0.001, 2, 0.12, 0.3133, 750, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "self.display_features_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " self.display_features_button = QtGui.QPushButton('Features')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L151_C8", "label": "addWidget()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1469, 0.001, 2, 0.12, 0.3193, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(self.display_features_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L152_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1479, 0.001, 2, 0.12, 0.3253, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " self.display_features_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L153_C8", "label": "connect()", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1488, 0.001, 2, 0.12, 0.3313, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.display_features_button, QtCore.SIGNAL('clicked()'), self.slot_display_features ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L154_C8", "label": "self.display_labels_button = QPushButton()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1498, 0.001, 2, 0.12, 0.3373, 713, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "self.display_labels_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " self.display_labels_button = QtGui.QPushButton('Labels')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L155_C8", "label": "addWidget()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1508, 0.001, 2, 0.12, 0.3434, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(self.display_labels_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L156_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1518, 0.001, 2, 0.12, 0.3494, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " self.display_labels_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L157_C8", "label": "connect()", "type": "expression", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1527, 0.001, 2, 0.12, 0.3554, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.display_labels_button, QtCore.SIGNAL('clicked()'), self.slot_display_labels ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L159_C8", "label": "self.display_masks_button = QPushButton()", "type": "assigned_variable", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1547, 0.001, 2, 0.12, 0.3614, 837, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "self.display_masks_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " self.display_masks_button = QtGui.QPushButton('Masks')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L160_C8", "label": "addWidget()", "type": "expression", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1556, 0.001, 2, 0.12, 0.3675, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(self.display_masks_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L161_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1566, 0.001, 2, 0.12, 0.3735, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " self.display_masks_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L162_C8", "label": "connect()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1576, 0.001, 2, 0.12, 0.3795, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.display_masks_button, QtCore.SIGNAL('clicked()'), self.slot_display_masks ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L164_C8", "label": "self.display_stats_button = QPushButton()", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1595, 0.001, 2, 0.12, 0.3855, 608, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "self.display_stats_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " self.display_stats_button = QtGui.QPushButton('Stats')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L165_C8", "label": "addWidget()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1605, 0.001, 2, 0.12, 0.3916, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(self.display_stats_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L166_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1615, 0.001, 2, 0.12, 0.3976, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " self.display_stats_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L167_C8", "label": "connect()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1625, 0.001, 2, 0.12, 0.4036, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.display_stats_button, QtCore.SIGNAL('clicked()'), self.slot_display_stats ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L168_C8", "label": "self.display_global_stats_button = QPushButton()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1634, 0.001, 2, 0.12, 0.4096, 510, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "self.display_global_stats_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " self.display_global_stats_button = QtGui.QPushButton('Global Stats')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L169_C8", "label": "addWidget()", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1644, 0.001, 2, 0.12, 0.4157, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(self.display_global_stats_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L170_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1654, 0.001, 2, 0.12, 0.4217, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " self.display_global_stats_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L171_C8", "label": "connect()", "type": "expression", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1663, 0.001, 2, 0.12, 0.4277, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.display_global_stats_button, QtCore.SIGNAL('clicked()'), self.slot_display_global_stats ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L173_C8", "label": "self.line_edits =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1683, 0.001, 2, 0.12, 0.4337, 438, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.line_edits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.line_edits = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L175_C8", "label": "add_line_edit()", "type": "expression", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1702, 0.001, 2, 0.12, 0.4398, 56, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_line_edit", "arg_names": [], "import_names": [], "rhs_call_name": "add_line_edit", "annotation": ""}, "snippet": " self.add_line_edit('Title:',title_layout,'title')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L178_C8", "label": "first_dataset_button = QPushButton()", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1732, 0.001, 2, 0.12, 0.4458, 970, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "first_dataset_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " first_dataset_button = QtGui.QPushButton('<<')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L179_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1741, 0.001, 2, 0.12, 0.4518, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " first_dataset_button.setMaximumWidth(30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L180_C8", "label": "addWidget()", "type": "expression", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1751, 0.001, 2, 0.12, 0.4578, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(first_dataset_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L181_C8", "label": "connect()", "type": "expression", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1761, 0.001, 2, 0.12, 0.4639, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(first_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_first_dataset )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L182_C8", "label": "prev_dataset_button = QPushButton()", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.177, 0.001, 2, 0.12, 0.4699, 870, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "prev_dataset_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " prev_dataset_button = QtGui.QPushButton('<')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L183_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.178, 0.001, 2, 0.12, 0.4759, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " prev_dataset_button.setMaximumWidth(30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L184_C8", "label": "addWidget()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.179, 0.001, 2, 0.12, 0.4819, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(prev_dataset_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L185_C8", "label": "connect()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.18, 0.001, 2, 0.12, 0.488, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(prev_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_prev_dataset )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L186_C8", "label": "next_dataset_button = QPushButton()", "type": "assigned_variable", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1809, 0.001, 2, 0.12, 0.494, 171, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "next_dataset_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " next_dataset_button = QtGui.QPushButton('>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L187_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1819, 0.001, 2, 0.12, 0.5, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " next_dataset_button.setMaximumWidth(30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L188_C8", "label": "addWidget()", "type": "expression", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1829, 0.001, 2, 0.12, 0.506, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(next_dataset_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L189_C8", "label": "connect()", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1839, 0.001, 2, 0.12, 0.512, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(next_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_next_dataset )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L190_C8", "label": "last_dataset_button = QPushButton()", "type": "assigned_variable", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1848, 0.001, 2, 0.12, 0.5181, 656, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "last_dataset_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " last_dataset_button = QtGui.QPushButton('>>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L191_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1858, 0.001, 2, 0.12, 0.5241, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " last_dataset_button.setMaximumWidth(30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L192_C8", "label": "addWidget()", "type": "expression", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1868, 0.001, 2, 0.12, 0.5301, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(last_dataset_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L193_C8", "label": "connect()", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1877, 0.001, 2, 0.12, 0.5361, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(last_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_last_dataset ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L195_C8", "label": "save_button = QPushButton()", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1897, 0.001, 2, 0.12, 0.5422, 317, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "save_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " save_button = QtGui.QPushButton('Save')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L196_C8", "label": "addWidget()", "type": "expression", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1907, 0.001, 2, 0.12, 0.5482, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(save_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L197_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1916, 0.001, 2, 0.12, 0.5542, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " save_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L198_C8", "label": "connect()", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1926, 0.001, 2, 0.12, 0.5602, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(save_button, QtCore.SIGNAL('clicked()'), self.slot_save )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L200_C8", "label": "delete_button = QPushButton()", "type": "assigned_variable", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.1946, 0.001, 2, 0.12, 0.5663, 267, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "delete_button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " delete_button = QtGui.QPushButton('Delete')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L201_C8", "label": "addWidget()", "type": "expression", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1955, 0.001, 2, 0.12, 0.5723, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " title_layout.addWidget(delete_button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L202_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1965, 0.001, 2, 0.12, 0.5783, 668, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " delete_button.setMaximumWidth(50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L203_C8", "label": "connect()", "type": "expression", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.1975, 0.001, 2, 0.12, 0.5843, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(delete_button, QtCore.SIGNAL('clicked()'), self.slot_delete ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L206_C8", "label": "connect()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2004, 0.001, 2, 0.12, 0.5904, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.draw_widget, QtCore.SIGNAL('sigPolyChanged'), self.slot_update_polygons)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L207_C8", "label": "connect()", "type": "expression", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2014, 0.001, 2, 0.12, 0.5964, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.draw_widget, QtCore.SIGNAL('sigPolyLabelChanged'), self.slot_update_polygon_label)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L208_C8", "label": "connect()", "type": "expression", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2023, 0.001, 2, 0.12, 0.6024, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(self.draw_widget, QtCore.SIGNAL('sigDefineGroundPlane'), self.slot_define_ground_plane)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L210_C8", "label": "addLayout()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2043, 0.001, 2, 0.12, 0.6084, 293, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addLayout", "arg_names": [], "import_names": [], "rhs_call_name": "addLayout", "annotation": ""}, "snippet": " left_layout.addLayout(title_layout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L213_C8", "label": "row2_layout = QHBoxLayout()", "type": "assigned_variable", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2072, 0.001, 2, 0.12, 0.6145, 928, 3, 0, 0, 0, 792, 10, 1], "semantic": {"name": "row2_layout", "arg_names": [], "import_names": [], "rhs_call_name": "QHBoxLayout", "annotation": ""}, "snippet": " row2_layout = QtGui.QHBoxLayout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L214_C8", "label": "addLayout()", "type": "expression", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2082, 0.001, 2, 0.12, 0.6205, 293, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addLayout", "arg_names": [], "import_names": [], "rhs_call_name": "addLayout", "annotation": ""}, "snippet": " left_layout.addLayout(row2_layout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L217_C8", "label": "label = QLabel()", "type": "assigned_variable", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2111, 0.001, 2, 0.12, 0.6265, 811, 3, 1, 0, 0, 495, 10, 1], "semantic": {"name": "label", "arg_names": [], "import_names": [], "rhs_call_name": "QLabel", "annotation": ""}, "snippet": " label = QtGui.QLabel(\"Id:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L218_C8", "label": "addWidget()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2121, 0.001, 2, 0.12, 0.6325, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row2_layout.addWidget(label) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L219_C8", "label": "self.id_label = QLabel()", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.213, 0.001, 2, 0.12, 0.6386, 590, 3, 1, 0, 0, 495, 10, 1], "semantic": {"name": "self.id_label", "arg_names": [], "import_names": [], "rhs_call_name": "QLabel", "annotation": ""}, "snippet": " self.id_label = QtGui.QLabel(\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L220_C8", "label": "addWidget()", "type": "expression", "loc": [220, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.214, 0.001, 2, 0.12, 0.6446, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row2_layout.addWidget(self.id_label) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L222_C8", "label": "add_line_edit()", "type": "expression", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.216, 0.001, 2, 0.12, 0.6506, 56, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_line_edit", "arg_names": [], "import_names": [], "rhs_call_name": "add_line_edit", "annotation": ""}, "snippet": " self.add_line_edit('Surface: ID:',row2_layout,'surface_id')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L223_C8", "label": "add_line_edit()", "type": "expression", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2169, 0.001, 2, 0.12, 0.6566, 56, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_line_edit", "arg_names": [], "import_names": [], "rhs_call_name": "add_line_edit", "annotation": ""}, "snippet": " self.add_line_edit('Height',row2_layout,'surface_height')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L226_C8", "label": "label = QLabel()", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2198, 0.001, 2, 0.12, 0.6627, 811, 3, 1, 0, 0, 495, 10, 1], "semantic": {"name": "label", "arg_names": [], "import_names": [], "rhs_call_name": "QLabel", "annotation": ""}, "snippet": " label = QtGui.QLabel(\"Type: \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L227_C8", "label": "addWidget()", "type": "expression", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2208, 0.001, 2, 0.12, 0.6687, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row2_layout.addWidget(label)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L228_C8", "label": "combobox = QComboBox()", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2218, 0.001, 2, 0.12, 0.6747, 460, 3, 0, 0, 0, 556, 10, 1], "semantic": {"name": "combobox", "arg_names": [], "import_names": [], "rhs_call_name": "QComboBox", "annotation": ""}, "snippet": " combobox = QtGui.QComboBox()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L229_C8", "label": "addItem()", "type": "expression", "loc": [229, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2228, 0.001, 2, 0.12, 0.6807, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Table Office\", QtCore.QVariant(\"table_office\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L230_C8", "label": "addItem()", "type": "expression", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2237, 0.001, 2, 0.12, 0.6867, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Table Dorm\", QtCore.QVariant(\"table_dorm\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L231_C8", "label": "addItem()", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2247, 0.001, 2, 0.12, 0.6928, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Table House\", QtCore.QVariant(\"table_house\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L232_C8", "label": "addItem()", "type": "expression", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2257, 0.001, 2, 0.12, 0.6988, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Shelf Office\", QtCore.QVariant(\"shelf_office\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L233_C8", "label": "addItem()", "type": "expression", "loc": [233, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2267, 0.001, 2, 0.12, 0.7048, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Shelf Dorm\", QtCore.QVariant(\"shelf_dorm\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L234_C8", "label": "addItem()", "type": "expression", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2276, 0.001, 2, 0.12, 0.7108, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Shelf House\", QtCore.QVariant(\"shelf_house\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L235_C8", "label": "connect()", "type": "expression", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2286, 0.001, 2, 0.12, 0.7169, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'), self.slot_update_surface_type) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L236_C8", "label": "addWidget()", "type": "expression", "loc": [236, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2296, 0.001, 2, 0.12, 0.7229, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row2_layout.addWidget(combobox)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L237_C8", "label": "self.surface_type_combobox =", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2305, 0.001, 2, 0.12, 0.7289, 962, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.surface_type_combobox", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.surface_type_combobox = combobox;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L239_C8", "label": "add_line_edit()", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2325, 0.001, 2, 0.12, 0.7349, 56, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_line_edit", "arg_names": [], "import_names": [], "rhs_call_name": "add_line_edit", "annotation": ""}, "snippet": " self.add_line_edit('Camera: Height:',row2_layout,'camera_height')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L240_C8", "label": "add_line_edit()", "type": "expression", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2335, 0.001, 2, 0.12, 0.741, 56, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_line_edit", "arg_names": [], "import_names": [], "rhs_call_name": "add_line_edit", "annotation": ""}, "snippet": " self.add_line_edit('Camera: Angle:',row2_layout,'camera_angle')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L244_C8", "label": "row3_layout = QHBoxLayout()", "type": "assigned_variable", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2374, 0.001, 2, 0.12, 0.747, 667, 3, 0, 0, 0, 792, 10, 1], "semantic": {"name": "row3_layout", "arg_names": [], "import_names": [], "rhs_call_name": "QHBoxLayout", "annotation": ""}, "snippet": " row3_layout = QtGui.QHBoxLayout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L245_C8", "label": "addLayout()", "type": "expression", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2383, 0.001, 2, 0.12, 0.753, 293, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addLayout", "arg_names": [], "import_names": [], "rhs_call_name": "addLayout", "annotation": ""}, "snippet": " left_layout.addLayout(row3_layout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L248_C8", "label": "button = QPushButton()", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2412, 0.001, 2, 0.12, 0.759, 95, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " button = QtGui.QPushButton(\"&gen'n'save features\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L249_C8", "label": "addWidget()", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2422, 0.001, 2, 0.12, 0.7651, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row3_layout.addWidget(button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L250_C8", "label": "connect()", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2432, 0.001, 2, 0.12, 0.7711, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_generate_save_features ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L252_C8", "label": "checkbox = QCheckBox()", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2451, 0.001, 2, 0.12, 0.7771, 706, 3, 1, 0, 0, 246, 10, 1], "semantic": {"name": "checkbox", "arg_names": [], "import_names": [], "rhs_call_name": "QCheckBox", "annotation": ""}, "snippet": " checkbox = QtGui.QCheckBox('&Training Set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L253_C8", "label": "addWidget()", "type": "expression", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2461, 0.001, 2, 0.12, 0.7831, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row3_layout.addWidget(checkbox)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L254_C8", "label": "connect()", "type": "expression", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2471, 0.001, 2, 0.12, 0.7892, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_training_set) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L255_C8", "label": "self.checkbox_training_set =", "type": "assigned_variable", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2481, 0.001, 2, 0.12, 0.7952, 898, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.checkbox_training_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.checkbox_training_set = checkbox"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L257_C8", "label": "checkbox = QCheckBox()", "type": "assigned_variable", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.25, 0.001, 2, 0.12, 0.8012, 706, 3, 1, 0, 0, 246, 10, 1], "semantic": {"name": "checkbox", "arg_names": [], "import_names": [], "rhs_call_name": "QCheckBox", "annotation": ""}, "snippet": " checkbox = QtGui.QCheckBox('Te&st Set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L258_C8", "label": "addWidget()", "type": "expression", "loc": [258, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.251, 0.001, 2, 0.12, 0.8072, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row3_layout.addWidget(checkbox)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L259_C8", "label": "connect()", "type": "expression", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2519, 0.001, 2, 0.12, 0.8133, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_test_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L260_C8", "label": "self.checkbox_test_set =", "type": "assigned_variable", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2529, 0.001, 2, 0.12, 0.8193, 372, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.checkbox_test_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.checkbox_test_set = checkbox "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L262_C8", "label": "checkbox = QCheckBox()", "type": "assigned_variable", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2549, 0.001, 2, 0.12, 0.8253, 706, 3, 1, 0, 0, 246, 10, 1], "semantic": {"name": "checkbox", "arg_names": [], "import_names": [], "rhs_call_name": "QCheckBox", "annotation": ""}, "snippet": " checkbox = QtGui.QCheckBox('Labels, Groundp. checked')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L263_C8", "label": "addWidget()", "type": "expression", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2558, 0.001, 2, 0.12, 0.8313, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row3_layout.addWidget(checkbox)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L264_C8", "label": "connect()", "type": "expression", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2568, 0.001, 2, 0.12, 0.8373, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_is_labeled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L265_C8", "label": "self.checkbox_is_labeled =", "type": "assigned_variable", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2578, 0.001, 2, 0.12, 0.8434, 442, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.checkbox_is_labeled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.checkbox_is_labeled = checkbox "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L267_C8", "label": "button = QPushButton()", "type": "assigned_variable", "loc": [267, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2597, 0.001, 2, 0.12, 0.8494, 95, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " button = QtGui.QPushButton(\"Train'n'save Classifiers (training set)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L268_C8", "label": "addWidget()", "type": "expression", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2607, 0.001, 2, 0.12, 0.8554, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row3_layout.addWidget(button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L269_C8", "label": "connect()", "type": "expression", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2617, 0.001, 2, 0.12, 0.8614, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_train_and_save_Classifiers )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L271_C8", "label": "button = QPushButton()", "type": "assigned_variable", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2636, 0.001, 2, 0.12, 0.8675, 95, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " button = QtGui.QPushButton('Test Classifiers (on current)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L272_C8", "label": "addWidget()", "type": "expression", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2646, 0.001, 2, 0.12, 0.8735, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row3_layout.addWidget(button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L273_C8", "label": "connect()", "type": "expression", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2656, 0.001, 2, 0.12, 0.8795, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_test_Classifiers )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L275_C8", "label": "button = QPushButton()", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2675, 0.001, 2, 0.12, 0.8855, 95, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " button = QtGui.QPushButton('Test Classifiers (on testset)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L276_C8", "label": "addWidget()", "type": "expression", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2685, 0.001, 2, 0.12, 0.8916, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row3_layout.addWidget(button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L277_C8", "label": "connect()", "type": "expression", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2695, 0.001, 2, 0.12, 0.8976, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_test_Classifiers_on_testset ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L279_C8", "label": "button = QPushButton()", "type": "assigned_variable", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2714, 0.001, 2, 0.12, 0.9036, 95, 3, 1, 0, 0, 545, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "QPushButton", "annotation": ""}, "snippet": " button = QtGui.QPushButton('Load Classifiers')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L280_C8", "label": "addWidget()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2724, 0.001, 2, 0.12, 0.9096, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " row3_layout.addWidget(button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L281_C8", "label": "connect()", "type": "expression", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2733, 0.001, 2, 0.12, 0.9157, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_load_Classifiers )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L289_C8", "label": "addWidget()", "type": "expression", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2811, 0.001, 2, 0.12, 0.9217, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " left_layout.addWidget(self.draw_widget)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L292_C8", "label": "self.right_layout = QVBoxLayout()", "type": "assigned_variable", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.284, 0.001, 2, 0.12, 0.9277, 683, 3, 0, 0, 0, 282, 10, 1], "semantic": {"name": "self.right_layout", "arg_names": [], "import_names": [], "rhs_call_name": "QVBoxLayout", "annotation": ""}, "snippet": " self.right_layout = QtGui.QVBoxLayout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L293_C8", "label": "setAlignment()", "type": "expression", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.285, 0.001, 2, 0.12, 0.9337, 346, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setAlignment", "arg_names": [], "import_names": [], "rhs_call_name": "setAlignment", "annotation": ""}, "snippet": " self.right_layout.setAlignment(QtCore.Qt.AlignTop)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L295_C8", "label": "self.outer_layout = QHBoxLayout()", "type": "assigned_variable", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.287, 0.001, 2, 0.12, 0.9398, 969, 3, 0, 0, 0, 792, 10, 1], "semantic": {"name": "self.outer_layout", "arg_names": [], "import_names": [], "rhs_call_name": "QHBoxLayout", "annotation": ""}, "snippet": " self.outer_layout = QtGui.QHBoxLayout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L296_C8", "label": "addLayout()", "type": "expression", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2879, 0.001, 2, 0.12, 0.9458, 293, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addLayout", "arg_names": [], "import_names": [], "rhs_call_name": "addLayout", "annotation": ""}, "snippet": " self.outer_layout.addLayout(left_layout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L297_C8", "label": "addLayout()", "type": "expression", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2889, 0.001, 2, 0.12, 0.9518, 293, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addLayout", "arg_names": [], "import_names": [], "rhs_call_name": "addLayout", "annotation": ""}, "snippet": " self.outer_layout.addLayout(self.right_layout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L301_C8", "label": "self.polygon_comboboxes =", "type": "assigned_variable", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.2928, 0.001, 2, 0.12, 0.9578, 864, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.polygon_comboboxes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.polygon_comboboxes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L302_C8", "label": "add_polygon_combobox()", "type": "expression", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2938, 0.001, 2, 0.12, 0.9639, 59, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "add_polygon_combobox", "arg_names": [], "import_names": [], "rhs_call_name": "add_polygon_combobox", "annotation": ""}, "snippet": " self.add_polygon_combobox()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L304_C8", "label": "slot_update_polygons()", "type": "expression", "loc": [304, 304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2957, 0.001, 2, 0.12, 0.9699, 576, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "slot_update_polygons", "arg_names": [], "import_names": [], "rhs_call_name": "slot_update_polygons", "annotation": ""}, "snippet": " self.slot_update_polygons(self.current_dataset.polygons,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L307_C8", "label": "setLayout()", "type": "expression", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.2986, 0.001, 2, 0.12, 0.9759, 375, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setLayout", "arg_names": [], "import_names": [], "rhs_call_name": "setLayout", "annotation": ""}, "snippet": " self.setLayout(self.outer_layout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L310_C8", "label": "resize()", "type": "expression", "loc": [310, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.3016, 0.001, 2, 0.12, 0.9819, 834, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "resize", "arg_names": [], "import_names": [], "rhs_call_name": "resize", "annotation": ""}, "snippet": " self.resize(900, 700) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L311_C8", "label": "load_values_from_dataset()", "type": "expression", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.3025, 0.001, 2, 0.12, 0.988, 632, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load_values_from_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "load_values_from_dataset", "annotation": ""}, "snippet": " self.load_values_from_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L313_C8", "label": "self.init_in_progress =", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [14, 2, 0.3045, 0.001, 2, 0.12, 0.994, 140, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init_in_progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init_in_progress = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L316_C8", "label": "slot_last_dataset()", "type": "expression", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "vector": [8, 2, 0.3074, 0.001, 2, 0.12, 1.0, 765, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_last_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "slot_last_dataset", "annotation": ""}, "snippet": " self.slot_last_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L319_C4", "label": "slot_update_training_set", "type": "function", "loc": [319, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3123, 0.0049, 1, 0.65, 0.0952, 931, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "slot_update_training_set", "arg_names": ["self", "checkState"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_update_training_set(self, checkState):\n if checkState:\n self.current_dataset.is_training_set = True\n else:\n self.current_dataset.is_training_set = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L320_C8", "label": "if", "type": "if", "loc": [320, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L319_C4", "vector": [4, 2, 0.3127, 0.0039, 2, 0.19, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if checkState:\n self.current_dataset.is_training_set = True\n else:\n self.current_dataset.is_training_set = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L321_C12", "label": "self.current_dataset.is_training_set =", "type": "assigned_variable", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L320_C8", "vector": [14, 3, 0.3123, 0.001, 3, 0.42, 0.0, 303, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.current_dataset.is_training_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset.is_training_set = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L323_C12", "label": "self.current_dataset.is_training_set =", "type": "assigned_variable", "loc": [323, 323], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L320_C8", "vector": [14, 3, 0.3142, 0.001, 3, 0.42, 1.0, 303, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.current_dataset.is_training_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset.is_training_set = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L325_C4", "label": "slot_update_test_set", "type": "function", "loc": [325, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3181, 0.0049, 1, 0.65, 0.119, 991, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "slot_update_test_set", "arg_names": ["self", "checkState"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_update_test_set(self, checkState):\n if checkState:\n self.current_dataset.is_test_set = True\n else:\n self.current_dataset.is_test_set = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L326_C8", "label": "if", "type": "if", "loc": [326, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L325_C4", "vector": [4, 2, 0.3186, 0.0039, 2, 0.1, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if checkState:\n self.current_dataset.is_test_set = True\n else:\n self.current_dataset.is_test_set = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L327_C12", "label": "self.current_dataset.is_test_set =", "type": "assigned_variable", "loc": [327, 327], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L326_C8", "vector": [14, 3, 0.3181, 0.001, 3, 0.32, 0.0, 975, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.current_dataset.is_test_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset.is_test_set = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L329_C12", "label": "self.current_dataset.is_test_set =", "type": "assigned_variable", "loc": [329, 329], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L326_C8", "vector": [14, 3, 0.32, 0.001, 3, 0.32, 1.0, 975, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.current_dataset.is_test_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset.is_test_set = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L331_C4", "label": "slot_update_is_labeled", "type": "function", "loc": [331, 335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3239, 0.0049, 1, 0.65, 0.1429, 560, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "slot_update_is_labeled", "arg_names": ["self", "checkState"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_update_is_labeled(self, checkState):\n if checkState:\n self.current_dataset.is_labeled = True\n else:\n self.current_dataset.is_labeled = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L332_C8", "label": "if", "type": "if", "loc": [332, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L331_C4", "vector": [4, 2, 0.3244, 0.0039, 2, 0.34, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if checkState:\n self.current_dataset.is_labeled = True\n else:\n self.current_dataset.is_labeled = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L333_C12", "label": "self.current_dataset.is_labeled =", "type": "assigned_variable", "loc": [333, 333], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L332_C8", "vector": [14, 3, 0.3239, 0.001, 3, 0.27, 0.0, 562, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.current_dataset.is_labeled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset.is_labeled = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L335_C12", "label": "self.current_dataset.is_labeled =", "type": "assigned_variable", "loc": [335, 335], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L332_C8", "vector": [14, 3, 0.3259, 0.001, 3, 0.27, 1.0, 562, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.current_dataset.is_labeled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset.is_labeled = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L337_C4", "label": "closeEvent", "type": "function", "loc": [337, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3288, 0.0029, 1, 0.65, 0.1667, 238, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "closeEvent", "arg_names": ["self", "x"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def closeEvent(self, x):\n print(\"Exit: saving database...\")\n self.slot_save() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L338_C8", "label": "print()", "type": "expression", "loc": [338, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L337_C4", "vector": [8, 2, 0.3288, 0.001, 2, 0.01, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Exit: saving database...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L339_C8", "label": "slot_save()", "type": "expression", "loc": [339, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L337_C4", "vector": [8, 2, 0.3298, 0.001, 2, 0.01, 1.0, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "label": "slot_import_image", "type": "function", "loc": [341, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.339, 0.0156, 1, 0.65, 0.1905, 756, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "slot_import_image", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_import_image(self):\n fileName = QtGui.QFileDialog.getOpenFileName(self,\"Open Image\", self.path, \"Image Files (*.png)\")\n print(\"Import image into new dataset:\" + fileName)\n \n name = ut.formatted_time()\n \n new_dataset = scan_dataset.scan_dataset()\n new_dataset.id = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L342_C8", "label": "fileName = getOpenFileName()", "type": "assigned_variable", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [14, 2, 0.3327, 0.001, 2, 0.96, 0.0, 282, 3, 4, 0, 0, 709, 10, 1], "semantic": {"name": "fileName", "arg_names": [], "import_names": [], "rhs_call_name": "getOpenFileName", "annotation": ""}, "snippet": " fileName = QtGui.QFileDialog.getOpenFileName(self,\"Open Image\", self.path, \"Image Files (*.png)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L343_C8", "label": "print()", "type": "expression", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [8, 2, 0.3337, 0.001, 2, 0.96, 0.125, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Import image into new dataset:\" + fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L345_C8", "label": "name = formatted_time()", "type": "assigned_variable", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [14, 2, 0.3356, 0.001, 2, 0.96, 0.25, 57, 3, 0, 0, 0, 353, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "formatted_time", "annotation": ""}, "snippet": " name = ut.formatted_time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L347_C8", "label": "new_dataset = scan_dataset()", "type": "assigned_variable", "loc": [347, 347], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [14, 2, 0.3375, 0.001, 2, 0.96, 0.375, 146, 3, 0, 0, 0, 727, 10, 1], "semantic": {"name": "new_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "scan_dataset", "annotation": ""}, "snippet": " new_dataset = scan_dataset.scan_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L348_C8", "label": "new_dataset.id =", "type": "assigned_variable", "loc": [348, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [14, 2, 0.3385, 0.001, 2, 0.96, 0.5, 229, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_dataset.id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_dataset.id = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L349_C8", "label": "new_dataset.image_filename =", "type": "assigned_variable", "loc": [349, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [14, 2, 0.3395, 0.001, 2, 0.96, 0.625, 750, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_dataset.image_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_dataset.image_filename = 'data/'+name+'_image.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L350_C8", "label": "copy()", "type": "expression", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [8, 2, 0.3405, 0.001, 2, 0.96, 0.75, 739, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " shutil.copy(fileName,self.path+'/'+new_dataset.image_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L352_C8", "label": "add_dataset()", "type": "expression", "loc": [352, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [8, 2, 0.3424, 0.001, 2, 0.96, 0.875, 326, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "add_dataset", "annotation": ""}, "snippet": " self.scans_database.add_dataset(new_dataset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:While_L355_C8", "label": "while", "type": "while", "loc": [355, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "vector": [5, 2, 0.3458, 0.0019, 2, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True == self.slot_next_dataset():\n pass "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "label": "add_line_edit", "type": "function", "loc": [359, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3531, 0.0088, 1, 0.65, 0.2143, 56, 0, 4, 1, 0, 0, 0, 8], "semantic": {"name": "add_line_edit", "arg_names": ["self", "label", "layout", "variable"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_line_edit(self,label, layout, variable):\n label = QtGui.QLabel(label)\n line_edit = QtGui.QLineEdit()\n line_edit.setMinimumWidth(80)\n self.line_edits.append((line_edit,variable))\n layout.addWidget(label)\n layout.addWidget(line_edit)\n self.connect(line_edit, QtCore.SIGNAL('textEdited (const QString&)'), self.slot_line_edit_changed ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L360_C8", "label": "label = QLabel()", "type": "assigned_variable", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "vector": [14, 2, 0.3502, 0.001, 2, 0.93, 0.0, 811, 3, 1, 0, 0, 495, 10, 1], "semantic": {"name": "label", "arg_names": [], "import_names": [], "rhs_call_name": "QLabel", "annotation": ""}, "snippet": " label = QtGui.QLabel(label)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L361_C8", "label": "line_edit = QLineEdit()", "type": "assigned_variable", "loc": [361, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "vector": [14, 2, 0.3512, 0.001, 2, 0.93, 0.1429, 632, 3, 0, 0, 0, 755, 10, 1], "semantic": {"name": "line_edit", "arg_names": [], "import_names": [], "rhs_call_name": "QLineEdit", "annotation": ""}, "snippet": " line_edit = QtGui.QLineEdit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L362_C8", "label": "setMinimumWidth()", "type": "expression", "loc": [362, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "vector": [8, 2, 0.3521, 0.001, 2, 0.93, 0.2857, 812, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setMinimumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMinimumWidth", "annotation": ""}, "snippet": " line_edit.setMinimumWidth(80)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L363_C8", "label": "append()", "type": "expression", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "vector": [8, 2, 0.3531, 0.001, 2, 0.93, 0.4286, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.line_edits.append((line_edit,variable))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L364_C8", "label": "addWidget()", "type": "expression", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "vector": [8, 2, 0.3541, 0.001, 2, 0.93, 0.5714, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " layout.addWidget(label)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L365_C8", "label": "addWidget()", "type": "expression", "loc": [365, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "vector": [8, 2, 0.3551, 0.001, 2, 0.93, 0.7143, 653, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " layout.addWidget(line_edit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L366_C8", "label": "connect()", "type": "expression", "loc": [366, 366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "vector": [8, 2, 0.356, 0.001, 2, 0.93, 0.8571, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(line_edit, QtCore.SIGNAL('textEdited (const QString&)'), self.slot_line_edit_changed ) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L367_C8", "label": "return", "type": "return", "loc": [367, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "vector": [13, 2, 0.357, 0.001, 2, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return line_edit "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L369_C4", "label": "slot_line_edit_changed", "type": "function", "loc": [369, 374], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3614, 0.0058, 1, 0.65, 0.2381, 941, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "slot_line_edit_changed", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_line_edit_changed(self,text):\n if True == self.init_in_progress:\n return\n \n for (line_edit, variable) in self.line_edits:\n self.current_dataset.dict[variable] = str(line_edit.text())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L370_C8", "label": "if", "type": "if", "loc": [370, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L369_C4", "vector": [4, 2, 0.3604, 0.0019, 2, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True == self.init_in_progress:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L371_C12", "label": "return", "type": "return", "loc": [371, 371], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L370_C8", "vector": [13, 3, 0.3609, 0.001, 3, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L373_C8", "label": "for line_edit, variable", "type": "for", "loc": [373, 374], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L369_C4", "vector": [6, 2, 0.3633, 0.0019, 2, 0.82, 1.0, 86, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "line_edit, variable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (line_edit, variable) in self.line_edits:\n self.current_dataset.dict[variable] = str(line_edit.text())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L374_C12", "label": " = str()", "type": "assigned_variable", "loc": [374, 374], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L373_C8", "vector": [14, 3, 0.3638, 0.001, 3, 0.08, 0.0, 0, 3, 1, 0, 0, 52, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " self.current_dataset.dict[variable] = str(line_edit.text())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L376_C4", "label": "slot_next_dataset", "type": "function", "loc": [376, 382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3687, 0.0068, 1, 0.65, 0.2619, 370, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "slot_next_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_next_dataset(self):\n dataset = self.scans_database.get_next_dataset()\n if False != dataset:\n self.current_dataset = dataset\n self.load_values_from_dataset()\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L377_C8", "label": "dataset = get_next_dataset()", "type": "assigned_variable", "loc": [377, 377], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L376_C4", "vector": [14, 2, 0.3667, 0.001, 2, 0.29, 0.0, 603, 3, 0, 0, 0, 672, 10, 1], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "get_next_dataset", "annotation": ""}, "snippet": " dataset = self.scans_database.get_next_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L378_C8", "label": "if", "type": "if", "loc": [378, 381], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L376_C4", "vector": [4, 2, 0.3692, 0.0039, 2, 0.29, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False != dataset:\n self.current_dataset = dataset\n self.load_values_from_dataset()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L379_C12", "label": "self.current_dataset =", "type": "assigned_variable", "loc": [379, 379], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L378_C8", "vector": [14, 3, 0.3687, 0.001, 3, 0.48, 0.0, 782, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset = dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L380_C12", "label": "load_values_from_dataset()", "type": "expression", "loc": [380, 380], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L378_C8", "vector": [8, 3, 0.3696, 0.001, 3, 0.48, 0.5, 632, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load_values_from_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "load_values_from_dataset", "annotation": ""}, "snippet": " self.load_values_from_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L381_C12", "label": "return", "type": "return", "loc": [381, 381], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L378_C8", "vector": [13, 3, 0.3706, 0.001, 3, 0.48, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L382_C8", "label": "return", "type": "return", "loc": [382, 382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L376_C4", "vector": [13, 2, 0.3716, 0.001, 2, 0.29, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L384_C4", "label": "slot_prev_dataset", "type": "function", "loc": [384, 390], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3765, 0.0068, 1, 0.65, 0.2857, 337, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "slot_prev_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_prev_dataset(self):\n dataset = self.scans_database.get_prev_dataset()\n if False != dataset:\n self.current_dataset = dataset\n self.load_values_from_dataset()\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L385_C8", "label": "dataset = get_prev_dataset()", "type": "assigned_variable", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L384_C4", "vector": [14, 2, 0.3745, 0.001, 2, 0.67, 0.0, 603, 3, 0, 0, 0, 58, 10, 1], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "get_prev_dataset", "annotation": ""}, "snippet": " dataset = self.scans_database.get_prev_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L386_C8", "label": "if", "type": "if", "loc": [386, 389], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L384_C4", "vector": [4, 2, 0.3769, 0.0039, 2, 0.67, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False != dataset:\n self.current_dataset = dataset\n self.load_values_from_dataset()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L387_C12", "label": "self.current_dataset =", "type": "assigned_variable", "loc": [387, 387], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L386_C8", "vector": [14, 3, 0.3765, 0.001, 3, 0.26, 0.0, 782, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset = dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L388_C12", "label": "load_values_from_dataset()", "type": "expression", "loc": [388, 388], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L386_C8", "vector": [8, 3, 0.3774, 0.001, 3, 0.26, 0.5, 632, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load_values_from_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "load_values_from_dataset", "annotation": ""}, "snippet": " self.load_values_from_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L389_C12", "label": "return", "type": "return", "loc": [389, 389], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L386_C8", "vector": [13, 3, 0.3784, 0.001, 3, 0.26, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L390_C8", "label": "return", "type": "return", "loc": [390, 390], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L384_C4", "vector": [13, 2, 0.3794, 0.001, 2, 0.67, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L392_C4", "label": "slot_first_dataset", "type": "function", "loc": [392, 398], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.3842, 0.0068, 1, 0.65, 0.3095, 938, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "slot_first_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_first_dataset(self):\n dataset = self.scans_database.get_first_dataset()\n if False != dataset:\n self.current_dataset = dataset\n self.load_values_from_dataset()\n return True\n return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L393_C8", "label": "dataset = get_first_dataset()", "type": "assigned_variable", "loc": [393, 393], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L392_C4", "vector": [14, 2, 0.3823, 0.001, 2, 0.0, 0.0, 603, 3, 0, 0, 0, 189, 10, 1], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "get_first_dataset", "annotation": ""}, "snippet": " dataset = self.scans_database.get_first_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L394_C8", "label": "if", "type": "if", "loc": [394, 397], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L392_C4", "vector": [4, 2, 0.3847, 0.0039, 2, 0.0, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False != dataset:\n self.current_dataset = dataset\n self.load_values_from_dataset()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L395_C12", "label": "self.current_dataset =", "type": "assigned_variable", "loc": [395, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L394_C8", "vector": [14, 3, 0.3842, 0.001, 3, 0.47, 0.0, 782, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset = dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L396_C12", "label": "load_values_from_dataset()", "type": "expression", "loc": [396, 396], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L394_C8", "vector": [8, 3, 0.3852, 0.001, 3, 0.47, 0.5, 632, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load_values_from_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "load_values_from_dataset", "annotation": ""}, "snippet": " self.load_values_from_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L397_C12", "label": "return", "type": "return", "loc": [397, 397], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L394_C8", "vector": [13, 3, 0.3862, 0.001, 3, 0.47, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L398_C8", "label": "return", "type": "return", "loc": [398, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L392_C4", "vector": [13, 2, 0.3872, 0.001, 2, 0.0, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L400_C4", "label": "slot_last_dataset", "type": "function", "loc": [400, 406], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.392, 0.0068, 1, 0.65, 0.3333, 765, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "slot_last_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_last_dataset(self):\n dataset = self.scans_database.get_last_dataset()\n if False != dataset:\n self.current_dataset = dataset\n self.load_values_from_dataset()\n return True\n return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L401_C8", "label": "dataset = get_last_dataset()", "type": "assigned_variable", "loc": [401, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L400_C4", "vector": [14, 2, 0.3901, 0.001, 2, 0.53, 0.0, 603, 3, 0, 0, 0, 863, 10, 1], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "get_last_dataset", "annotation": ""}, "snippet": " dataset = self.scans_database.get_last_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L402_C8", "label": "if", "type": "if", "loc": [402, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L400_C4", "vector": [4, 2, 0.3925, 0.0039, 2, 0.53, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False != dataset:\n self.current_dataset = dataset\n self.load_values_from_dataset()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L403_C12", "label": "self.current_dataset =", "type": "assigned_variable", "loc": [403, 403], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L402_C8", "vector": [14, 3, 0.392, 0.001, 3, 0.03, 0.0, 782, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset = dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L404_C12", "label": "load_values_from_dataset()", "type": "expression", "loc": [404, 404], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L402_C8", "vector": [8, 3, 0.393, 0.001, 3, 0.03, 0.5, 632, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load_values_from_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "load_values_from_dataset", "annotation": ""}, "snippet": " self.load_values_from_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L405_C12", "label": "return", "type": "return", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L402_C8", "vector": [13, 3, 0.394, 0.001, 3, 0.03, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L406_C8", "label": "return", "type": "return", "loc": [406, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L400_C4", "vector": [13, 2, 0.3949, 0.001, 2, 0.53, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "label": "load_values_from_dataset", "type": "function", "loc": [409, 461], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.4232, 0.0516, 1, 0.65, 0.3571, 632, 0, 1, 0, 0, 0, 0, 32], "semantic": {"name": "load_values_from_dataset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def load_values_from_dataset(self):\n self.init_in_progress = True\n \n self.id_label.setText(self.current_dataset.id)\n \n for (line_edit, variable) in self.line_edits:\n line_edit.setText(self.current_dataset.dict[variable])\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L410_C8", "label": "self.init_in_progress =", "type": "assigned_variable", "loc": [410, 410], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [14, 2, 0.3988, 0.001, 2, 0.51, 0.0, 140, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init_in_progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init_in_progress = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L412_C8", "label": "setText()", "type": "expression", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [8, 2, 0.4008, 0.001, 2, 0.51, 0.0625, 40, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setText", "arg_names": [], "import_names": [], "rhs_call_name": "setText", "annotation": ""}, "snippet": " self.id_label.setText(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L414_C8", "label": "for line_edit, variable", "type": "for", "loc": [414, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [6, 2, 0.4032, 0.0019, 2, 0.51, 0.125, 86, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "line_edit, variable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (line_edit, variable) in self.line_edits:\n line_edit.setText(self.current_dataset.dict[variable])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L415_C12", "label": "setText()", "type": "expression", "loc": [415, 415], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L414_C8", "vector": [8, 3, 0.4037, 0.001, 3, 0.25, 0.0, 40, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setText", "arg_names": [], "import_names": [], "rhs_call_name": "setText", "annotation": ""}, "snippet": " line_edit.setText(self.current_dataset.dict[variable])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L417_C8", "label": "for index, box", "type": "for", "loc": [417, 423], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [6, 2, 0.4086, 0.0068, 2, 0.51, 0.1875, 860, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "index, box", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index, box in enumerate(self.polygon_comboboxes):\n if index < len(self.current_dataset.polygons):\n print(str(index) + \" load label:\" + self.current_dataset.polygons[index].get_label())\n boxindex = box.findData(QtCore.QVariant(self.current_dataset.polygons[index].get_label()))\n box.setCurrentIndex(boxindex)\n else: #set default to first:\n box.setCurrentIndex(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "label": "if", "type": "if", "loc": [418, 423], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L417_C8", "vector": [4, 3, 0.409, 0.0058, 3, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < len(self.current_dataset.polygons):\n print(str(index) + \" load label:\" + self.current_dataset.polygons[index].get_label())\n boxindex = box.findData(QtCore.QVariant(self.current_dataset.polygons[index].get_label()))\n box.setCurrentIndex(boxindex)\n else: #set default to first:\n box.setCurrentIndex(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L419_C16", "label": "print()", "type": "expression", "loc": [419, 419], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "vector": [8, 4, 0.4076, 0.001, 4, 0.95, 0.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(str(index) + \" load label:\" + self.current_dataset.polygons[index].get_label())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L420_C16", "label": "boxindex = findData()", "type": "assigned_variable", "loc": [420, 420], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "vector": [14, 4, 0.4086, 0.001, 4, 0.95, 0.3333, 489, 3, 1, 0, 0, 916, 10, 3], "semantic": {"name": "boxindex", "arg_names": [], "import_names": [], "rhs_call_name": "findData", "annotation": ""}, "snippet": " boxindex = box.findData(QtCore.QVariant(self.current_dataset.polygons[index].get_label()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L421_C16", "label": "setCurrentIndex()", "type": "expression", "loc": [421, 421], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "vector": [8, 4, 0.4095, 0.001, 4, 0.95, 0.6667, 142, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCurrentIndex", "arg_names": [], "import_names": [], "rhs_call_name": "setCurrentIndex", "annotation": ""}, "snippet": " box.setCurrentIndex(boxindex)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L423_C16", "label": "setCurrentIndex()", "type": "expression", "loc": [423, 423], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "vector": [8, 4, 0.4115, 0.001, 4, 0.95, 1.0, 142, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCurrentIndex", "arg_names": [], "import_names": [], "rhs_call_name": "setCurrentIndex", "annotation": ""}, "snippet": " box.setCurrentIndex(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L426_C8", "label": "box =", "type": "assigned_variable", "loc": [426, 426], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [14, 2, 0.4144, 0.001, 2, 0.51, 0.25, 918, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "box", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " box = self.surface_type_combobox"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L427_C8", "label": "boxindex = findData()", "type": "assigned_variable", "loc": [427, 427], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [14, 2, 0.4154, 0.001, 2, 0.51, 0.3125, 489, 3, 1, 0, 0, 916, 10, 2], "semantic": {"name": "boxindex", "arg_names": [], "import_names": [], "rhs_call_name": "findData", "annotation": ""}, "snippet": " boxindex = box.findData(QtCore.QVariant(self.current_dataset.surface_type))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L428_C8", "label": "setCurrentIndex()", "type": "expression", "loc": [428, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [8, 2, 0.4163, 0.001, 2, 0.51, 0.375, 142, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCurrentIndex", "arg_names": [], "import_names": [], "rhs_call_name": "setCurrentIndex", "annotation": ""}, "snippet": " box.setCurrentIndex(boxindex)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L430_C8", "label": "print()", "type": "expression", "loc": [430, 430], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [8, 2, 0.4183, 0.001, 2, 0.51, 0.4375, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(self.current_dataset.is_training_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L431_C8", "label": "if", "type": "if", "loc": [431, 434], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [4, 2, 0.4207, 0.0039, 2, 0.51, 0.5, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_dataset.is_training_set:\n self.checkbox_training_set.setCheckState(QtCore.Qt.Checked)\n else:\n self.checkbox_training_set.setCheckState(QtCore.Qt.Unchecked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L432_C12", "label": "setCheckState()", "type": "expression", "loc": [432, 432], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L431_C8", "vector": [8, 3, 0.4202, 0.001, 3, 0.67, 0.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCheckState", "arg_names": [], "import_names": [], "rhs_call_name": "setCheckState", "annotation": ""}, "snippet": " self.checkbox_training_set.setCheckState(QtCore.Qt.Checked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L434_C12", "label": "setCheckState()", "type": "expression", "loc": [434, 434], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L431_C8", "vector": [8, 3, 0.4222, 0.001, 3, 0.67, 1.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCheckState", "arg_names": [], "import_names": [], "rhs_call_name": "setCheckState", "annotation": ""}, "snippet": " self.checkbox_training_set.setCheckState(QtCore.Qt.Unchecked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L436_C8", "label": "if", "type": "if", "loc": [436, 439], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [4, 2, 0.4256, 0.0039, 2, 0.51, 0.5625, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_dataset.is_test_set:\n self.checkbox_test_set.setCheckState(QtCore.Qt.Checked)\n else:\n self.checkbox_test_set.setCheckState(QtCore.Qt.Unchecked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L437_C12", "label": "setCheckState()", "type": "expression", "loc": [437, 437], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L436_C8", "vector": [8, 3, 0.4251, 0.001, 3, 0.69, 0.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCheckState", "arg_names": [], "import_names": [], "rhs_call_name": "setCheckState", "annotation": ""}, "snippet": " self.checkbox_test_set.setCheckState(QtCore.Qt.Checked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L439_C12", "label": "setCheckState()", "type": "expression", "loc": [439, 439], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L436_C8", "vector": [8, 3, 0.427, 0.001, 3, 0.69, 1.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCheckState", "arg_names": [], "import_names": [], "rhs_call_name": "setCheckState", "annotation": ""}, "snippet": " self.checkbox_test_set.setCheckState(QtCore.Qt.Unchecked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L441_C8", "label": "if", "type": "if", "loc": [441, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [4, 2, 0.4304, 0.0039, 2, 0.51, 0.625, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_dataset.is_labeled:\n self.checkbox_is_labeled.setCheckState(QtCore.Qt.Checked)\n else:\n self.checkbox_is_labeled.setCheckState(QtCore.Qt.Unchecked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L442_C12", "label": "setCheckState()", "type": "expression", "loc": [442, 442], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L441_C8", "vector": [8, 3, 0.43, 0.001, 3, 0.43, 0.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCheckState", "arg_names": [], "import_names": [], "rhs_call_name": "setCheckState", "annotation": ""}, "snippet": " self.checkbox_is_labeled.setCheckState(QtCore.Qt.Checked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L444_C12", "label": "setCheckState()", "type": "expression", "loc": [444, 444], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L441_C8", "vector": [8, 3, 0.4319, 0.001, 3, 0.43, 1.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCheckState", "arg_names": [], "import_names": [], "rhs_call_name": "setCheckState", "annotation": ""}, "snippet": " self.checkbox_is_labeled.setCheckState(QtCore.Qt.Unchecked)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L447_C8", "label": "print()", "type": "expression", "loc": [447, 447], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [8, 2, 0.4348, 0.001, 2, 0.51, 0.6875, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(self.current_dataset.scan_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "label": "if", "type": "if", "loc": [448, 455], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [4, 2, 0.4392, 0.0078, 2, 0.51, 0.75, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '' == self.current_dataset.scan_filename:\n self.display_3d_button.setEnabled(False)\n self.display_3d_spheres_button.setEnabled(False)\n self.display_intensity_button.setEnabled(False)\n else:\n self.display_3d_button.setEnabled(True)\n self.display_3d_spheres_button.setEnabled(True)\n self.display_intensity_button.setEnabled(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L449_C12", "label": "setEnabled()", "type": "expression", "loc": [449, 449], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "vector": [8, 3, 0.4368, 0.001, 3, 0.87, 0.0, 503, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setEnabled", "arg_names": [], "import_names": [], "rhs_call_name": "setEnabled", "annotation": ""}, "snippet": " self.display_3d_button.setEnabled(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L450_C12", "label": "setEnabled()", "type": "expression", "loc": [450, 450], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "vector": [8, 3, 0.4377, 0.001, 3, 0.87, 0.2, 503, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setEnabled", "arg_names": [], "import_names": [], "rhs_call_name": "setEnabled", "annotation": ""}, "snippet": " self.display_3d_spheres_button.setEnabled(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L451_C12", "label": "setEnabled()", "type": "expression", "loc": [451, 451], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "vector": [8, 3, 0.4387, 0.001, 3, 0.87, 0.4, 503, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setEnabled", "arg_names": [], "import_names": [], "rhs_call_name": "setEnabled", "annotation": ""}, "snippet": " self.display_intensity_button.setEnabled(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L453_C12", "label": "setEnabled()", "type": "expression", "loc": [453, 453], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "vector": [8, 3, 0.4407, 0.001, 3, 0.87, 0.6, 503, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setEnabled", "arg_names": [], "import_names": [], "rhs_call_name": "setEnabled", "annotation": ""}, "snippet": " self.display_3d_button.setEnabled(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L454_C12", "label": "setEnabled()", "type": "expression", "loc": [454, 454], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "vector": [8, 3, 0.4416, 0.001, 3, 0.87, 0.8, 503, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setEnabled", "arg_names": [], "import_names": [], "rhs_call_name": "setEnabled", "annotation": ""}, "snippet": " self.display_3d_spheres_button.setEnabled(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L455_C12", "label": "setEnabled()", "type": "expression", "loc": [455, 455], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "vector": [8, 3, 0.4426, 0.001, 3, 0.87, 1.0, 503, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setEnabled", "arg_names": [], "import_names": [], "rhs_call_name": "setEnabled", "annotation": ""}, "snippet": " self.display_intensity_button.setEnabled(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L457_C8", "label": "self.display_mode =", "type": "assigned_variable", "loc": [457, 457], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [14, 2, 0.4446, 0.001, 2, 0.51, 0.8125, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'image'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L458_C8", "label": "set_polygons()", "type": "expression", "loc": [458, 458], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [8, 2, 0.4455, 0.001, 2, 0.51, 0.875, 601, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_polygons", "arg_names": [], "import_names": [], "rhs_call_name": "set_polygons", "annotation": ""}, "snippet": " self.draw_widget.set_polygons(self.current_dataset.polygons)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L459_C8", "label": "set_image()", "type": "expression", "loc": [459, 459], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [8, 2, 0.4465, 0.001, 2, 0.51, 0.9375, 942, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.draw_widget.set_image(self.scans_database.get_path() + '/' + self.current_dataset.image_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L461_C8", "label": "self.init_in_progress =", "type": "assigned_variable", "loc": [461, 461], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "vector": [14, 2, 0.4484, 0.001, 2, 0.51, 1.0, 140, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.init_in_progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.init_in_progress = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "label": "slot_take_artag_image", "type": "function", "loc": [463, 477], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.4572, 0.0146, 1, 0.65, 0.381, 68, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "slot_take_artag_image", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_take_artag_image(self):\n if False == self.scanner:\n self.scanner = scanner.scanner(self.config)\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n img = self.scanner.take_artag_image()\n self.current_dataset.image_artag_filename = self.scanner.save_artag_image(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L464_C8", "label": "if", "type": "if", "loc": [464, 465], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "vector": [4, 2, 0.4518, 0.0019, 2, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.scanner:\n self.scanner = scanner.scanner(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L465_C12", "label": "self.scanner = scanner()", "type": "assigned_variable", "loc": [465, 465], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L464_C8", "vector": [14, 3, 0.4523, 0.001, 3, 0.12, 0.0, 509, 3, 1, 0, 0, 802, 10, 1], "semantic": {"name": "self.scanner", "arg_names": [], "import_names": [], "rhs_call_name": "scanner", "annotation": ""}, "snippet": " self.scanner = scanner.scanner(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L466_C8", "label": "if", "type": "if", "loc": [466, 467], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "vector": [4, 2, 0.4538, 0.0019, 2, 0.82, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor:\n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L467_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [467, 467], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L466_C8", "vector": [14, 3, 0.4543, 0.001, 3, 0.56, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L469_C8", "label": "img = take_artag_image()", "type": "assigned_variable", "loc": [469, 469], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "vector": [14, 2, 0.4562, 0.001, 2, 0.82, 0.4, 200, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "take_artag_image", "annotation": ""}, "snippet": " img = self.scanner.take_artag_image()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L470_C8", "label": "self.current_dataset.image_artag_filename = save_artag_image()", "type": "assigned_variable", "loc": [470, 470], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "vector": [14, 2, 0.4572, 0.001, 2, 0.82, 0.6, 413, 3, 1, 0, 0, 169, 10, 1], "semantic": {"name": "self.current_dataset.image_artag_filename", "arg_names": [], "import_names": [], "rhs_call_name": "save_artag_image", "annotation": ""}, "snippet": " self.current_dataset.image_artag_filename = self.scanner.save_artag_image(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L472_C8", "label": "slot_save()", "type": "expression", "loc": [472, 472], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "vector": [8, 2, 0.4591, 0.001, 2, 0.82, 0.8, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() #save for consistency with files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L474_C8", "label": "if", "type": "if", "loc": [474, 477], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "vector": [4, 2, 0.4625, 0.0039, 2, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.processor.read_artag(img).any():\n print(\"SUCCESS in reading ARTag\")\n else:\n print(\"FAILURE in reading ARTag - try again!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L475_C12", "label": "print()", "type": "expression", "loc": [475, 475], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L474_C8", "vector": [8, 3, 0.4621, 0.001, 3, 0.97, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"SUCCESS in reading ARTag\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L477_C12", "label": "print()", "type": "expression", "loc": [477, 477], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L474_C8", "vector": [8, 3, 0.464, 0.001, 3, 0.97, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"FAILURE in reading ARTag - try again!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "label": "slot_take_scan", "type": "function", "loc": [481, 504], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.4791, 0.0233, 1, 0.65, 0.4048, 894, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "slot_take_scan", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_take_scan(self):\n \n #save database, let scanner add dataset, reload it then\n self.slot_save()\n \n if False == self.scanner:\n self.scanner = scanner.scanner(self.config)\n if False == self.processor:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L484_C8", "label": "slot_save()", "type": "expression", "loc": [484, 484], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "vector": [8, 2, 0.4708, 0.001, 2, 0.82, 0.0, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L486_C8", "label": "if", "type": "if", "loc": [486, 487], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "vector": [4, 2, 0.4732, 0.0019, 2, 0.82, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.scanner:\n self.scanner = scanner.scanner(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L487_C12", "label": "self.scanner = scanner()", "type": "assigned_variable", "loc": [487, 487], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L486_C8", "vector": [14, 3, 0.4737, 0.001, 3, 0.63, 0.0, 509, 3, 1, 0, 0, 802, 10, 1], "semantic": {"name": "self.scanner", "arg_names": [], "import_names": [], "rhs_call_name": "scanner", "annotation": ""}, "snippet": " self.scanner = scanner.scanner(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L488_C8", "label": "if", "type": "if", "loc": [488, 489], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "vector": [4, 2, 0.4752, 0.0019, 2, 0.82, 0.2857, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor:\n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L489_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [489, 489], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L488_C8", "vector": [14, 3, 0.4757, 0.001, 3, 0.55, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L491_C8", "label": "name = formatted_time()", "type": "assigned_variable", "loc": [491, 491], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "vector": [14, 2, 0.4776, 0.001, 2, 0.82, 0.4286, 57, 3, 0, 0, 0, 353, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "formatted_time", "annotation": ""}, "snippet": " name = ut.formatted_time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L492_C8", "label": "capture_and_save()", "type": "expression", "loc": [492, 492], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "vector": [8, 2, 0.4786, 0.001, 2, 0.82, 0.5714, 272, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "capture_and_save", "arg_names": [], "import_names": [], "rhs_call_name": "capture_and_save", "annotation": ""}, "snippet": " self.scanner.capture_and_save(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L498_C8", "label": "print()", "type": "expression", "loc": [498, 498], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "vector": [8, 2, 0.4844, 0.001, 2, 0.82, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('scan ' + name + ' taken')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L500_C8", "label": "load()", "type": "expression", "loc": [500, 500], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "vector": [8, 2, 0.4864, 0.001, 2, 0.82, 0.8571, 37, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "load", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " self.scans_database.load(self.path,'database.pkl')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:While_L503_C8", "label": "while", "type": "while", "loc": [503, 504], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "vector": [5, 2, 0.4898, 0.0019, 2, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True == self.slot_next_dataset():\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L506_C4", "label": "slot_display_intensity", "type": "function", "loc": [506, 529], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.5034, 0.0233, 1, 0.65, 0.4286, 844, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "slot_display_intensity", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_display_intensity(self):\n if self.display_mode != 'intensities':\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n #reset ground plane:\n self.current_dataset.ground_plane_normal = ''\n self.current_dataset.ground_plane_three_points = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "label": "if", "type": "if", "loc": [507, 529], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L506_C4", "vector": [4, 2, 0.5039, 0.0224, 2, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.display_mode != 'intensities':\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n #reset ground plane:\n self.current_dataset.ground_plane_normal = ''\n self.current_dataset.ground_plane_three_points = ''\n self.slot_save() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L508_C12", "label": "if", "type": "if", "loc": [508, 509], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [4, 3, 0.4946, 0.0019, 3, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor:\n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L509_C16", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [509, 509], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L508_C12", "vector": [14, 4, 0.4951, 0.001, 4, 0.85, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L512_C12", "label": "self.current_dataset.ground_plane_normal =", "type": "assigned_variable", "loc": [512, 512], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [14, 3, 0.4981, 0.001, 3, 0.49, 0.1, 730, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.current_dataset.ground_plane_normal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset.ground_plane_normal = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L513_C12", "label": "self.current_dataset.ground_plane_three_points =", "type": "assigned_variable", "loc": [513, 513], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [14, 3, 0.499, 0.001, 3, 0.49, 0.2, 913, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.current_dataset.ground_plane_three_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_dataset.ground_plane_three_points = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L514_C12", "label": "slot_save()", "type": "expression", "loc": [514, 514], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [8, 3, 0.5, 0.001, 3, 0.49, 0.3, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L517_C12", "label": "load_data()", "type": "expression", "loc": [517, 517], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [8, 3, 0.5029, 0.001, 3, 0.49, 0.4, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L518_C12", "label": "process_intensities()", "type": "expression", "loc": [518, 518], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [8, 3, 0.5039, 0.001, 3, 0.49, 0.5, 581, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "process_intensities", "arg_names": [], "import_names": [], "rhs_call_name": "process_intensities", "annotation": ""}, "snippet": " self.processor.process_intensities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L519_C12", "label": "filename = save_intensity_image()", "type": "assigned_variable", "loc": [519, 519], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [14, 3, 0.5049, 0.001, 3, 0.49, 0.6, 275, 3, 1, 0, 0, 571, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "save_intensity_image", "annotation": ""}, "snippet": " filename = self.processor.save_intensity_image(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L523_C12", "label": "self.display_mode =", "type": "assigned_variable", "loc": [523, 523], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [14, 3, 0.5088, 0.001, 3, 0.49, 0.7, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'intensities'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L524_C12", "label": "set_image()", "type": "expression", "loc": [524, 524], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [8, 3, 0.5097, 0.001, 3, 0.49, 0.8, 942, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.draw_widget.set_image(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L528_C12", "label": "self.display_mode =", "type": "assigned_variable", "loc": [528, 528], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [14, 3, 0.5136, 0.001, 3, 0.49, 0.9, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'image'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L529_C12", "label": "set_image()", "type": "expression", "loc": [529, 529], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "vector": [8, 3, 0.5146, 0.001, 3, 0.49, 1.0, 942, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.draw_widget.set_image(self.scans_database.get_path() + '/' + self.current_dataset.image_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L531_C4", "label": "slot_display_features", "type": "function", "loc": [531, 545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.5233, 0.0146, 1, 0.65, 0.4524, 72, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "slot_display_features", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_display_features(self):\n if self.display_mode != 'features':\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n self.processor.load_data(self.current_dataset.id)\n self.processor.process_intensities()\n filename = self.processor.save_intensity_image(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "label": "if", "type": "if", "loc": [532, 545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L531_C4", "vector": [4, 2, 0.5238, 0.0136, 2, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.display_mode != 'features':\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n self.processor.load_data(self.current_dataset.id)\n self.processor.process_intensities()\n filename = self.processor.save_intensity_image(self.current_dataset.id)\n self.display_mode = 'features'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L533_C12", "label": "if", "type": "if", "loc": [533, 534], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "vector": [4, 3, 0.519, 0.0019, 3, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor:\n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L534_C16", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [534, 534], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L533_C12", "vector": [14, 4, 0.5195, 0.001, 4, 0.74, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L536_C12", "label": "load_data()", "type": "expression", "loc": [536, 536], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "vector": [8, 3, 0.5214, 0.001, 3, 0.2, 0.1429, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L537_C12", "label": "process_intensities()", "type": "expression", "loc": [537, 537], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "vector": [8, 3, 0.5224, 0.001, 3, 0.2, 0.2857, 581, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "process_intensities", "arg_names": [], "import_names": [], "rhs_call_name": "process_intensities", "annotation": ""}, "snippet": " self.processor.process_intensities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L538_C12", "label": "filename = save_intensity_image()", "type": "assigned_variable", "loc": [538, 538], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "vector": [14, 3, 0.5233, 0.001, 3, 0.2, 0.4286, 275, 3, 1, 0, 0, 571, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "save_intensity_image", "annotation": ""}, "snippet": " filename = self.processor.save_intensity_image(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L539_C12", "label": "self.display_mode =", "type": "assigned_variable", "loc": [539, 539], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "vector": [14, 3, 0.5243, 0.001, 3, 0.2, 0.5714, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'features'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L540_C12", "label": "set_image()", "type": "expression", "loc": [540, 540], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "vector": [8, 3, 0.5253, 0.001, 3, 0.2, 0.7143, 942, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.draw_widget.set_image(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L544_C12", "label": "self.display_mode =", "type": "assigned_variable", "loc": [544, 544], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "vector": [14, 3, 0.5292, 0.001, 3, 0.2, 0.8571, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'image'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L545_C12", "label": "set_image()", "type": "expression", "loc": [545, 545], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "vector": [8, 3, 0.5302, 0.001, 3, 0.2, 1.0, 942, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.draw_widget.set_image(self.scans_database.get_path() + '/' + self.current_dataset.image_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L548_C4", "label": "slot_display_labels", "type": "function", "loc": [548, 562], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.5399, 0.0146, 1, 0.65, 0.4762, 562, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "slot_display_labels", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_display_labels(self):\n if self.display_mode != 'labels':\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n self.processor.load_data(self.current_dataset.id)\n self.processor.process_labels(self.display_3d_type)\n filename = self.processor.save_labels_image(self.display_3d_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "label": "if", "type": "if", "loc": [549, 562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L548_C4", "vector": [4, 2, 0.5404, 0.0136, 2, 0.07, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.display_mode != 'labels':\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n self.processor.load_data(self.current_dataset.id)\n self.processor.process_labels(self.display_3d_type)\n filename = self.processor.save_labels_image(self.display_3d_type)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L550_C12", "label": "if", "type": "if", "loc": [550, 551], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "vector": [4, 3, 0.5355, 0.0019, 3, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor:\n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L551_C16", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [551, 551], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L550_C12", "vector": [14, 4, 0.536, 0.001, 4, 0.7, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L553_C12", "label": "load_data()", "type": "expression", "loc": [553, 553], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "vector": [8, 3, 0.5379, 0.001, 3, 0.12, 0.1429, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L554_C12", "label": "process_labels()", "type": "expression", "loc": [554, 554], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "vector": [8, 3, 0.5389, 0.001, 3, 0.12, 0.2857, 909, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_labels", "arg_names": [], "import_names": [], "rhs_call_name": "process_labels", "annotation": ""}, "snippet": " self.processor.process_labels(self.display_3d_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L555_C12", "label": "filename = save_labels_image()", "type": "assigned_variable", "loc": [555, 555], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "vector": [14, 3, 0.5399, 0.001, 3, 0.12, 0.4286, 275, 3, 1, 0, 0, 915, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "save_labels_image", "annotation": ""}, "snippet": " filename = self.processor.save_labels_image(self.display_3d_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L557_C12", "label": "set_image()", "type": "expression", "loc": [557, 557], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "vector": [8, 3, 0.5418, 0.001, 3, 0.12, 0.5714, 942, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.draw_widget.set_image(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L558_C12", "label": "self.display_mode =", "type": "assigned_variable", "loc": [558, 558], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "vector": [14, 3, 0.5428, 0.001, 3, 0.12, 0.7143, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'labels'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L561_C12", "label": "set_image()", "type": "expression", "loc": [561, 561], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "vector": [8, 3, 0.5457, 0.001, 3, 0.12, 0.8571, 942, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.draw_widget.set_image(self.scans_database.get_path() + '/' + self.current_dataset.image_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L562_C12", "label": "self.display_mode =", "type": "assigned_variable", "loc": [562, 562], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "vector": [14, 3, 0.5467, 0.001, 3, 0.12, 1.0, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'image' "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "label": "slot_display_masks", "type": "function", "loc": [564, 576], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.5545, 0.0126, 1, 0.65, 0.5, 927, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "slot_display_masks", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_display_masks(self): \n if False == self.processor:\n self.processor = processor.processor(self.config) \n self.processor.load_data(self.current_dataset.id)\n if self.display_mode != 'labels': \n self.processor.process_masks(self.display_3d_type)\n self.display_mode = 'labels'\n filename = self.processor.save_masks_image(self.display_3d_type) #saves pic in results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L565_C8", "label": "if", "type": "if", "loc": [565, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "vector": [4, 2, 0.5501, 0.0019, 2, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor:\n self.processor = processor.processor(self.config) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L566_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [566, 566], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L565_C8", "vector": [14, 3, 0.5506, 0.001, 3, 0.92, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L567_C8", "label": "load_data()", "type": "expression", "loc": [567, 567], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "vector": [8, 2, 0.5516, 0.001, 2, 0.64, 0.3333, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "label": "if", "type": "if", "loc": [568, 575], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "vector": [4, 2, 0.5559, 0.0078, 2, 0.64, 0.6667, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.display_mode != 'labels': \n self.processor.process_masks(self.display_3d_type)\n self.display_mode = 'labels'\n filename = self.processor.save_masks_image(self.display_3d_type) #saves pic in results\n else:\n self.processor.process_masks(self.display_3d_type, True) #show clutter mask NOT placement mask\n self.display_mode = 'image'\n filename = self.processor.save_masks_image(self.display_3d_type, True) #saves pic in results "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L569_C12", "label": "process_masks()", "type": "expression", "loc": [569, 569], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "vector": [8, 3, 0.5535, 0.001, 3, 0.47, 0.0, 802, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_masks", "arg_names": [], "import_names": [], "rhs_call_name": "process_masks", "annotation": ""}, "snippet": " self.processor.process_masks(self.display_3d_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L570_C12", "label": "self.display_mode =", "type": "assigned_variable", "loc": [570, 570], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "vector": [14, 3, 0.5545, 0.001, 3, 0.47, 0.2, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'labels'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L571_C12", "label": "filename = save_masks_image()", "type": "assigned_variable", "loc": [571, 571], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "vector": [14, 3, 0.5554, 0.001, 3, 0.47, 0.4, 275, 3, 1, 0, 0, 348, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "save_masks_image", "annotation": ""}, "snippet": " filename = self.processor.save_masks_image(self.display_3d_type) #saves pic in results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L573_C12", "label": "process_masks()", "type": "expression", "loc": [573, 573], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "vector": [8, 3, 0.5574, 0.001, 3, 0.47, 0.6, 802, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "process_masks", "arg_names": [], "import_names": [], "rhs_call_name": "process_masks", "annotation": ""}, "snippet": " self.processor.process_masks(self.display_3d_type, True) #show clutter mask NOT placement mask"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L574_C12", "label": "self.display_mode =", "type": "assigned_variable", "loc": [574, 574], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "vector": [14, 3, 0.5584, 0.001, 3, 0.47, 0.8, 825, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.display_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.display_mode = 'image'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L575_C12", "label": "filename = save_masks_image()", "type": "assigned_variable", "loc": [575, 575], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "vector": [14, 3, 0.5593, 0.001, 3, 0.47, 1.0, 275, 3, 2, 0, 0, 348, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "save_masks_image", "annotation": ""}, "snippet": " filename = self.processor.save_masks_image(self.display_3d_type, True) #saves pic in results "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L576_C8", "label": "set_image()", "type": "expression", "loc": [576, 576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "vector": [8, 2, 0.5603, 0.001, 2, 0.64, 1.0, 942, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.draw_widget.set_image(filename) #loads picture saved previously"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L579_C4", "label": "slot_display_stats", "type": "function", "loc": [579, 584], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.5657, 0.0058, 1, 0.65, 0.5238, 397, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "slot_display_stats", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_display_stats(self):\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n self.processor.load_data(self.current_dataset.id)\n self.processor.display_stats()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L580_C8", "label": "if", "type": "if", "loc": [580, 581], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L579_C4", "vector": [4, 2, 0.5647, 0.0019, 2, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor:\n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L581_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [581, 581], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L580_C8", "vector": [14, 3, 0.5652, 0.001, 3, 0.23, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L583_C8", "label": "load_data()", "type": "expression", "loc": [583, 583], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L579_C4", "vector": [8, 2, 0.5671, 0.001, 2, 0.78, 0.5, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L584_C8", "label": "display_stats()", "type": "expression", "loc": [584, 584], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L579_C4", "vector": [8, 2, 0.5681, 0.001, 2, 0.78, 1.0, 985, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "display_stats", "arg_names": [], "import_names": [], "rhs_call_name": "display_stats", "annotation": ""}, "snippet": " self.processor.display_stats()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L586_C4", "label": "slot_display_global_stats", "type": "function", "loc": [586, 591], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.5725, 0.0058, 1, 0.65, 0.5476, 674, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "slot_display_global_stats", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_display_global_stats(self):\n if False == self.processor:\n self.processor = processor.processor(self.config)\n \n self.processor.load_data(self.current_dataset.id)\n self.processor.display_stats(True) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L587_C8", "label": "if", "type": "if", "loc": [587, 588], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L586_C4", "vector": [4, 2, 0.5715, 0.0019, 2, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor:\n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L588_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [588, 588], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L587_C8", "vector": [14, 3, 0.572, 0.001, 3, 0.76, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L590_C8", "label": "load_data()", "type": "expression", "loc": [590, 590], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L586_C4", "vector": [8, 2, 0.5739, 0.001, 2, 0.7, 0.5, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L591_C8", "label": "display_stats()", "type": "expression", "loc": [591, 591], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L586_C4", "vector": [8, 2, 0.5749, 0.001, 2, 0.7, 1.0, 985, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "display_stats", "arg_names": [], "import_names": [], "rhs_call_name": "display_stats", "annotation": ""}, "snippet": " self.processor.display_stats(True) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L594_C4", "label": "slot_display_3d_spheres", "type": "function", "loc": [594, 595], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.5783, 0.0019, 1, 0.65, 0.5714, 952, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "slot_display_3d_spheres", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_display_3d_spheres(self): \n self.slot_display_3d(True) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L595_C8", "label": "slot_display_3d()", "type": "expression", "loc": [595, 595], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L594_C4", "vector": [8, 2, 0.5788, 0.001, 2, 0.4, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "slot_display_3d", "arg_names": [], "import_names": [], "rhs_call_name": "slot_display_3d", "annotation": ""}, "snippet": " self.slot_display_3d(True) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "label": "slot_display_3d", "type": "function", "loc": [597, 614], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.589, 0.0175, 1, 0.65, 0.5952, 241, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "slot_display_3d", "arg_names": ["self", "spheres"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_display_3d(self, spheres = False):\n print('Inside slot_display_3d')\n if False == self.processor: \n self.processor = processor.processor(self.config)\n \n #save data first so the processor can load it:\n print('Before slot_save')\n self.slot_save() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L598_C8", "label": "print()", "type": "expression", "loc": [598, 598], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5817, 0.001, 2, 0.01, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Inside slot_display_3d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L599_C8", "label": "if", "type": "if", "loc": [599, 600], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [4, 2, 0.5832, 0.0019, 2, 0.01, 0.1, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor: \n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L600_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [600, 600], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L599_C8", "vector": [14, 3, 0.5837, 0.001, 3, 0.77, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L603_C8", "label": "print()", "type": "expression", "loc": [603, 603], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5866, 0.001, 2, 0.01, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Before slot_save')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L604_C8", "label": "slot_save()", "type": "expression", "loc": [604, 604], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5875, 0.001, 2, 0.01, 0.3, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L606_C8", "label": "print()", "type": "expression", "loc": [606, 606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5895, 0.001, 2, 0.01, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Before load_data')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L607_C8", "label": "load_data()", "type": "expression", "loc": [607, 607], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5905, 0.001, 2, 0.01, 0.5, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L609_C8", "label": "print()", "type": "expression", "loc": [609, 609], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5924, 0.001, 2, 0.01, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Before process_raw_data')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L610_C8", "label": "process_raw_data()", "type": "expression", "loc": [610, 610], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5934, 0.001, 2, 0.01, 0.7, 553, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "process_raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "process_raw_data", "annotation": ""}, "snippet": " self.processor.process_raw_data()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L612_C8", "label": "print()", "type": "expression", "loc": [612, 612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5953, 0.001, 2, 0.01, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Before display_3d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L613_C8", "label": "display_3d()", "type": "expression", "loc": [613, 613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5963, 0.001, 2, 0.01, 0.9, 989, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "display_3d", "arg_names": [], "import_names": [], "rhs_call_name": "display_3d", "annotation": ""}, "snippet": " self.processor.display_3d(self.display_3d_type, spheres)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L614_C8", "label": "print()", "type": "expression", "loc": [614, 614], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "vector": [8, 2, 0.5973, 0.001, 2, 0.01, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('After display_3d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "label": "slot_train_and_save_Classifiers", "type": "function", "loc": [616, 625], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6036, 0.0097, 1, 0.65, 0.619, 348, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "slot_train_and_save_Classifiers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_train_and_save_Classifiers(self):\n\n if False == self.processor: \n self.processor = processor.processor(self.config)\n \n #save data first so the processor can load it:\n self.slot_save() \n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L618_C8", "label": "if", "type": "if", "loc": [618, 619], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "vector": [4, 2, 0.6017, 0.0019, 2, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor: \n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L619_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [619, 619], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L618_C8", "vector": [14, 3, 0.6021, 0.001, 3, 0.64, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L622_C8", "label": "slot_save()", "type": "expression", "loc": [622, 622], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "vector": [8, 2, 0.6051, 0.001, 2, 0.12, 0.3333, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L624_C8", "label": "load_data()", "type": "expression", "loc": [624, 624], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "vector": [8, 2, 0.607, 0.001, 2, 0.12, 0.6667, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L625_C8", "label": "train_and_save_Classifiers()", "type": "expression", "loc": [625, 625], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "vector": [8, 2, 0.608, 0.001, 2, 0.12, 1.0, 169, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "train_and_save_Classifiers", "arg_names": [], "import_names": [], "rhs_call_name": "train_and_save_Classifiers", "annotation": ""}, "snippet": " self.processor.train_and_save_Classifiers() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "label": "slot_generate_save_features", "type": "function", "loc": [627, 636], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6143, 0.0097, 1, 0.65, 0.6429, 986, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "slot_generate_save_features", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_generate_save_features(self):\n\n if False == self.processor: \n self.processor = processor.processor(self.config)\n \n #save data first so the processor can load it:\n self.slot_save() \n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L629_C8", "label": "if", "type": "if", "loc": [629, 630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "vector": [4, 2, 0.6124, 0.0019, 2, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor: \n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L630_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [630, 630], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L629_C8", "vector": [14, 3, 0.6128, 0.001, 3, 0.88, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L633_C8", "label": "slot_save()", "type": "expression", "loc": [633, 633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "vector": [8, 2, 0.6158, 0.001, 2, 0.21, 0.3333, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L635_C8", "label": "load_data()", "type": "expression", "loc": [635, 635], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "vector": [8, 2, 0.6177, 0.001, 2, 0.21, 0.6667, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L636_C8", "label": "generate_save_features()", "type": "expression", "loc": [636, 636], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "vector": [8, 2, 0.6187, 0.001, 2, 0.21, 1.0, 994, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "generate_save_features", "arg_names": [], "import_names": [], "rhs_call_name": "generate_save_features", "annotation": ""}, "snippet": " self.processor.generate_save_features() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "label": "slot_test_Classifiers", "type": "function", "loc": [639, 645], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6245, 0.0068, 1, 0.65, 0.6667, 575, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "slot_test_Classifiers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_test_Classifiers(self):\n if False == self.processor: \n self.processor = processor.processor(self.config)\n self.slot_save() #save data first so the processor can load it:\n self.processor.load_data(self.current_dataset.id)\n self.processor.train_and_save_Classifiers()\n self.processor.test_Classifiers() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L640_C8", "label": "if", "type": "if", "loc": [640, 641], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "vector": [4, 2, 0.6231, 0.0019, 2, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor: \n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L641_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [641, 641], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L640_C8", "vector": [14, 3, 0.6235, 0.001, 3, 0.53, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L642_C8", "label": "slot_save()", "type": "expression", "loc": [642, 642], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "vector": [8, 2, 0.6245, 0.001, 2, 0.7, 0.25, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() #save data first so the processor can load it:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L643_C8", "label": "load_data()", "type": "expression", "loc": [643, 643], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "vector": [8, 2, 0.6255, 0.001, 2, 0.7, 0.5, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L644_C8", "label": "train_and_save_Classifiers()", "type": "expression", "loc": [644, 644], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "vector": [8, 2, 0.6265, 0.001, 2, 0.7, 0.75, 169, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "train_and_save_Classifiers", "arg_names": [], "import_names": [], "rhs_call_name": "train_and_save_Classifiers", "annotation": ""}, "snippet": " self.processor.train_and_save_Classifiers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L645_C8", "label": "test_Classifiers()", "type": "expression", "loc": [645, 645], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "vector": [8, 2, 0.6274, 0.001, 2, 0.7, 1.0, 794, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test_Classifiers", "arg_names": [], "import_names": [], "rhs_call_name": "test_Classifiers", "annotation": ""}, "snippet": " self.processor.test_Classifiers() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "label": "slot_test_Classifiers_on_testset", "type": "function", "loc": [647, 653], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6323, 0.0068, 1, 0.65, 0.6905, 443, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "slot_test_Classifiers_on_testset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_test_Classifiers_on_testset(self):\n if False == self.processor: \n self.processor = processor.processor(self.config)\n self.slot_save() #save data first so the processor can load it:\n self.processor.load_data(self.current_dataset.id)\n self.processor.train_and_save_Classifiers()\n self.processor.test_classifiers_on_testset() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L648_C8", "label": "if", "type": "if", "loc": [648, 649], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "vector": [4, 2, 0.6308, 0.0019, 2, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor: \n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L649_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [649, 649], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L648_C8", "vector": [14, 3, 0.6313, 0.001, 3, 0.59, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L650_C8", "label": "slot_save()", "type": "expression", "loc": [650, 650], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "vector": [8, 2, 0.6323, 0.001, 2, 0.14, 0.25, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() #save data first so the processor can load it:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L651_C8", "label": "load_data()", "type": "expression", "loc": [651, 651], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "vector": [8, 2, 0.6333, 0.001, 2, 0.14, 0.5, 477, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.processor.load_data(self.current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L652_C8", "label": "train_and_save_Classifiers()", "type": "expression", "loc": [652, 652], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "vector": [8, 2, 0.6342, 0.001, 2, 0.14, 0.75, 169, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "train_and_save_Classifiers", "arg_names": [], "import_names": [], "rhs_call_name": "train_and_save_Classifiers", "annotation": ""}, "snippet": " self.processor.train_and_save_Classifiers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L653_C8", "label": "test_classifiers_on_testset()", "type": "expression", "loc": [653, 653], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "vector": [8, 2, 0.6352, 0.001, 2, 0.14, 1.0, 38, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test_classifiers_on_testset", "arg_names": [], "import_names": [], "rhs_call_name": "test_classifiers_on_testset", "annotation": ""}, "snippet": " self.processor.test_classifiers_on_testset() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L655_C4", "label": "slot_load_Classifiers", "type": "function", "loc": [655, 658], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6386, 0.0039, 1, 0.65, 0.7143, 736, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "slot_load_Classifiers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_load_Classifiers(self):\n if False == self.processor: \n self.processor = processor.processor(self.config)\n self.processor.load_Classifiers() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L656_C8", "label": "if", "type": "if", "loc": [656, 657], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L655_C4", "vector": [4, 2, 0.6386, 0.0019, 2, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor: \n self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L657_C12", "label": "self.processor = processor()", "type": "assigned_variable", "loc": [657, 657], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L656_C8", "vector": [14, 3, 0.6391, 0.001, 3, 0.32, 0.0, 855, 3, 1, 0, 0, 177, 10, 1], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "processor", "annotation": ""}, "snippet": " self.processor = processor.processor(self.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L658_C8", "label": "load_Classifiers()", "type": "expression", "loc": [658, 658], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L655_C4", "vector": [8, 2, 0.6401, 0.001, 2, 0.39, 1.0, 173, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load_Classifiers", "arg_names": [], "import_names": [], "rhs_call_name": "load_Classifiers", "annotation": ""}, "snippet": " self.processor.load_Classifiers() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L660_C4", "label": "slot_save_Classifier", "type": "function", "loc": [660, 664], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.644, 0.0049, 1, 0.65, 0.7381, 238, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "slot_save_Classifier", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_save_Classifier(self):\n if False == self.processor: \n print('ERROR: no processor object exists -> no Classifier to save!')\n return\n self.processor.save_Classifier() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L661_C8", "label": "if", "type": "if", "loc": [661, 663], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L660_C4", "vector": [4, 2, 0.644, 0.0029, 2, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.processor: \n print('ERROR: no processor object exists -> no Classifier to save!')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L662_C12", "label": "print()", "type": "expression", "loc": [662, 662], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L661_C8", "vector": [8, 3, 0.644, 0.001, 3, 0.7, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('ERROR: no processor object exists -> no Classifier to save!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L663_C12", "label": "return", "type": "return", "loc": [663, 663], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L661_C8", "vector": [13, 3, 0.6449, 0.001, 3, 0.7, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L664_C8", "label": "save_Classifier()", "type": "expression", "loc": [664, 664], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L660_C4", "vector": [8, 2, 0.6459, 0.001, 2, 0.58, 1.0, 329, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save_Classifier", "arg_names": [], "import_names": [], "rhs_call_name": "save_Classifier", "annotation": ""}, "snippet": " self.processor.save_Classifier() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "label": "add_polygon_combobox", "type": "function", "loc": [666, 680], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6547, 0.0146, 1, 0.65, 0.7619, 59, 0, 1, 0, 0, 0, 0, 21], "semantic": {"name": "add_polygon_combobox", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_polygon_combobox(self):\n combobox = QtGui.QComboBox()\n combobox.addItem(\"Object\", QtCore.QVariant(\"object\"))\n combobox.addItem(\"Surface\", QtCore.QVariant(\"surface\"))\n combobox.addItem(\"Region of Interest (ROI)\", QtCore.QVariant(\"roi\"))\n combobox.addItem(\"Background\", QtCore.QVariant(\"background\"))\n combobox.addItem(\"Visible Surface-Edge\", QtCore.QVariant(\"edge\"))\n combobox.addItem(\"Wall-Surface-Edge\", QtCore.QVariant(\"edge_up\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L667_C8", "label": "combobox = QComboBox()", "type": "assigned_variable", "loc": [667, 667], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [14, 2, 0.6488, 0.001, 2, 0.45, 0.0, 460, 3, 0, 0, 0, 556, 10, 1], "semantic": {"name": "combobox", "arg_names": [], "import_names": [], "rhs_call_name": "QComboBox", "annotation": ""}, "snippet": " combobox = QtGui.QComboBox()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L668_C8", "label": "addItem()", "type": "expression", "loc": [668, 668], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6498, 0.001, 2, 0.45, 0.0833, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Object\", QtCore.QVariant(\"object\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L669_C8", "label": "addItem()", "type": "expression", "loc": [669, 669], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6508, 0.001, 2, 0.45, 0.1667, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Surface\", QtCore.QVariant(\"surface\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L670_C8", "label": "addItem()", "type": "expression", "loc": [670, 670], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6518, 0.001, 2, 0.45, 0.25, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Region of Interest (ROI)\", QtCore.QVariant(\"roi\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L671_C8", "label": "addItem()", "type": "expression", "loc": [671, 671], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6527, 0.001, 2, 0.45, 0.3333, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Background\", QtCore.QVariant(\"background\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L672_C8", "label": "addItem()", "type": "expression", "loc": [672, 672], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6537, 0.001, 2, 0.45, 0.4167, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Visible Surface-Edge\", QtCore.QVariant(\"edge\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L673_C8", "label": "addItem()", "type": "expression", "loc": [673, 673], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6547, 0.001, 2, 0.45, 0.5, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Wall-Surface-Edge\", QtCore.QVariant(\"edge_up\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L674_C8", "label": "addItem()", "type": "expression", "loc": [674, 674], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6556, 0.001, 2, 0.45, 0.5833, 670, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addItem", "arg_names": [], "import_names": [], "rhs_call_name": "addItem", "annotation": ""}, "snippet": " combobox.addItem(\"Downward-Surface-Edge\", QtCore.QVariant(\"edge_down\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L675_C8", "label": "setCurrentIndex()", "type": "expression", "loc": [675, 675], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6566, 0.001, 2, 0.45, 0.6667, 142, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCurrentIndex", "arg_names": [], "import_names": [], "rhs_call_name": "setCurrentIndex", "annotation": ""}, "snippet": " combobox.setCurrentIndex(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L677_C8", "label": "connect()", "type": "expression", "loc": [677, 677], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6586, 0.001, 2, 0.45, 0.75, 242, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'), self.slot_update_polygon_labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L678_C8", "label": "append()", "type": "expression", "loc": [678, 678], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6595, 0.001, 2, 0.45, 0.8333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.polygon_comboboxes.append(combobox)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L679_C8", "label": "addWidget()", "type": "expression", "loc": [679, 679], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6605, 0.001, 2, 0.45, 0.9167, 653, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addWidget", "arg_names": [], "import_names": [], "rhs_call_name": "addWidget", "annotation": ""}, "snippet": " self.right_layout.addWidget(combobox, QtCore.Qt.AlignTop)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L680_C8", "label": "slot_update_polygon_labels()", "type": "expression", "loc": [680, 680], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "vector": [8, 2, 0.6615, 0.001, 2, 0.45, 1.0, 63, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_update_polygon_labels", "arg_names": [], "import_names": [], "rhs_call_name": "slot_update_polygon_labels", "annotation": ""}, "snippet": " self.slot_update_polygon_labels()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "label": "slot_delete", "type": "function", "loc": [683, 694], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6697, 0.0117, 1, 0.65, 0.7857, 588, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "slot_delete", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_delete(self):\n #delete scan-files:\n if os.path.isfile(self.current_dataset.scan_filename):\n os.remove(self.path + '/' + self.current_dataset.scan_filename);\n if os.path.isfile(self.current_dataset.image_filename):\n os.remove(self.path + '/' + self.current_dataset.image_filename);\n if os.path.isfile(self.current_dataset.image_artag_filename):\n os.remove(self.path + '/' + self.current_dataset.image_artag_filename); "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L685_C8", "label": "if", "type": "if", "loc": [685, 686], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "vector": [4, 2, 0.6668, 0.0019, 2, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isfile(self.current_dataset.scan_filename):\n os.remove(self.path + '/' + self.current_dataset.scan_filename);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L686_C12", "label": "remove()", "type": "expression", "loc": [686, 686], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L685_C8", "vector": [8, 3, 0.6673, 0.001, 3, 0.27, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(self.path + '/' + self.current_dataset.scan_filename);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L687_C8", "label": "if", "type": "if", "loc": [687, 688], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "vector": [4, 2, 0.6688, 0.0019, 2, 0.95, 0.2, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isfile(self.current_dataset.image_filename):\n os.remove(self.path + '/' + self.current_dataset.image_filename);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L688_C12", "label": "remove()", "type": "expression", "loc": [688, 688], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L687_C8", "vector": [8, 3, 0.6693, 0.001, 3, 0.46, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(self.path + '/' + self.current_dataset.image_filename);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L689_C8", "label": "if", "type": "if", "loc": [689, 690], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "vector": [4, 2, 0.6707, 0.0019, 2, 0.95, 0.4, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isfile(self.current_dataset.image_artag_filename):\n os.remove(self.path + '/' + self.current_dataset.image_artag_filename); "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L690_C12", "label": "remove()", "type": "expression", "loc": [690, 690], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L689_C8", "vector": [8, 3, 0.6712, 0.001, 3, 0.4, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(self.path + '/' + self.current_dataset.image_artag_filename); "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L692_C8", "label": "self.current_dataset = delete_current_dataset()", "type": "assigned_variable", "loc": [692, 692], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "vector": [14, 2, 0.6732, 0.001, 2, 0.95, 0.6, 782, 3, 0, 0, 0, 145, 10, 1], "semantic": {"name": "self.current_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "delete_current_dataset", "annotation": ""}, "snippet": " self.current_dataset = self.scans_database.delete_current_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L693_C8", "label": "load_values_from_dataset()", "type": "expression", "loc": [693, 693], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "vector": [8, 2, 0.6741, 0.001, 2, 0.95, 0.8, 632, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load_values_from_dataset", "arg_names": [], "import_names": [], "rhs_call_name": "load_values_from_dataset", "annotation": ""}, "snippet": " self.load_values_from_dataset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L694_C8", "label": "slot_save()", "type": "expression", "loc": [694, 694], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "vector": [8, 2, 0.6751, 0.001, 2, 0.95, 1.0, 522, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": [], "import_names": [], "rhs_call_name": "slot_save", "annotation": ""}, "snippet": " self.slot_save() #save for consistency with files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L696_C4", "label": "slot_save", "type": "function", "loc": [696, 697], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6775, 0.0019, 1, 0.65, 0.8095, 522, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "slot_save", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_save(self):\n self.scans_database.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L697_C8", "label": "save()", "type": "expression", "loc": [697, 697], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L696_C4", "vector": [8, 2, 0.678, 0.001, 2, 0.1, 0.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " self.scans_database.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L699_C4", "label": "slot_update_surface_type", "type": "function", "loc": [699, 703], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6819, 0.0049, 1, 0.65, 0.8333, 416, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "slot_update_surface_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_update_surface_type(self):\n if True == self.init_in_progress:\n return \n box = self.surface_type_combobox\n self.current_dataset.surface_type = str(box.itemData(box.currentIndex()).toString())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L700_C8", "label": "if", "type": "if", "loc": [700, 701], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L699_C4", "vector": [4, 2, 0.6814, 0.0019, 2, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True == self.init_in_progress:\n return "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L701_C12", "label": "return", "type": "return", "loc": [701, 701], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L700_C8", "vector": [13, 3, 0.6819, 0.001, 3, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L702_C8", "label": "box =", "type": "assigned_variable", "loc": [702, 702], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L699_C4", "vector": [14, 2, 0.6829, 0.001, 2, 0.32, 0.5, 918, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "box", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " box = self.surface_type_combobox"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L703_C8", "label": "self.current_dataset.surface_type = str()", "type": "assigned_variable", "loc": [703, 703], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L699_C4", "vector": [14, 2, 0.6839, 0.001, 2, 0.32, 1.0, 52, 3, 1, 0, 0, 52, 10, 4], "semantic": {"name": "self.current_dataset.surface_type", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " self.current_dataset.surface_type = str(box.itemData(box.currentIndex()).toString())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L705_C4", "label": "slot_update_display_3d_type", "type": "function", "loc": [705, 709], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6877, 0.0049, 1, 0.65, 0.8571, 7, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "slot_update_display_3d_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_update_display_3d_type(self):\n if True == self.init_in_progress:\n return \n box = self.display_3d_type_combobox\n self.display_3d_type = str(box.itemData(box.currentIndex()).toString()) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L706_C8", "label": "if", "type": "if", "loc": [706, 707], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L705_C4", "vector": [4, 2, 0.6873, 0.0019, 2, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True == self.init_in_progress:\n return "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L707_C12", "label": "return", "type": "return", "loc": [707, 707], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L706_C8", "vector": [13, 3, 0.6877, 0.001, 3, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L708_C8", "label": "box =", "type": "assigned_variable", "loc": [708, 708], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L705_C4", "vector": [14, 2, 0.6887, 0.001, 2, 0.62, 0.5, 918, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "box", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " box = self.display_3d_type_combobox"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L709_C8", "label": "self.display_3d_type = str()", "type": "assigned_variable", "loc": [709, 709], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L705_C4", "vector": [14, 2, 0.6897, 0.001, 2, 0.62, 1.0, 745, 3, 1, 0, 0, 52, 10, 4], "semantic": {"name": "self.display_3d_type", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " self.display_3d_type = str(box.itemData(box.currentIndex()).toString()) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "label": "slot_update_polygon_label", "type": "function", "loc": [711, 719], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.6955, 0.0088, 1, 0.65, 0.881, 181, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "slot_update_polygon_label", "arg_names": ["self", "index", "label"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_update_polygon_label(self, index, label):\n if True == self.init_in_progress:\n return \n \n box = self.polygon_comboboxes[index]\n boxindex = box.findData(QtCore.QVariant(label))\n box.setCurrentIndex(boxindex) \n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L712_C8", "label": "if", "type": "if", "loc": [712, 713], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "vector": [4, 2, 0.6931, 0.0019, 2, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True == self.init_in_progress:\n return "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L713_C12", "label": "return", "type": "return", "loc": [713, 713], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L712_C8", "vector": [13, 3, 0.6936, 0.001, 3, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L715_C8", "label": "box =", "type": "assigned_variable", "loc": [715, 715], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "vector": [14, 2, 0.6955, 0.001, 2, 0.12, 0.25, 918, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "box", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " box = self.polygon_comboboxes[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L716_C8", "label": "boxindex = findData()", "type": "assigned_variable", "loc": [716, 716], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "vector": [14, 2, 0.6965, 0.001, 2, 0.12, 0.5, 489, 3, 1, 0, 0, 916, 10, 2], "semantic": {"name": "boxindex", "arg_names": [], "import_names": [], "rhs_call_name": "findData", "annotation": ""}, "snippet": " boxindex = box.findData(QtCore.QVariant(label))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L717_C8", "label": "setCurrentIndex()", "type": "expression", "loc": [717, 717], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "vector": [8, 2, 0.6975, 0.001, 2, 0.12, 0.75, 142, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setCurrentIndex", "arg_names": [], "import_names": [], "rhs_call_name": "setCurrentIndex", "annotation": ""}, "snippet": " box.setCurrentIndex(boxindex) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L719_C8", "label": "update()", "type": "expression", "loc": [719, 719], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "vector": [8, 2, 0.6994, 0.001, 2, 0.12, 1.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.draw_widget.update() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L721_C4", "label": "slot_update_polygon_labels", "type": "function", "loc": [721, 730], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.7057, 0.0097, 1, 0.65, 0.9048, 63, 0, 1, 0, 0, 0, 0, 14], "semantic": {"name": "slot_update_polygon_labels", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_update_polygon_labels(self):\n if True == self.init_in_progress:\n return \n \n for index, box in enumerate(self.polygon_comboboxes):\n if index < len(self.current_dataset.polygons):\n self.current_dataset.polygons[index].set_label(str(box.itemData(box.currentIndex()).toString()))\n print(str(index) + \" xx \" + str(box.itemData(box.currentIndex()).toString()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L722_C8", "label": "if", "type": "if", "loc": [722, 723], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L721_C4", "vector": [4, 2, 0.7028, 0.0019, 2, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True == self.init_in_progress:\n return "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L723_C12", "label": "return", "type": "return", "loc": [723, 723], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L722_C8", "vector": [13, 3, 0.7033, 0.001, 3, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L725_C8", "label": "for index, box", "type": "for", "loc": [725, 728], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L721_C4", "vector": [6, 2, 0.7067, 0.0039, 2, 0.18, 0.5, 860, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "index, box", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index, box in enumerate(self.polygon_comboboxes):\n if index < len(self.current_dataset.polygons):\n self.current_dataset.polygons[index].set_label(str(box.itemData(box.currentIndex()).toString()))\n print(str(index) + \" xx \" + str(box.itemData(box.currentIndex()).toString()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L726_C12", "label": "if", "type": "if", "loc": [726, 728], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L725_C8", "vector": [4, 3, 0.7072, 0.0029, 3, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < len(self.current_dataset.polygons):\n self.current_dataset.polygons[index].set_label(str(box.itemData(box.currentIndex()).toString()))\n print(str(index) + \" xx \" + str(box.itemData(box.currentIndex()).toString()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L727_C16", "label": "set_label()", "type": "expression", "loc": [727, 727], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L726_C12", "vector": [8, 4, 0.7072, 0.001, 4, 0.29, 0.0, 88, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "set_label", "arg_names": [], "import_names": [], "rhs_call_name": "set_label", "annotation": ""}, "snippet": " self.current_dataset.polygons[index].set_label(str(box.itemData(box.currentIndex()).toString()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L728_C16", "label": "print()", "type": "expression", "loc": [728, 728], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L726_C12", "vector": [8, 4, 0.7082, 0.001, 4, 0.29, 1.0, 535, 3, 1, 0, 0, 0, 0, 6], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(str(index) + \" xx \" + str(box.itemData(box.currentIndex()).toString()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L730_C8", "label": "update()", "type": "expression", "loc": [730, 730], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L721_C4", "vector": [8, 2, 0.7101, 0.001, 2, 0.18, 1.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.draw_widget.update() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L732_C4", "label": "slot_update_polygons", "type": "function", "loc": [732, 743], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.7174, 0.0117, 1, 0.65, 0.9286, 576, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "slot_update_polygons", "arg_names": ["self", "polygons", "current_index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_update_polygons(self, polygons, current_index):\n\n while len(self.polygon_comboboxes) < len(polygons):\n self.add_polygon_combobox()\n\n #self.polygon_comboboxes[self.current_polygon_index].x()\n for index, box in enumerate(self.polygon_comboboxes):\n if index < len(polygons):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:While_L734_C8", "label": "while", "type": "while", "loc": [734, 735], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L732_C4", "vector": [5, 2, 0.7145, 0.0019, 2, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(self.polygon_comboboxes) < len(polygons):\n self.add_polygon_combobox()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L735_C12", "label": "add_polygon_combobox()", "type": "expression", "loc": [735, 735], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:While_L734_C8", "vector": [8, 3, 0.715, 0.001, 3, 0.73, 0.0, 59, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "add_polygon_combobox", "arg_names": [], "import_names": [], "rhs_call_name": "add_polygon_combobox", "annotation": ""}, "snippet": " self.add_polygon_combobox()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L738_C8", "label": "for index, box", "type": "for", "loc": [738, 742], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L732_C4", "vector": [6, 2, 0.7198, 0.0049, 2, 0.05, 0.5, 860, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "index, box", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index, box in enumerate(self.polygon_comboboxes):\n if index < len(polygons):\n self.polygon_comboboxes[index].show()\n else:\n self.polygon_comboboxes[index].hide() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L739_C12", "label": "if", "type": "if", "loc": [739, 742], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L738_C8", "vector": [4, 3, 0.7203, 0.0039, 3, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < len(polygons):\n self.polygon_comboboxes[index].show()\n else:\n self.polygon_comboboxes[index].hide() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L740_C16", "label": "show()", "type": "expression", "loc": [740, 740], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L739_C12", "vector": [8, 4, 0.7198, 0.001, 4, 0.07, 0.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " self.polygon_comboboxes[index].show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L742_C16", "label": "hide()", "type": "expression", "loc": [742, 742], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L739_C12", "vector": [8, 4, 0.7218, 0.001, 4, 0.07, 1.0, 434, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "hide", "arg_names": [], "import_names": [], "rhs_call_name": "hide", "annotation": ""}, "snippet": " self.polygon_comboboxes[index].hide() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L743_C8", "label": "update()", "type": "expression", "loc": [743, 743], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L732_C4", "vector": [8, 2, 0.7228, 0.001, 2, 0.05, 1.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "label": "paintEvent", "type": "function", "loc": [745, 756], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.7301, 0.0117, 1, 0.65, 0.9524, 838, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "paintEvent", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def paintEvent(self, event):\n painter = QtGui.QPainter()\n painter.begin(self)\n \n x = self.polygon_comboboxes[self.draw_widget.get_current_polygon_index()].x() \n y = self.polygon_comboboxes[self.draw_widget.get_current_polygon_index()].y() \n color = QtGui.QColor(255,0,0)\n painter.setPen(color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L746_C8", "label": "painter = QPainter()", "type": "assigned_variable", "loc": [746, 746], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [14, 2, 0.7257, 0.001, 2, 0.03, 0.0, 481, 3, 0, 0, 0, 972, 10, 1], "semantic": {"name": "painter", "arg_names": [], "import_names": [], "rhs_call_name": "QPainter", "annotation": ""}, "snippet": " painter = QtGui.QPainter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L747_C8", "label": "begin()", "type": "expression", "loc": [747, 747], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [8, 2, 0.7267, 0.001, 2, 0.03, 0.125, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "begin", "arg_names": [], "import_names": [], "rhs_call_name": "begin", "annotation": ""}, "snippet": " painter.begin(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L749_C8", "label": "x = x()", "type": "assigned_variable", "loc": [749, 749], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [14, 2, 0.7286, 0.001, 2, 0.03, 0.25, 190, 3, 0, 0, 0, 190, 10, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "x", "annotation": ""}, "snippet": " x = self.polygon_comboboxes[self.draw_widget.get_current_polygon_index()].x() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L750_C8", "label": "y = y()", "type": "assigned_variable", "loc": [750, 750], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [14, 2, 0.7296, 0.001, 2, 0.03, 0.375, 304, 3, 0, 0, 0, 304, 10, 2], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "y", "annotation": ""}, "snippet": " y = self.polygon_comboboxes[self.draw_widget.get_current_polygon_index()].y() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L751_C8", "label": "color = QColor()", "type": "assigned_variable", "loc": [751, 751], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [14, 2, 0.7305, 0.001, 2, 0.03, 0.5, 776, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color = QtGui.QColor(255,0,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L752_C8", "label": "setPen()", "type": "expression", "loc": [752, 752], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [8, 2, 0.7315, 0.001, 2, 0.03, 0.625, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L753_C8", "label": "setBrush()", "type": "expression", "loc": [753, 753], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [8, 2, 0.7325, 0.001, 2, 0.03, 0.75, 254, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setBrush", "arg_names": [], "import_names": [], "rhs_call_name": "setBrush", "annotation": ""}, "snippet": " painter.setBrush(color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L754_C8", "label": "drawEllipse()", "type": "expression", "loc": [754, 754], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [8, 2, 0.7335, 0.001, 2, 0.03, 0.875, 708, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "drawEllipse", "arg_names": [], "import_names": [], "rhs_call_name": "drawEllipse", "annotation": ""}, "snippet": " painter.drawEllipse(QtCore.QRectF(x-8,y+8,6,6))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L756_C8", "label": "end()", "type": "expression", "loc": [756, 756], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "vector": [8, 2, 0.7354, 0.001, 2, 0.03, 1.0, 128, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "end", "annotation": ""}, "snippet": " painter.end()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L758_C4", "label": "get_display_mode", "type": "function", "loc": [758, 759], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.7378, 0.0019, 1, 0.65, 0.9762, 57, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_display_mode", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_display_mode(self):\n return self.display_mode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L759_C8", "label": "return", "type": "return", "loc": [759, 759], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L758_C4", "vector": [13, 2, 0.7383, 0.001, 2, 0.01, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.display_mode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L761_C4", "label": "slot_define_ground_plane", "type": "function", "loc": [761, 764], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "vector": [2, 1, 0.7417, 0.0039, 1, 0.65, 1.0, 338, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "slot_define_ground_plane", "arg_names": ["self", "ground_plane_points"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def slot_define_ground_plane(self, ground_plane_points):\n #assumes that intensity image is loaded in processor!\n (self.current_dataset.ground_plane_normal, self.current_dataset.ground_plane_three_points) = self.processor.get_3d_plane_normal(ground_plane_points)\n self.slot_display_intensity() #switch back to image mode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L763_C8", "label": " = get_3d_plane_normal()", "type": "assigned_variable", "loc": [763, 763], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L761_C4", "vector": [14, 2, 0.7422, 0.001, 2, 0.37, 0.0, 0, 3, 1, 0, 0, 679, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_3d_plane_normal", "annotation": ""}, "snippet": " (self.current_dataset.ground_plane_normal, self.current_dataset.ground_plane_three_points) = self.processor.get_3d_plane_normal(ground_plane_points)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L764_C8", "label": "slot_display_intensity()", "type": "expression", "loc": [764, 764], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L761_C4", "vector": [8, 2, 0.7432, 0.001, 2, 0.37, 1.0, 844, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slot_display_intensity", "arg_names": [], "import_names": [], "rhs_call_name": "slot_display_intensity", "annotation": ""}, "snippet": " self.slot_display_intensity() #switch back to image mode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "label": "draw_widget", "type": "class", "loc": [766, 1017], "level": 0, "parent": null, "vector": [3, 0, 0.8672, 0.2451, 0, 0.66, 0.9444, 636, 0, 13, 0, 0, 289, 0, 99], "semantic": {"name": "draw_widget", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class draw_widget(QtGui.QLabel):\n \n \n ground_plane_points = []\n \n def __init__(self,polygons, image_filename, parent=None):\n QtGui.QWidget.__init__(self, parent)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L769_C4", "label": "ground_plane_points =", "type": "assigned_variable", "loc": [769, 769], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [14, 1, 0.7481, 0.001, 1, 0.11, 0.0, 523, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ground_plane_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ground_plane_points = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "label": "__init__", "type": "function", "loc": [771, 785], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.7568, 0.0146, 1, 0.11, 0.0769, 555, 0, 4, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "polygons", "image_filename", "parent"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,polygons, image_filename, parent=None):\n QtGui.QWidget.__init__(self, parent)\n\n self.scaleFactor = False #init is done later\n\n self.setBackgroundRole(QtGui.QPalette.Base)\n #self.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored)\n self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L772_C8", "label": "__init__()", "type": "expression", "loc": [772, 772], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "vector": [8, 2, 0.751, 0.001, 2, 0.49, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " QtGui.QWidget.__init__(self, parent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L774_C8", "label": "self.scaleFactor =", "type": "assigned_variable", "loc": [774, 774], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "vector": [14, 2, 0.7529, 0.001, 2, 0.49, 0.1429, 603, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.scaleFactor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scaleFactor = False #init is done later"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L776_C8", "label": "setBackgroundRole()", "type": "expression", "loc": [776, 776], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "vector": [8, 2, 0.7549, 0.001, 2, 0.49, 0.2857, 482, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setBackgroundRole", "arg_names": [], "import_names": [], "rhs_call_name": "setBackgroundRole", "annotation": ""}, "snippet": " self.setBackgroundRole(QtGui.QPalette.Base)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L778_C8", "label": "setSizePolicy()", "type": "expression", "loc": [778, 778], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "vector": [8, 2, 0.7568, 0.001, 2, 0.49, 0.4286, 289, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setSizePolicy", "arg_names": [], "import_names": [], "rhs_call_name": "setSizePolicy", "annotation": ""}, "snippet": " self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L779_C8", "label": "setScaledContents()", "type": "expression", "loc": [779, 779], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "vector": [8, 2, 0.7578, 0.001, 2, 0.49, 0.5714, 929, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setScaledContents", "arg_names": [], "import_names": [], "rhs_call_name": "setScaledContents", "annotation": ""}, "snippet": " self.setScaledContents(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L782_C8", "label": "set_polygons()", "type": "expression", "loc": [782, 782], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "vector": [8, 2, 0.7607, 0.001, 2, 0.49, 0.7143, 601, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_polygons", "arg_names": [], "import_names": [], "rhs_call_name": "set_polygons", "annotation": ""}, "snippet": " self.set_polygons(polygons)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L783_C8", "label": "set_image()", "type": "expression", "loc": [783, 783], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "vector": [8, 2, 0.7617, 0.001, 2, 0.49, 0.8571, 942, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_image", "arg_names": [], "import_names": [], "rhs_call_name": "set_image", "annotation": ""}, "snippet": " self.set_image(image_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L785_C8", "label": "setScaleFactor()", "type": "expression", "loc": [785, 785], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "vector": [8, 2, 0.7636, 0.001, 2, 0.49, 1.0, 230, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setScaleFactor", "arg_names": [], "import_names": [], "rhs_call_name": "setScaleFactor", "annotation": ""}, "snippet": " self.setScaleFactor(0.8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L787_C4", "label": "setScaleFactor", "type": "function", "loc": [787, 789], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.7665, 0.0029, 1, 0.11, 0.1538, 230, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setScaleFactor", "arg_names": ["self", "f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setScaleFactor(self, f):\n self.scaleFactor = f\n self.updateImageSize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L788_C8", "label": "self.scaleFactor =", "type": "assigned_variable", "loc": [788, 788], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L787_C4", "vector": [14, 2, 0.7665, 0.001, 2, 0.17, 0.0, 603, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.scaleFactor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scaleFactor = f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L789_C8", "label": "updateImageSize()", "type": "expression", "loc": [789, 789], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L787_C4", "vector": [8, 2, 0.7675, 0.001, 2, 0.17, 1.0, 15, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "updateImageSize", "arg_names": [], "import_names": [], "rhs_call_name": "updateImageSize", "annotation": ""}, "snippet": " self.updateImageSize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "label": "updateImageSize", "type": "function", "loc": [791, 805], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.7763, 0.0146, 1, 0.11, 0.2308, 15, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "updateImageSize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def updateImageSize(self):\n if self.parent().get_display_mode() == 'intensities' or self.parent().get_display_mode() == 'features':\n self.scaleFactor = 1 \n else:\n self.scaleFactor = 0.8 \n self.parent().resize(900, 700) \n \n self.setMinimumHeight(self.image.height() * self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L792_C8", "label": "if", "type": "if", "loc": [792, 796], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "vector": [4, 2, 0.7724, 0.0049, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.parent().get_display_mode() == 'intensities' or self.parent().get_display_mode() == 'features':\n self.scaleFactor = 1 \n else:\n self.scaleFactor = 0.8 \n self.parent().resize(900, 700) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L793_C12", "label": "self.scaleFactor =", "type": "assigned_variable", "loc": [793, 793], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L792_C8", "vector": [14, 3, 0.7714, 0.001, 3, 0.09, 0.0, 603, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.scaleFactor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scaleFactor = 1 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L795_C12", "label": "self.scaleFactor =", "type": "assigned_variable", "loc": [795, 795], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L792_C8", "vector": [14, 3, 0.7733, 0.001, 3, 0.09, 0.5, 603, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.scaleFactor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scaleFactor = 0.8 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L796_C12", "label": "resize()", "type": "expression", "loc": [796, 796], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L792_C8", "vector": [8, 3, 0.7743, 0.001, 3, 0.09, 1.0, 834, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "resize", "arg_names": [], "import_names": [], "rhs_call_name": "resize", "annotation": ""}, "snippet": " self.parent().resize(900, 700) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L798_C8", "label": "setMinimumHeight()", "type": "expression", "loc": [798, 798], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "vector": [8, 2, 0.7763, 0.001, 2, 0.46, 0.1429, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setMinimumHeight", "arg_names": [], "import_names": [], "rhs_call_name": "setMinimumHeight", "annotation": ""}, "snippet": " self.setMinimumHeight(self.image.height() * self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L799_C8", "label": "setMinimumWidth()", "type": "expression", "loc": [799, 799], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "vector": [8, 2, 0.7772, 0.001, 2, 0.46, 0.2857, 812, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setMinimumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMinimumWidth", "annotation": ""}, "snippet": " self.setMinimumWidth(self.image.width() * self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L800_C8", "label": "setMaximumHeight()", "type": "expression", "loc": [800, 800], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "vector": [8, 2, 0.7782, 0.001, 2, 0.46, 0.4286, 421, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setMaximumHeight", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumHeight", "annotation": ""}, "snippet": " self.setMaximumHeight(self.image.height() * self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L801_C8", "label": "setMaximumWidth()", "type": "expression", "loc": [801, 801], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "vector": [8, 2, 0.7792, 0.001, 2, 0.46, 0.5714, 668, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setMaximumWidth", "arg_names": [], "import_names": [], "rhs_call_name": "setMaximumWidth", "annotation": ""}, "snippet": " self.setMaximumWidth(self.image.width() * self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L803_C8", "label": "pixmap = fromImage()", "type": "assigned_variable", "loc": [803, 803], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "vector": [14, 2, 0.7811, 0.001, 2, 0.46, 0.7143, 535, 3, 1, 0, 0, 154, 10, 1], "semantic": {"name": "pixmap", "arg_names": [], "import_names": [], "rhs_call_name": "fromImage", "annotation": ""}, "snippet": " pixmap = QtGui.QPixmap.fromImage(self.image)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L804_C8", "label": "resize()", "type": "expression", "loc": [804, 804], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "vector": [8, 2, 0.7821, 0.001, 2, 0.46, 0.8571, 834, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "resize", "arg_names": [], "import_names": [], "rhs_call_name": "resize", "annotation": ""}, "snippet": " self.resize(self.scaleFactor * pixmap.size());"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L805_C8", "label": "setPixmap()", "type": "expression", "loc": [805, 805], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "vector": [8, 2, 0.7831, 0.001, 2, 0.46, 1.0, 755, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPixmap", "arg_names": [], "import_names": [], "rhs_call_name": "setPixmap", "annotation": ""}, "snippet": " self.setPixmap(pixmap);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "label": "set_polygons", "type": "function", "loc": [808, 812], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.7879, 0.0049, 1, 0.11, 0.3077, 601, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "set_polygons", "arg_names": ["self", "polygons"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_polygons(self, polygons):\n self.polygons = polygons\n self.current_polygon_index = 0\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L809_C8", "label": "self.polygons =", "type": "assigned_variable", "loc": [809, 809], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "vector": [14, 2, 0.787, 0.001, 2, 0.67, 0.0, 511, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.polygons", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.polygons = polygons"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L810_C8", "label": "self.current_polygon_index =", "type": "assigned_variable", "loc": [810, 810], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "vector": [14, 2, 0.7879, 0.001, 2, 0.67, 0.3333, 671, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.current_polygon_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_polygon_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L811_C8", "label": "update()", "type": "expression", "loc": [811, 811], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "vector": [8, 2, 0.7889, 0.001, 2, 0.67, 0.6667, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L812_C8", "label": "emit()", "type": "expression", "loc": [812, 812], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "vector": [8, 2, 0.7899, 0.001, 2, 0.67, 1.0, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "label": "set_image", "type": "function", "loc": [814, 822], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.7957, 0.0088, 1, 0.11, 0.3846, 942, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "set_image", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_image(self, filename):\n print(filename)\n if os.path.isfile(filename):\n self.image = QtGui.QImage(filename)\n else:\n self.image = QtGui.QImage('noimage.png')\n \n self.updateImageSize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L815_C8", "label": "print()", "type": "expression", "loc": [815, 815], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "vector": [8, 2, 0.7928, 0.001, 2, 0.65, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L816_C8", "label": "if", "type": "if", "loc": [816, 819], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "vector": [4, 2, 0.7952, 0.0039, 2, 0.65, 0.3333, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isfile(filename):\n self.image = QtGui.QImage(filename)\n else:\n self.image = QtGui.QImage('noimage.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L817_C12", "label": "self.image = QImage()", "type": "assigned_variable", "loc": [817, 817], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L816_C8", "vector": [14, 3, 0.7947, 0.001, 3, 0.1, 0.0, 219, 3, 1, 0, 0, 723, 10, 1], "semantic": {"name": "self.image", "arg_names": [], "import_names": [], "rhs_call_name": "QImage", "annotation": ""}, "snippet": " self.image = QtGui.QImage(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L819_C12", "label": "self.image = QImage()", "type": "assigned_variable", "loc": [819, 819], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L816_C8", "vector": [14, 3, 0.7967, 0.001, 3, 0.1, 1.0, 219, 3, 1, 0, 0, 723, 10, 1], "semantic": {"name": "self.image", "arg_names": [], "import_names": [], "rhs_call_name": "QImage", "annotation": ""}, "snippet": " self.image = QtGui.QImage('noimage.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L821_C8", "label": "updateImageSize()", "type": "expression", "loc": [821, 821], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "vector": [8, 2, 0.7986, 0.001, 2, 0.65, 0.6667, 15, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "updateImageSize", "arg_names": [], "import_names": [], "rhs_call_name": "updateImageSize", "annotation": ""}, "snippet": " self.updateImageSize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L822_C8", "label": "update()", "type": "expression", "loc": [822, 822], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "vector": [8, 2, 0.7996, 0.001, 2, 0.65, 1.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "label": "paintEvent", "type": "function", "loc": [824, 879], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.8283, 0.0545, 1, 0.11, 0.4615, 838, 0, 2, 0, 0, 0, 0, 56], "semantic": {"name": "paintEvent", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def paintEvent(self, event):\n # draw image as label-pixmap\n QtGui.QLabel.paintEvent(self,event) \n painter = QtGui.QPainter()\n painter.begin(self)\n if self.parent().get_display_mode() == 'image' or self.parent().get_display_mode() == 'labels':\n color = QtGui.QColor(0,0,255)\n color_surface = QtGui.QColor(0,255,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L826_C8", "label": "paintEvent()", "type": "expression", "loc": [826, 826], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "vector": [8, 2, 0.8035, 0.001, 2, 0.4, 0.0, 838, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "paintEvent", "arg_names": [], "import_names": [], "rhs_call_name": "paintEvent", "annotation": ""}, "snippet": " QtGui.QLabel.paintEvent(self,event) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L827_C8", "label": "painter = QPainter()", "type": "assigned_variable", "loc": [827, 827], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "vector": [14, 2, 0.8045, 0.001, 2, 0.4, 0.25, 481, 3, 0, 0, 0, 972, 10, 1], "semantic": {"name": "painter", "arg_names": [], "import_names": [], "rhs_call_name": "QPainter", "annotation": ""}, "snippet": " painter = QtGui.QPainter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L828_C8", "label": "begin()", "type": "expression", "loc": [828, 828], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "vector": [8, 2, 0.8054, 0.001, 2, 0.4, 0.5, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "begin", "arg_names": [], "import_names": [], "rhs_call_name": "begin", "annotation": ""}, "snippet": " painter.begin(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "label": "if", "type": "if", "loc": [829, 878], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "vector": [4, 2, 0.8303, 0.0486, 2, 0.4, 0.75, 0, 0, 0, 0, 0, 0, 0, 52], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.parent().get_display_mode() == 'image' or self.parent().get_display_mode() == 'labels':\n color = QtGui.QColor(0,0,255)\n color_surface = QtGui.QColor(0,255,0)\n color_roi = QtGui.QColor(255,255,255)\n color_edge = QtGui.QColor(255,255,0)\n color_edge_up = QtGui.QColor(255,255,255)\n color_edge_down = QtGui.QColor(255,150,255)\n color_background = QtGui.QColor(255,0,255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L830_C12", "label": "color = QColor()", "type": "assigned_variable", "loc": [830, 830], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [14, 3, 0.8074, 0.001, 3, 0.2, 0.0, 776, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color = QtGui.QColor(0,0,255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L831_C12", "label": "color_surface = QColor()", "type": "assigned_variable", "loc": [831, 831], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [14, 3, 0.8084, 0.001, 3, 0.2, 0.1111, 974, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color_surface", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color_surface = QtGui.QColor(0,255,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L832_C12", "label": "color_roi = QColor()", "type": "assigned_variable", "loc": [832, 832], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [14, 3, 0.8093, 0.001, 3, 0.2, 0.2222, 526, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color_roi", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color_roi = QtGui.QColor(255,255,255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L833_C12", "label": "color_edge = QColor()", "type": "assigned_variable", "loc": [833, 833], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [14, 3, 0.8103, 0.001, 3, 0.2, 0.3333, 368, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color_edge", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color_edge = QtGui.QColor(255,255,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L834_C12", "label": "color_edge_up = QColor()", "type": "assigned_variable", "loc": [834, 834], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [14, 3, 0.8113, 0.001, 3, 0.2, 0.4444, 951, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color_edge_up", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color_edge_up = QtGui.QColor(255,255,255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L835_C12", "label": "color_edge_down = QColor()", "type": "assigned_variable", "loc": [835, 835], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [14, 3, 0.8123, 0.001, 3, 0.2, 0.5556, 350, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color_edge_down", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color_edge_down = QtGui.QColor(255,150,255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L836_C12", "label": "color_background = QColor()", "type": "assigned_variable", "loc": [836, 836], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [14, 3, 0.8132, 0.001, 3, 0.2, 0.6667, 730, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color_background", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color_background = QtGui.QColor(255,0,255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L837_C12", "label": "color_current = QColor()", "type": "assigned_variable", "loc": [837, 837], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [14, 3, 0.8142, 0.001, 3, 0.2, 0.7778, 275, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color_current", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color_current = QtGui.QColor(255,0,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "label": "for index, polygon", "type": "for", "loc": [839, 872], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [6, 3, 0.8322, 0.0331, 3, 0.2, 0.8889, 86, 3, 0, 0, 0, 0, 0, 34], "semantic": {"name": "index, polygon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index, polygon in enumerate(self.polygons):\n \n last_point = (-1,-1)\n first = True;\n if self.current_polygon_index != index or self.parent().get_display_mode() != 'image':\n if polygon.get_label() == 'surface':\n painter.setPen(color_surface)\n elif polygon.get_label() == 'roi':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L841_C16", "label": "last_point =", "type": "assigned_variable", "loc": [841, 841], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "vector": [14, 4, 0.8181, 0.001, 4, 0.69, 0.0, 438, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "last_point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_point = (-1,-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L842_C16", "label": "first =", "type": "assigned_variable", "loc": [842, 842], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "vector": [14, 4, 0.8191, 0.001, 4, 0.69, 0.25, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L843_C16", "label": "if", "type": "if", "loc": [843, 859], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "vector": [4, 4, 0.8278, 0.0165, 4, 0.69, 0.5, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_polygon_index != index or self.parent().get_display_mode() != 'image':\n if polygon.get_label() == 'surface':\n painter.setPen(color_surface)\n elif polygon.get_label() == 'roi':\n painter.setPen(color_roi) \n elif polygon.get_label() == 'edge':\n painter.setPen(color_edge)\n elif polygon.get_label() == 'edge_up':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L844_C20", "label": "if", "type": "if", "loc": [844, 857], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L843_C16", "vector": [4, 5, 0.8273, 0.0136, 5, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if polygon.get_label() == 'surface':\n painter.setPen(color_surface)\n elif polygon.get_label() == 'roi':\n painter.setPen(color_roi) \n elif polygon.get_label() == 'edge':\n painter.setPen(color_edge)\n elif polygon.get_label() == 'edge_up':\n painter.setPen(color_edge_up)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L845_C24", "label": "setPen()", "type": "expression", "loc": [845, 845], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L844_C20", "vector": [8, 6, 0.822, 0.001, 6, 0.6, 0.0, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color_surface)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L846_C20", "label": "if", "type": "if", "loc": [846, 857], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L844_C20", "vector": [4, 6, 0.8283, 0.0117, 6, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif polygon.get_label() == 'roi':\n painter.setPen(color_roi) \n elif polygon.get_label() == 'edge':\n painter.setPen(color_edge)\n elif polygon.get_label() == 'edge_up':\n painter.setPen(color_edge_up)\n elif polygon.get_label() == 'edge_down':\n painter.setPen(color_edge_down)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L847_C24", "label": "setPen()", "type": "expression", "loc": [847, 847], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L846_C20", "vector": [8, 7, 0.8239, 0.001, 7, 0.4, 0.0, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color_roi) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L848_C20", "label": "if", "type": "if", "loc": [848, 857], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L846_C20", "vector": [4, 7, 0.8293, 0.0097, 7, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif polygon.get_label() == 'edge':\n painter.setPen(color_edge)\n elif polygon.get_label() == 'edge_up':\n painter.setPen(color_edge_up)\n elif polygon.get_label() == 'edge_down':\n painter.setPen(color_edge_down)\n elif polygon.get_label() == 'background':\n painter.setPen(color_background) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L849_C24", "label": "setPen()", "type": "expression", "loc": [849, 849], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L848_C20", "vector": [8, 8, 0.8259, 0.001, 8, 0.61, 0.0, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color_edge)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L850_C20", "label": "if", "type": "if", "loc": [850, 857], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L848_C20", "vector": [4, 8, 0.8303, 0.0078, 8, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif polygon.get_label() == 'edge_up':\n painter.setPen(color_edge_up)\n elif polygon.get_label() == 'edge_down':\n painter.setPen(color_edge_down)\n elif polygon.get_label() == 'background':\n painter.setPen(color_background) \n else:\n painter.setPen(color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L851_C24", "label": "setPen()", "type": "expression", "loc": [851, 851], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L850_C20", "vector": [8, 9, 0.8278, 0.001, 9, 0.04, 0.0, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color_edge_up)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L852_C20", "label": "if", "type": "if", "loc": [852, 857], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L850_C20", "vector": [4, 9, 0.8312, 0.0058, 9, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif polygon.get_label() == 'edge_down':\n painter.setPen(color_edge_down)\n elif polygon.get_label() == 'background':\n painter.setPen(color_background) \n else:\n painter.setPen(color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L853_C24", "label": "setPen()", "type": "expression", "loc": [853, 853], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L852_C20", "vector": [8, 10, 0.8298, 0.001, 10, 0.68, 0.0, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color_edge_down)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L854_C20", "label": "if", "type": "if", "loc": [854, 857], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L852_C20", "vector": [4, 10, 0.8322, 0.0039, 10, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif polygon.get_label() == 'background':\n painter.setPen(color_background) \n else:\n painter.setPen(color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L855_C24", "label": "setPen()", "type": "expression", "loc": [855, 855], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L854_C20", "vector": [8, 11, 0.8317, 0.001, 11, 0.51, 0.0, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color_background) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L857_C24", "label": "setPen()", "type": "expression", "loc": [857, 857], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L854_C20", "vector": [8, 11, 0.8337, 0.001, 11, 0.51, 1.0, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L859_C20", "label": "setPen()", "type": "expression", "loc": [859, 859], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L843_C16", "vector": [8, 5, 0.8356, 0.001, 5, 0.67, 1.0, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color_current)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L861_C16", "label": "for point", "type": "for", "loc": [861, 865], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "vector": [6, 4, 0.8395, 0.0049, 4, 0.69, 0.75, 16, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in polygon.get_points():\n if False == first:\n painter.drawLine(QtCore.QPointF(point[0],point[1]) * self.scaleFactor, QtCore.QPointF(last_point[0],last_point[1]) * self.scaleFactor)\n last_point = point\n first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L862_C20", "label": "if", "type": "if", "loc": [862, 863], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L861_C16", "vector": [4, 5, 0.839, 0.0019, 5, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == first:\n painter.drawLine(QtCore.QPointF(point[0],point[1]) * self.scaleFactor, QtCore.QPointF(last_point[0],last_point[1]) * self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L863_C24", "label": "drawLine()", "type": "expression", "loc": [863, 863], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L862_C20", "vector": [8, 6, 0.8395, 0.001, 6, 0.64, 0.0, 144, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "drawLine", "arg_names": [], "import_names": [], "rhs_call_name": "drawLine", "annotation": ""}, "snippet": " painter.drawLine(QtCore.QPointF(point[0],point[1]) * self.scaleFactor, QtCore.QPointF(last_point[0],last_point[1]) * self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L864_C20", "label": "last_point =", "type": "assigned_variable", "loc": [864, 864], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L861_C16", "vector": [14, 5, 0.8405, 0.001, 5, 0.3, 0.5, 438, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_point = point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L865_C20", "label": "first =", "type": "assigned_variable", "loc": [865, 865], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L861_C16", "vector": [14, 5, 0.8414, 0.001, 5, 0.3, 1.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L868_C16", "label": "if", "type": "if", "loc": [868, 872], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "vector": [4, 4, 0.8463, 0.0049, 4, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.parent().get_display_mode() != 'image' or self.current_polygon_index != index ) and polygon.get_type() == 'polygon' and len(polygon.get_points()) :\n painter.drawLine(QtCore.QPointF(last_point[0],last_point[1]) * self.scaleFactor, QtCore.QPointF(polygon.get_points()[0][0],polygon.get_points()[0][1]) * self.scaleFactor)\n else:\n for point in polygon.get_points():\n painter.drawEllipse(QtCore.QRectF(point[0] * self.scaleFactor-3,point[1] * self.scaleFactor-3,6,6))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L869_C20", "label": "drawLine()", "type": "expression", "loc": [869, 869], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L868_C16", "vector": [8, 5, 0.8453, 0.001, 5, 0.73, 0.0, 144, 3, 2, 0, 0, 0, 0, 5], "semantic": {"name": "drawLine", "arg_names": [], "import_names": [], "rhs_call_name": "drawLine", "annotation": ""}, "snippet": " painter.drawLine(QtCore.QPointF(last_point[0],last_point[1]) * self.scaleFactor, QtCore.QPointF(polygon.get_points()[0][0],polygon.get_points()[0][1]) * self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L871_C20", "label": "for point", "type": "for", "loc": [871, 872], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L868_C16", "vector": [6, 5, 0.8478, 0.0019, 5, 0.73, 1.0, 16, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in polygon.get_points():\n painter.drawEllipse(QtCore.QRectF(point[0] * self.scaleFactor-3,point[1] * self.scaleFactor-3,6,6))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L872_C24", "label": "drawEllipse()", "type": "expression", "loc": [872, 872], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L871_C20", "vector": [8, 6, 0.8482, 0.001, 6, 0.42, 0.0, 708, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "drawEllipse", "arg_names": [], "import_names": [], "rhs_call_name": "drawEllipse", "annotation": ""}, "snippet": " painter.drawEllipse(QtCore.QRectF(point[0] * self.scaleFactor-3,point[1] * self.scaleFactor-3,6,6))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L874_C8", "label": "if", "type": "if", "loc": [874, 878], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "vector": [4, 3, 0.8521, 0.0049, 3, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.parent().get_display_mode() == 'intensities':\n color = QtGui.QColor(255,0,255)\n painter.setPen(color)\n for point in self.ground_plane_points:\n painter.drawEllipse(QtCore.QRectF(point[0] * self.scaleFactor-3,point[1] * self.scaleFactor-3,6,6))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L875_C12", "label": "color = QColor()", "type": "assigned_variable", "loc": [875, 875], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L874_C8", "vector": [14, 4, 0.8512, 0.001, 4, 0.95, 0.0, 776, 3, 3, 0, 0, 787, 10, 1], "semantic": {"name": "color", "arg_names": [], "import_names": [], "rhs_call_name": "QColor", "annotation": ""}, "snippet": " color = QtGui.QColor(255,0,255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L876_C12", "label": "setPen()", "type": "expression", "loc": [876, 876], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L874_C8", "vector": [8, 4, 0.8521, 0.001, 4, 0.95, 0.5, 129, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setPen", "arg_names": [], "import_names": [], "rhs_call_name": "setPen", "annotation": ""}, "snippet": " painter.setPen(color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L877_C12", "label": "for point", "type": "for", "loc": [877, 878], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L874_C8", "vector": [6, 4, 0.8536, 0.0019, 4, 0.95, 1.0, 16, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in self.ground_plane_points:\n painter.drawEllipse(QtCore.QRectF(point[0] * self.scaleFactor-3,point[1] * self.scaleFactor-3,6,6))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L878_C16", "label": "drawEllipse()", "type": "expression", "loc": [878, 878], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L877_C12", "vector": [8, 5, 0.8541, 0.001, 5, 0.1, 0.0, 708, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "drawEllipse", "arg_names": [], "import_names": [], "rhs_call_name": "drawEllipse", "annotation": ""}, "snippet": " painter.drawEllipse(QtCore.QRectF(point[0] * self.scaleFactor-3,point[1] * self.scaleFactor-3,6,6))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L879_C8", "label": "end()", "type": "expression", "loc": [879, 879], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "vector": [8, 2, 0.8551, 0.001, 2, 0.4, 1.0, 128, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "end", "annotation": ""}, "snippet": " painter.end()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L882_C4", "label": "mousePressEvent", "type": "function", "loc": [882, 933], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.8828, 0.0506, 1, 0.11, 0.5385, 277, 0, 2, 0, 0, 0, 0, 59], "semantic": {"name": "mousePressEvent", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def mousePressEvent(self,event):\n \n if self.hasFocus():\n if self.parent().get_display_mode() == 'image':\n if event.button() == QtCore.Qt.LeftButton:\n #print 'coords:', x,' ',y\n point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)\n self.polygons[self.current_polygon_index].add_point(point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L884_C8", "label": "if", "type": "if", "loc": [884, 933], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L882_C4", "vector": [4, 2, 0.8838, 0.0486, 2, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 0, 59], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasFocus():\n if self.parent().get_display_mode() == 'image':\n if event.button() == QtCore.Qt.LeftButton:\n #print 'coords:', x,' ',y\n point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)\n self.polygons[self.current_polygon_index].add_point(point)\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L885_C12", "label": "if", "type": "if", "loc": [885, 928], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L884_C8", "vector": [4, 3, 0.8818, 0.0428, 3, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 57], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.parent().get_display_mode() == 'image':\n if event.button() == QtCore.Qt.LeftButton:\n #print 'coords:', x,' ',y\n point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)\n self.polygons[self.current_polygon_index].add_point(point)\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)\n if event.button() == QtCore.Qt.RightButton:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "label": "if", "type": "if", "loc": [886, 891], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L885_C12", "vector": [4, 4, 0.8643, 0.0058, 4, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if event.button() == QtCore.Qt.LeftButton:\n #print 'coords:', x,' ',y\n point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)\n self.polygons[self.current_polygon_index].add_point(point)\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L888_C20", "label": "point =", "type": "assigned_variable", "loc": [888, 888], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "vector": [14, 5, 0.8638, 0.001, 5, 0.32, 0.0, 16, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L889_C20", "label": "add_point()", "type": "expression", "loc": [889, 889], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "vector": [8, 5, 0.8648, 0.001, 5, 0.32, 0.3333, 692, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_point", "arg_names": [], "import_names": [], "rhs_call_name": "add_point", "annotation": ""}, "snippet": " self.polygons[self.current_polygon_index].add_point(point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L890_C20", "label": "update()", "type": "expression", "loc": [890, 890], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "vector": [8, 5, 0.8658, 0.001, 5, 0.32, 0.6667, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L891_C20", "label": "emit()", "type": "expression", "loc": [891, 891], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "vector": [8, 5, 0.8667, 0.001, 5, 0.32, 1.0, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L892_C16", "label": "if", "type": "if", "loc": [892, 896], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L885_C12", "vector": [4, 4, 0.8696, 0.0049, 4, 0.43, 0.5, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if event.button() == QtCore.Qt.RightButton:\n if False == self.polygons[self.current_polygon_index].is_empty():\n self.polygons[self.current_polygon_index].delete_last_point()\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L893_C20", "label": "if", "type": "if", "loc": [893, 896], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L892_C16", "vector": [4, 5, 0.8701, 0.0039, 5, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.polygons[self.current_polygon_index].is_empty():\n self.polygons[self.current_polygon_index].delete_last_point()\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L894_C24", "label": "delete_last_point()", "type": "expression", "loc": [894, 894], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L893_C20", "vector": [8, 6, 0.8696, 0.001, 6, 0.24, 0.0, 897, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete_last_point", "arg_names": [], "import_names": [], "rhs_call_name": "delete_last_point", "annotation": ""}, "snippet": " self.polygons[self.current_polygon_index].delete_last_point()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L895_C24", "label": "update()", "type": "expression", "loc": [895, 895], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L893_C20", "vector": [8, 6, 0.8706, 0.001, 6, 0.24, 0.5, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L896_C24", "label": "emit()", "type": "expression", "loc": [896, 896], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L893_C20", "vector": [8, 6, 0.8716, 0.001, 6, 0.24, 1.0, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "label": "if", "type": "if", "loc": [897, 928], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L885_C12", "vector": [4, 4, 0.8876, 0.0311, 4, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 42], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.parent().get_display_mode() == 'intensities':\n \n point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)\n print('point:', point)\n if True == self.parent().processor.check_3d_plane_point(point):\n self.ground_plane_points.append(point)\n if len(self.ground_plane_points) < 3:\n self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L899_C16", "label": "point =", "type": "assigned_variable", "loc": [899, 899], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "vector": [14, 5, 0.8745, 0.001, 5, 0.55, 0.0, 16, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L900_C16", "label": "print()", "type": "expression", "loc": [900, 900], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "vector": [8, 5, 0.8755, 0.001, 5, 0.55, 0.3333, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('point:', point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L901_C16", "label": "if", "type": "if", "loc": [901, 907], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "vector": [4, 5, 0.8794, 0.0068, 5, 0.55, 0.6667, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True == self.parent().processor.check_3d_plane_point(point):\n self.ground_plane_points.append(point)\n if len(self.ground_plane_points) < 3:\n self.update()\n else:\n self.emit(QtCore.SIGNAL(\"sigDefineGroundPlane\"), self.ground_plane_points)\n self.ground_plane_points = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L902_C20", "label": "append()", "type": "expression", "loc": [902, 902], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L901_C16", "vector": [8, 6, 0.8774, 0.001, 6, 0.32, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.ground_plane_points.append(point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L903_C20", "label": "if", "type": "if", "loc": [903, 907], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L901_C16", "vector": [4, 6, 0.8804, 0.0049, 6, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self.ground_plane_points) < 3:\n self.update()\n else:\n self.emit(QtCore.SIGNAL(\"sigDefineGroundPlane\"), self.ground_plane_points)\n self.ground_plane_points = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L904_C24", "label": "update()", "type": "expression", "loc": [904, 904], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L903_C20", "vector": [8, 7, 0.8794, 0.001, 7, 0.22, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L906_C24", "label": "emit()", "type": "expression", "loc": [906, 906], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L903_C20", "vector": [8, 7, 0.8813, 0.001, 7, 0.22, 0.5, 627, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigDefineGroundPlane\"), self.ground_plane_points)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L907_C24", "label": "self.ground_plane_points =", "type": "assigned_variable", "loc": [907, 907], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L903_C20", "vector": [14, 7, 0.8823, 0.001, 7, 0.22, 1.0, 657, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.ground_plane_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ground_plane_points = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L910_C12", "label": "if", "type": "if", "loc": [910, 928], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "vector": [4, 5, 0.894, 0.0185, 5, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 30], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.parent().get_display_mode() == 'features': \n point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)\n if True == self.parent().processor.check_3d_plane_point(point):\n print('point:', point)\n point3d = self.parent().processor.get_3d_point(point)\n print('point3d',point3d)\n \n index = self.parent().processor.get_3d_point_index_in_unrotated(point3d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L911_C16", "label": "point =", "type": "assigned_variable", "loc": [911, 911], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L910_C12", "vector": [14, 6, 0.8862, 0.001, 6, 0.07, 0.0, 16, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " point = (event.x() / self.scaleFactor, event.y() / self.scaleFactor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "label": "if", "type": "if", "loc": [912, 928], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L910_C12", "vector": [4, 6, 0.8949, 0.0165, 6, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 26], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True == self.parent().processor.check_3d_plane_point(point):\n print('point:', point)\n point3d = self.parent().processor.get_3d_point(point)\n print('point3d',point3d)\n \n index = self.parent().processor.get_3d_point_index_in_unrotated(point3d)\n self.parent().processor.load_data(self.parent().current_dataset.id)\n self.parent().processor.process_raw_data()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L913_C20", "label": "print()", "type": "expression", "loc": [913, 913], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.8881, 0.001, 7, 0.66, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('point:', point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L914_C20", "label": "point3d = get_3d_point()", "type": "assigned_variable", "loc": [914, 914], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [14, 7, 0.8891, 0.001, 7, 0.66, 0.0833, 846, 3, 1, 0, 0, 70, 10, 2], "semantic": {"name": "point3d", "arg_names": [], "import_names": [], "rhs_call_name": "get_3d_point", "annotation": ""}, "snippet": " point3d = self.parent().processor.get_3d_point(point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L915_C20", "label": "print()", "type": "expression", "loc": [915, 915], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.8901, 0.001, 7, 0.66, 0.1667, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('point3d',point3d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L917_C20", "label": "index = get_3d_point_index_in_unrotated()", "type": "assigned_variable", "loc": [917, 917], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [14, 7, 0.892, 0.001, 7, 0.66, 0.25, 780, 3, 1, 0, 0, 279, 10, 2], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "get_3d_point_index_in_unrotated", "annotation": ""}, "snippet": " index = self.parent().processor.get_3d_point_index_in_unrotated(point3d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L918_C20", "label": "load_data()", "type": "expression", "loc": [918, 918], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.893, 0.001, 7, 0.66, 0.3333, 477, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.parent().processor.load_data(self.parent().current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L919_C20", "label": "process_raw_data()", "type": "expression", "loc": [919, 919], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.894, 0.001, 7, 0.66, 0.4167, 553, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "process_raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "process_raw_data", "annotation": ""}, "snippet": " self.parent().processor.process_raw_data()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L920_C20", "label": "prepare()", "type": "expression", "loc": [920, 920], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.8949, 0.001, 7, 0.66, 0.5, 556, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "prepare", "arg_names": [], "import_names": [], "rhs_call_name": "prepare", "annotation": ""}, "snippet": " self.parent().processor.features.prepare([index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L921_C20", "label": "self.parent().processor.feature_type =", "type": "assigned_variable", "loc": [921, 921], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [14, 7, 0.8959, 0.001, 7, 0.66, 0.5833, 901, 1, 0, 0, 0, 0, 3, 1], "semantic": {"name": "self.parent().processor.feature_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parent().processor.feature_type = 'gaussian_histograms'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L922_C20", "label": "fv = get_featurevector()", "type": "assigned_variable", "loc": [922, 922], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [14, 7, 0.8969, 0.001, 7, 0.66, 0.6667, 914, 3, 2, 0, 0, 16, 10, 2], "semantic": {"name": "fv", "arg_names": [], "import_names": [], "rhs_call_name": "get_featurevector", "annotation": ""}, "snippet": " fv = self.parent().processor.features.get_featurevector(index,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L923_C20", "label": "print()", "type": "expression", "loc": [923, 923], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.8979, 0.001, 7, 0.66, 0.75, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('fv',fv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L924_C20", "label": "display_featurevector()", "type": "expression", "loc": [924, 924], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.8988, 0.001, 7, 0.66, 0.8333, 505, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "display_featurevector", "arg_names": [], "import_names": [], "rhs_call_name": "display_featurevector", "annotation": ""}, "snippet": " self.parent().processor.display_featurevector(fv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L927_C20", "label": "load_data()", "type": "expression", "loc": [927, 927], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.9018, 0.001, 7, 0.66, 0.9167, 477, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "load_data", "arg_names": [], "import_names": [], "rhs_call_name": "load_data", "annotation": ""}, "snippet": " self.parent().processor.load_data(self.parent().current_dataset.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L928_C20", "label": "process_intensities()", "type": "expression", "loc": [928, 928], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "vector": [8, 7, 0.9027, 0.001, 7, 0.66, 1.0, 581, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "process_intensities", "arg_names": [], "import_names": [], "rhs_call_name": "process_intensities", "annotation": ""}, "snippet": " self.parent().processor.process_intensities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L933_C12", "label": "setFocus()", "type": "expression", "loc": [933, 933], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L884_C8", "vector": [8, 3, 0.9076, 0.001, 3, 0.72, 1.0, 638, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "setFocus", "arg_names": [], "import_names": [], "rhs_call_name": "setFocus", "annotation": ""}, "snippet": " self.setFocus()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L935_C4", "label": "mouseDoubleClickEvent", "type": "function", "loc": [935, 940], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.912, 0.0058, 1, 0.11, 0.6154, 8, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "mouseDoubleClickEvent", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def mouseDoubleClickEvent(self,event):\n if self.parent().get_display_mode() == 'image':\n if event.button() == QtCore.Qt.LeftButton:\n self.start_new_polygon()\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L936_C8", "label": "if", "type": "if", "loc": [936, 940], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L935_C4", "vector": [4, 2, 0.9125, 0.0049, 2, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.parent().get_display_mode() == 'image':\n if event.button() == QtCore.Qt.LeftButton:\n self.start_new_polygon()\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L937_C12", "label": "if", "type": "if", "loc": [937, 940], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L936_C8", "vector": [4, 3, 0.9129, 0.0039, 3, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if event.button() == QtCore.Qt.LeftButton:\n self.start_new_polygon()\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L938_C16", "label": "start_new_polygon()", "type": "expression", "loc": [938, 938], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L937_C12", "vector": [8, 4, 0.9125, 0.001, 4, 0.46, 0.0, 189, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start_new_polygon", "arg_names": [], "import_names": [], "rhs_call_name": "start_new_polygon", "annotation": ""}, "snippet": " self.start_new_polygon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L939_C16", "label": "update()", "type": "expression", "loc": [939, 939], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L937_C12", "vector": [8, 4, 0.9134, 0.001, 4, 0.46, 0.5, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L940_C16", "label": "emit()", "type": "expression", "loc": [940, 940], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L937_C12", "vector": [8, 4, 0.9144, 0.001, 4, 0.46, 1.0, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L942_C4", "label": "start_new_polygon", "type": "function", "loc": [942, 947], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.9188, 0.0058, 1, 0.11, 0.6923, 189, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "start_new_polygon", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start_new_polygon(self):\n if False == self.polygons[self.current_polygon_index].is_empty():\n # if self.current_polygon_index == len(self.polygons) - 1:\n self.polygons.append(label_object.label_object()) #last one, append new\n self.current_polygon_index = len(self.polygons) - 1\n print(\"new poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L943_C8", "label": "if", "type": "if", "loc": [943, 947], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L942_C4", "vector": [4, 2, 0.9193, 0.0049, 2, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.polygons[self.current_polygon_index].is_empty():\n # if self.current_polygon_index == len(self.polygons) - 1:\n self.polygons.append(label_object.label_object()) #last one, append new\n self.current_polygon_index = len(self.polygons) - 1\n print(\"new poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L945_C12", "label": "append()", "type": "expression", "loc": [945, 945], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L943_C8", "vector": [8, 3, 0.9193, 0.001, 3, 0.07, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.polygons.append(label_object.label_object()) #last one, append new"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L946_C12", "label": "self.current_polygon_index =", "type": "assigned_variable", "loc": [946, 946], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L943_C8", "vector": [14, 3, 0.9202, 0.001, 3, 0.07, 0.5, 671, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.current_polygon_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_polygon_index = len(self.polygons) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L947_C12", "label": "print()", "type": "expression", "loc": [947, 947], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L943_C8", "vector": [8, 3, 0.9212, 0.001, 3, 0.07, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"new poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L949_C4", "label": "delete_empty_polygon", "type": "function", "loc": [949, 958], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.9275, 0.0097, 1, 0.11, 0.7692, 796, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "delete_empty_polygon", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete_empty_polygon(self):\n if True == self.polygons[self.current_polygon_index].is_empty():\n #and it isn't the only one:\n if 1 != len(self.polygons):\n del self.polygons[self.current_polygon_index]\n if 0 != self.current_polygon_index:\n self.current_polygon_index -= 1\n print(\"new poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L950_C8", "label": "if", "type": "if", "loc": [950, 957], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L949_C4", "vector": [4, 2, 0.9275, 0.0078, 2, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True == self.polygons[self.current_polygon_index].is_empty():\n #and it isn't the only one:\n if 1 != len(self.polygons):\n del self.polygons[self.current_polygon_index]\n if 0 != self.current_polygon_index:\n self.current_polygon_index -= 1\n print(\"new poly index: \", self.current_polygon_index)\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L952_C12", "label": "if", "type": "if", "loc": [952, 957], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L950_C8", "vector": [4, 3, 0.9285, 0.0058, 3, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 1 != len(self.polygons):\n del self.polygons[self.current_polygon_index]\n if 0 != self.current_polygon_index:\n self.current_polygon_index -= 1\n print(\"new poly index: \", self.current_polygon_index)\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L954_C16", "label": "if", "type": "if", "loc": [954, 955], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L952_C12", "vector": [4, 4, 0.9285, 0.0019, 4, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 0 != self.current_polygon_index:\n self.current_polygon_index -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L956_C16", "label": "print()", "type": "expression", "loc": [956, 956], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L952_C12", "vector": [8, 4, 0.93, 0.001, 4, 0.21, 0.5, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"new poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L957_C16", "label": "return", "type": "return", "loc": [957, 957], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L952_C12", "vector": [13, 4, 0.9309, 0.001, 4, 0.21, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L958_C8", "label": "return", "type": "return", "loc": [958, 958], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L949_C4", "vector": [13, 2, 0.9319, 0.001, 2, 0.81, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L960_C4", "label": "keyPressEvent", "type": "function", "loc": [960, 1011], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.9587, 0.0506, 1, 0.11, 0.8462, 207, 0, 2, 0, 0, 0, 0, 45], "semantic": {"name": "keyPressEvent", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def keyPressEvent(self, event):\n key = event.key()\n if key == QtCore.Qt.Key_Right:\n print('right')\n if self.current_polygon_index < len(self.polygons) - 1:\n self.delete_empty_polygon()\n self.current_polygon_index += 1\n print(\"czurrent poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L961_C8", "label": "key = key()", "type": "assigned_variable", "loc": [961, 961], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L960_C4", "vector": [14, 2, 0.9348, 0.001, 2, 0.83, 0.0, 230, 3, 0, 0, 0, 230, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "key", "annotation": ""}, "snippet": " key = event.key()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "label": "if", "type": "if", "loc": [962, 1011], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L960_C4", "vector": [4, 2, 0.9596, 0.0486, 2, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 44], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key == QtCore.Qt.Key_Right:\n print('right')\n if self.current_polygon_index < len(self.polygons) - 1:\n self.delete_empty_polygon()\n self.current_polygon_index += 1\n print(\"czurrent poly index: \", self.current_polygon_index)\n else:\n self.start_new_polygon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L963_C12", "label": "print()", "type": "expression", "loc": [963, 963], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "vector": [8, 3, 0.9368, 0.001, 3, 0.37, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('right')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "label": "if", "type": "if", "loc": [964, 970], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "vector": [4, 3, 0.9407, 0.0068, 3, 0.37, 0.25, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_polygon_index < len(self.polygons) - 1:\n self.delete_empty_polygon()\n self.current_polygon_index += 1\n print(\"czurrent poly index: \", self.current_polygon_index)\n else:\n self.start_new_polygon()\n self.parent().slot_update_polygon_labels()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L965_C16", "label": "delete_empty_polygon()", "type": "expression", "loc": [965, 965], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "vector": [8, 4, 0.9387, 0.001, 4, 0.42, 0.0, 796, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete_empty_polygon", "arg_names": [], "import_names": [], "rhs_call_name": "delete_empty_polygon", "annotation": ""}, "snippet": " self.delete_empty_polygon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L967_C16", "label": "print()", "type": "expression", "loc": [967, 967], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "vector": [8, 4, 0.9407, 0.001, 4, 0.42, 0.3333, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"czurrent poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L969_C16", "label": "start_new_polygon()", "type": "expression", "loc": [969, 969], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "vector": [8, 4, 0.9426, 0.001, 4, 0.42, 0.6667, 189, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start_new_polygon", "arg_names": [], "import_names": [], "rhs_call_name": "start_new_polygon", "annotation": ""}, "snippet": " self.start_new_polygon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L970_C16", "label": "slot_update_polygon_labels()", "type": "expression", "loc": [970, 970], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "vector": [8, 4, 0.9436, 0.001, 4, 0.42, 1.0, 63, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "slot_update_polygon_labels", "arg_names": [], "import_names": [], "rhs_call_name": "slot_update_polygon_labels", "annotation": ""}, "snippet": " self.parent().slot_update_polygon_labels()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L971_C12", "label": "update()", "type": "expression", "loc": [971, 971], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "vector": [8, 3, 0.9446, 0.001, 3, 0.37, 0.5, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L972_C12", "label": "emit()", "type": "expression", "loc": [972, 972], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "vector": [8, 3, 0.9455, 0.001, 3, 0.37, 0.75, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "label": "if", "type": "if", "loc": [973, 1011], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "vector": [4, 3, 0.965, 0.0379, 3, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 34], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_Left:\n print('left')\n if self.current_polygon_index > 0:\n if False == self.delete_empty_polygon():\n self.current_polygon_index -= 1\n print(\"current poly index: \", self.current_polygon_index)\n self.update()\n self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L974_C12", "label": "print()", "type": "expression", "loc": [974, 974], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "vector": [8, 4, 0.9475, 0.001, 4, 0.52, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('left')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L975_C12", "label": "if", "type": "if", "loc": [975, 978], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "vector": [4, 4, 0.9499, 0.0039, 4, 0.52, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_polygon_index > 0:\n if False == self.delete_empty_polygon():\n self.current_polygon_index -= 1\n print(\"current poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L976_C16", "label": "if", "type": "if", "loc": [976, 977], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L975_C12", "vector": [4, 5, 0.9499, 0.0019, 5, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False == self.delete_empty_polygon():\n self.current_polygon_index -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L978_C16", "label": "print()", "type": "expression", "loc": [978, 978], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L975_C12", "vector": [8, 5, 0.9514, 0.001, 5, 0.19, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"current poly index: \", self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L979_C12", "label": "update()", "type": "expression", "loc": [979, 979], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "vector": [8, 4, 0.9523, 0.001, 4, 0.52, 0.5, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L980_C12", "label": "emit()", "type": "expression", "loc": [980, 980], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "vector": [8, 4, 0.9533, 0.001, 4, 0.52, 0.75, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyChanged\"), self.polygons, self.current_polygon_index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L981_C8", "label": "if", "type": "if", "loc": [981, 1011], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "vector": [4, 4, 0.9689, 0.0302, 4, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 0, 28], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_O:\n print('o')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'object') \n elif key == QtCore.Qt.Key_S:\n print('s')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'surface') \n elif key == QtCore.Qt.Key_R:\n print('r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L982_C12", "label": "print()", "type": "expression", "loc": [982, 982], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L981_C8", "vector": [8, 5, 0.9553, 0.001, 5, 0.93, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('o')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L983_C12", "label": "emit()", "type": "expression", "loc": [983, 983], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L981_C8", "vector": [8, 5, 0.9562, 0.001, 5, 0.93, 0.5, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'object') "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L984_C8", "label": "if", "type": "if", "loc": [984, 1011], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L981_C8", "vector": [4, 5, 0.9703, 0.0272, 5, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 25], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_S:\n print('s')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'surface') \n elif key == QtCore.Qt.Key_R:\n print('r')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'roi') \n elif key == QtCore.Qt.Key_B:\n print('b')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L985_C12", "label": "print()", "type": "expression", "loc": [985, 985], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L984_C8", "vector": [8, 6, 0.9582, 0.001, 6, 0.34, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L986_C12", "label": "emit()", "type": "expression", "loc": [986, 986], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L984_C8", "vector": [8, 6, 0.9591, 0.001, 6, 0.34, 0.5, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'surface') "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L987_C8", "label": "if", "type": "if", "loc": [987, 1011], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L984_C8", "vector": [4, 6, 0.9718, 0.0243, 6, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 22], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_R:\n print('r')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'roi') \n elif key == QtCore.Qt.Key_B:\n print('b')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'background') \n elif key == QtCore.Qt.Key_E:\n print('e')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L988_C12", "label": "print()", "type": "expression", "loc": [988, 988], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L987_C8", "vector": [8, 7, 0.9611, 0.001, 7, 0.91, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L989_C12", "label": "emit()", "type": "expression", "loc": [989, 989], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L987_C8", "vector": [8, 7, 0.9621, 0.001, 7, 0.91, 0.5, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'roi') "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L990_C8", "label": "if", "type": "if", "loc": [990, 1011], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L987_C8", "vector": [4, 7, 0.9732, 0.0214, 7, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 19], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_B:\n print('b')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'background') \n elif key == QtCore.Qt.Key_E:\n print('e')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge') \n elif key == QtCore.Qt.Key_U:\n print('u')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L991_C12", "label": "print()", "type": "expression", "loc": [991, 991], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L990_C8", "vector": [8, 8, 0.964, 0.001, 8, 0.24, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('b')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L992_C12", "label": "emit()", "type": "expression", "loc": [992, 992], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L990_C8", "vector": [8, 8, 0.965, 0.001, 8, 0.24, 0.5, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'background') "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L993_C8", "label": "if", "type": "if", "loc": [993, 1011], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L990_C8", "vector": [4, 8, 0.9747, 0.0185, 8, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_E:\n print('e')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge') \n elif key == QtCore.Qt.Key_U:\n print('u')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge_up') \n elif key == QtCore.Qt.Key_D:\n print('d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L994_C12", "label": "print()", "type": "expression", "loc": [994, 994], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L993_C8", "vector": [8, 9, 0.9669, 0.001, 9, 0.9, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('e')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L995_C12", "label": "emit()", "type": "expression", "loc": [995, 995], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L993_C8", "vector": [8, 9, 0.9679, 0.001, 9, 0.9, 0.5, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge') "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L996_C8", "label": "if", "type": "if", "loc": [996, 1011], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L993_C8", "vector": [4, 9, 0.9762, 0.0156, 9, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_U:\n print('u')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge_up') \n elif key == QtCore.Qt.Key_D:\n print('d')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge_down') \n elif key == QtCore.Qt.Key_Plus:\n print('+')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L997_C12", "label": "print()", "type": "expression", "loc": [997, 997], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L996_C8", "vector": [8, 10, 0.9698, 0.001, 10, 0.49, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('u')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L998_C12", "label": "emit()", "type": "expression", "loc": [998, 998], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L996_C8", "vector": [8, 10, 0.9708, 0.001, 10, 0.49, 0.5, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge_up') "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L999_C8", "label": "if", "type": "if", "loc": [999, 1011], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L996_C8", "vector": [4, 10, 0.9776, 0.0126, 10, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_D:\n print('d')\n self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge_down') \n elif key == QtCore.Qt.Key_Plus:\n print('+')\n self.setScaleFactor(self.scaleFactor * 1.25)\n self.update() \n elif key == QtCore.Qt.Key_Minus:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1000_C12", "label": "print()", "type": "expression", "loc": [1000, 1000], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L999_C8", "vector": [8, 11, 0.9728, 0.001, 11, 0.26, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1001_C12", "label": "emit()", "type": "expression", "loc": [1001, 1001], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L999_C8", "vector": [8, 11, 0.9737, 0.001, 11, 0.26, 0.5, 627, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": [], "import_names": [], "rhs_call_name": "emit", "annotation": ""}, "snippet": " self.emit(QtCore.SIGNAL(\"sigPolyLabelChanged\"), self.current_polygon_index, 'edge_down') "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "label": "if", "type": "if", "loc": [1002, 1011], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L999_C8", "vector": [4, 11, 0.9791, 0.0097, 11, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_Plus:\n print('+')\n self.setScaleFactor(self.scaleFactor * 1.25)\n self.update() \n elif key == QtCore.Qt.Key_Minus:\n print('-')\n self.setScaleFactor(self.scaleFactor * 0.8)\n self.update() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1003_C12", "label": "print()", "type": "expression", "loc": [1003, 1003], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "vector": [8, 12, 0.9757, 0.001, 12, 0.98, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('+')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1004_C12", "label": "setScaleFactor()", "type": "expression", "loc": [1004, 1004], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "vector": [8, 12, 0.9767, 0.001, 12, 0.98, 0.3333, 230, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setScaleFactor", "arg_names": [], "import_names": [], "rhs_call_name": "setScaleFactor", "annotation": ""}, "snippet": " self.setScaleFactor(self.scaleFactor * 1.25)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1005_C12", "label": "update()", "type": "expression", "loc": [1005, 1005], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "vector": [8, 12, 0.9776, 0.001, 12, 0.98, 0.6667, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "label": "if", "type": "if", "loc": [1006, 1011], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "vector": [4, 12, 0.981, 0.0058, 12, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key == QtCore.Qt.Key_Minus:\n print('-')\n self.setScaleFactor(self.scaleFactor * 0.8)\n self.update() \n else:\n QtGui.QWidget.keyPressEvent(self, event)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1007_C12", "label": "print()", "type": "expression", "loc": [1007, 1007], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "vector": [8, 13, 0.9796, 0.001, 13, 0.6, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1008_C12", "label": "setScaleFactor()", "type": "expression", "loc": [1008, 1008], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "vector": [8, 13, 0.9805, 0.001, 13, 0.6, 0.3333, 230, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setScaleFactor", "arg_names": [], "import_names": [], "rhs_call_name": "setScaleFactor", "annotation": ""}, "snippet": " self.setScaleFactor(self.scaleFactor * 0.8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1009_C12", "label": "update()", "type": "expression", "loc": [1009, 1009], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "vector": [8, 13, 0.9815, 0.001, 13, 0.6, 0.6667, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1011_C12", "label": "keyPressEvent()", "type": "expression", "loc": [1011, 1011], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "vector": [8, 13, 0.9835, 0.001, 13, 0.6, 1.0, 207, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "keyPressEvent", "arg_names": [], "import_names": [], "rhs_call_name": "keyPressEvent", "annotation": ""}, "snippet": " QtGui.QWidget.keyPressEvent(self, event)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L1013_C4", "label": "get_polygons", "type": "function", "loc": [1013, 1014], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.9859, 0.0019, 1, 0.11, 0.9231, 392, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_polygons", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_polygons(self):\n return self.polygons"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L1014_C8", "label": "return", "type": "return", "loc": [1014, 1014], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L1013_C4", "vector": [13, 2, 0.9864, 0.001, 2, 0.63, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.polygons"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L1016_C4", "label": "get_current_polygon_index", "type": "function", "loc": [1016, 1017], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "vector": [2, 1, 0.9888, 0.0019, 1, 0.11, 1.0, 330, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_current_polygon_index", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_current_polygon_index(self):\n return self.current_polygon_index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L1017_C8", "label": "return", "type": "return", "loc": [1017, 1017], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L1016_C4", "vector": [13, 2, 0.9893, 0.001, 2, 0.6, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.current_polygon_index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "label": "if", "type": "if", "loc": [1023, 1028], "level": 0, "parent": null, "vector": [4, 0, 0.9976, 0.0058, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n app = QtGui.QApplication(sys.argv)\n labeling_tool = labeling_tool(LOC_DATA_LABELING);#\n\n labeling_tool.show()\n sys.exit(app.exec_())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L1024_C4", "label": "app = QApplication()", "type": "assigned_variable", "loc": [1024, 1024], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "vector": [14, 1, 0.9961, 0.001, 1, 0.83, 0.0, 494, 3, 1, 0, 0, 447, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "QApplication", "annotation": ""}, "snippet": " app = QtGui.QApplication(sys.argv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L1025_C4", "label": "labeling_tool = labeling_tool()", "type": "assigned_variable", "loc": [1025, 1025], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "vector": [14, 1, 0.9971, 0.001, 1, 0.83, 0.3333, 408, 3, 1, 0, 0, 408, 10, 1], "semantic": {"name": "labeling_tool", "arg_names": [], "import_names": [], "rhs_call_name": "labeling_tool", "annotation": ""}, "snippet": " labeling_tool = labeling_tool(LOC_DATA_LABELING);#"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1027_C4", "label": "show()", "type": "expression", "loc": [1027, 1027], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "vector": [8, 1, 0.999, 0.001, 1, 0.83, 0.6667, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " labeling_tool.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1028_C4", "label": "exit()", "type": "expression", "loc": [1028, 1028], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "vector": [8, 1, 1.0, 0.001, 1, 0.83, 1.0, 436, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(app.exec_())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L304_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L310_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L319_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L326_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L326_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L329_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L331_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L332_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L333_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L332_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L335_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L347_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L348_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L352_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:While_L355_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L362_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L366_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L367_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L373_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L374_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L376_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L377_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L378_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L378_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L378_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L380_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L378_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L382_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L386_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L387_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L386_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L388_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L386_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L389_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L390_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L392_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L392_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L392_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L394_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L394_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L395_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L394_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L396_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L394_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L397_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L392_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L398_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L400_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L401_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L402_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L403_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L402_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L404_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L402_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L417_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L419_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L420_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L421_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L418_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L423_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L426_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L428_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L431_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L432_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L431_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L434_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L436_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L437_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L436_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L439_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L441_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L441_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L442_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L441_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L444_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L447_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L449_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L450_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L451_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L453_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L454_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L455_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L457_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L459_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L409_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L461_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L465_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L466_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L466_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L467_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L469_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L470_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L472_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L463_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L474_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L474_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L475_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L474_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L477_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L484_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L486_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L486_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L487_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L488_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L488_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L489_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L491_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L492_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L498_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L500_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:While_L503_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L506_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L506_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L508_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L508_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L509_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L512_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L513_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L514_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L517_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L518_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L519_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L523_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L524_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L528_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L529_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L531_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L531_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L533_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L533_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L534_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L536_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L537_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L538_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L539_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L540_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L544_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L532_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L545_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L548_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L548_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L550_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L550_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L551_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L553_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L554_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L555_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L557_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L558_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L561_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L549_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L562_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L565_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L566_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L567_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L569_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L570_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L571_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L573_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L574_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L568_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L575_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L579_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L579_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L580_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L580_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L581_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L579_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L583_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L579_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L584_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L586_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L587_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L587_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L588_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L590_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L591_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L594_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L594_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L595_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L598_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L599_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L599_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L600_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L603_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L604_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L607_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L609_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L610_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L612_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L613_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L614_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L618_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L618_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L619_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L622_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L624_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L616_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L625_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L629_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L629_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L630_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L633_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L635_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L627_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L636_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L640_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L640_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L641_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L642_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L643_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L644_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L639_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L645_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L648_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L649_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L650_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L651_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L652_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L653_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L655_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L655_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L656_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L656_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L657_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L655_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L658_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L660_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L661_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L661_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L662_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L661_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L663_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L664_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L667_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L668_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L669_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L670_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L671_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L672_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L673_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L674_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L675_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L677_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L678_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L679_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L666_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L680_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L685_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L685_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L686_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L687_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L687_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L688_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L689_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L689_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L690_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L692_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L693_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L683_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L694_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L696_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L696_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L697_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L699_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L699_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L700_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L700_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L701_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L699_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L702_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L699_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L703_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L705_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L705_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L706_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L706_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L707_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L705_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L708_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L705_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L709_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L712_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L712_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L713_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L715_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L716_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L717_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L711_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L719_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L721_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L721_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L722_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L722_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L723_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L721_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L725_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L725_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L726_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L726_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L727_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L726_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L728_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L721_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L730_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L732_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L732_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:While_L734_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:While_L734_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L735_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L732_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L738_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L738_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L739_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L739_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L740_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L739_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L742_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L732_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L743_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L746_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L747_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L749_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L750_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L751_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L752_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L753_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L754_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L756_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L758_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L758_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L759_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L761_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L761_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L763_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L761_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L764_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L769_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L772_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L774_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L776_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L778_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L779_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L782_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L783_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L771_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L785_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L787_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L787_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L788_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L787_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L789_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L792_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L792_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L793_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L792_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L795_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L792_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L796_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L798_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L799_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L800_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L801_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L803_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L804_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L791_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L805_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L809_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L810_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L811_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L808_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L812_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L815_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L816_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L816_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L817_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L816_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L819_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L821_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L822_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L826_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L827_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L828_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L830_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L831_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L832_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L833_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L834_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L835_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L836_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L837_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L841_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L842_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L843_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L843_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L844_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L844_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L845_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L844_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L846_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L846_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L847_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L846_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L848_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L848_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L849_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L848_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L850_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L850_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L851_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L850_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L852_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L852_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L853_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L852_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L854_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L854_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L855_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L854_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L857_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L843_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L859_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L861_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L861_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L862_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L862_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L863_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L861_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L864_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L861_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L865_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L839_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L868_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L868_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L869_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L868_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L871_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L871_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L872_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L829_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L874_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L874_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L875_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L874_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L876_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L874_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L877_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:For_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L878_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L824_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L879_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L882_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L882_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L884_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L884_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L885_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L885_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L888_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L889_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L890_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L886_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L891_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L885_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L892_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L892_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L893_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L893_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L894_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L893_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L895_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L893_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L896_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L885_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L899_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L900_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L901_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L901_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L902_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L901_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L903_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L903_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L904_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L903_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L906_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L903_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L907_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L897_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L910_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L910_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L911_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L910_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L913_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L914_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L915_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L917_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L918_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L919_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L920_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L921_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L922_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L923_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L924_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L927_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L928_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L884_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L933_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L935_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L935_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L936_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L936_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L937_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L937_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L938_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L937_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L939_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L937_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L940_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L942_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L942_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L943_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L943_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L945_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L943_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L946_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L943_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L947_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L949_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L949_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L950_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L950_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L952_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L952_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L954_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L952_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L956_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L952_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L957_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L949_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L958_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L960_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L960_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L961_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L960_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L963_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L965_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L967_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L969_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L964_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L970_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L971_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L972_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L962_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L974_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L975_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L975_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L976_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L975_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L978_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L979_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L980_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L973_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L981_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L981_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L982_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L981_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L983_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L981_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L984_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L984_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L985_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L984_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L986_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L984_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L987_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L987_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L988_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L987_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L989_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L987_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L990_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L990_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L991_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L990_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L992_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L990_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L993_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L993_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L994_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L993_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L995_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L993_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L996_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L996_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L997_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L996_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L998_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L996_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L999_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L999_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1000_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L999_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1001_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L999_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1003_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1004_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1005_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1002_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1007_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1008_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1009_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1006_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1011_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L1013_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L1013_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L1014_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:ClassDef_L766_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L1016_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:FunctionDef_L1016_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Return_L1017_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L1024_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Assign_L1025_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1027_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99488:If_L1023_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99488:Expr_L1028_C4"}] |
#Used for first set of util functions
import os
import numpy as np
import pickle as pk
import time
# ** Do we need this? **
###from hrl_lib.msg import NumpyArray
# ** removed dependancy for laser_camera_segmentation use **
#Used for second set of util functions
from opencv.cv import *
from opencv.highgui import *
import numpy as np
import Image as Image
## Returns a string that can be used as a timestamp (hours and minutes) in logfiles
# @return timestamp-string
def getTime():
return '['+time.strftime("%H:%M:%S", time.localtime())+']'
def standard_rad(t):
if t > 0:
return ((t + np.pi) % (np.pi * 2)) - np.pi
else:
return ((t - np.pi) % (np.pi * -2)) + np.pi
##
# Converts a list of numpy matrices to one large matrix
# @param list_mat the list of little matrices
# @param axis axis to concatenate little matrices
# @return one large numpy matrix
def list_mat_to_mat(list_mat, axis=0):
return np.concatenate(tuple(list_mat), axis=axis)
## returns current time as a string: year|month|date_hours|min|sec.
## @return current time as a string: year|month|date_hours|min|sec.
def formatted_time():
date_name = time.strftime('%Y%h%d_%H%M%S', time.localtime())
# curtime = time.localtime()
# date_name = time.strftime('%Y%m%d_%I%M%S', curtime)
return date_name
## read a pickle and return the object.
# @param filename - name of the pkl
# @return - object that had been pickled.
def load_pickle(filename):
p = open(filename, 'r')
picklelicious = pk.load(p)
p.close()
return picklelicious
## Pickle an object.
# @param object - object to be pickled
# @param filename - name of the pkl file
def save_pickle(object, filename):
pickle_file = open(filename, 'w')
pk.dump(object, pickle_file)
pickle_file.close()
## Calculate L2 norm for column vectors in a matrix
# @param mat - numpy matrix
def norm(mat):
return np.power(np.sum(np.power(mat,2), axis=0), 0.5)
def approx_equal(a, b, epsilon=.001):
return (b < (a+epsilon)) and ((a-epsilon) < b)
def unipolar_limit( x, upper ):
""" limit the value of x such that
0 <= x <= upper
"""
if x > upper:
x=upper
if x < 0:
x=0
return x
def cart_of_pol(p):
""" Finds cartesian coordinates of polar points [r, t]' """
r = p[0,:]
t = p[1,:]
x = numpy.multiply(numpy.cos(t), r)
y = numpy.multiply(numpy.sin(t), r)
return numpy.vstack((x,y))
def pol_of_cart(p):
""" Find polar coordinates of cartesian points [x, y]' """
norm = numpy.linalg.norm(p)
ang = math.atan2(p[1,0], p[0,0])
return numpy.matrix([norm, ang]).T
##
# Bound the value of a number to be above lower, and lower than upper
# @return a number
def bound(value, lower, upper):
if lower >= upper:
t = lower
lower = upper
upper = t
# print 'bound', value, 'lower', lower, 'upper', upper
#return min(max(value, lower), upper)
ret_val = min(max(value, lower), upper)
# if ret_val != value:
# print 'ut.boud bounded something.'
return ret_val
## wraps a numpy array into hrl's datatype for sending np arrays
# over ros.
# @param np array
# @return NumpyArray object (hrl_lib/msg/NumpyArray.msg)
def wrap_np_array(nparr):
shp = nparr.shape
npstr = nparr.tostring()
npdtype = str(nparr.dtype)
nparr_ros = NumpyArray(None,npstr,shp,npdtype)
return nparr_ros
## convert hrl's ros wrapped numpy array to a numpy array
# @param NumpyArray object (hrl_lib/msg/NumpyArray.msg)
# @return np array
def unwrap_np_array(nparr_ros):
npstr,shp,npdtype = nparr_ros.data,nparr_ros.shape,nparr_ros.dtype
nparr = np.fromstring(npstr,dtype=npdtype)
nparr = nparr.reshape(shp)
return nparr
## cartesian product of list of lists.
# code copied from: http://automatthias.wordpress.com/2007/04/28/cartesian-product-of-multiple-sets/
# @return generator. can loop over it, or list(generator) will give
# the entire list.
# NOTE - itertools in python 2.6 provides this functionality. We
# should switch over to it soon.
def cartesian_product(lists, previous_elements = []):
if len(lists) == 1:
for elem in lists[0]:
yield previous_elements + [elem, ]
else:
for elem in lists[0]:
for x in cartesian_product(lists[1:], previous_elements + [elem, ]):
yield x
## choose n elements from list without replacement.
# adapted code from cartesian_product
# @return generator.
def choose_without_replacement(list, n):
lists = [list for i in range(n)]
return _choose_without_replacement(lists)
def _choose_without_replacement(lists,previous_elements=[],ignore_count=0):
if len(lists) == 1:
for elem in lists[0][ignore_count:]:
yield previous_elements + [elem, ]
else:
for i,elem in enumerate(lists[0][ignore_count:]):
for x in _choose_without_replacement(lists[1:],previous_elements + [elem, ],ignore_count+i+1):
yield x
##
# use festival text to speech to make a soud.
# @param text - string to be said.
def say(text):
os.system( 'echo "' + text + '" | festival --tts' )
## compute rank of a matrix.
# code copied from:
# http://mail.scipy.org/pipermail/numpy-discussion/2008-February/031218.html
def matrixrank(A,tol=1e-8):
s = np.linalg.svd(A,compute_uv=0)
return sum( np.where( s>tol, 1, 0 ) )
##################################################
#!usr/bin/python
#
#util_additional.py
#
#The following definitions are utility and conversion definitions that used
# to be part of the gt-ros-pkg scripts in hrl_lib/util.py
#Since they have been taken out sometime during summer 2010, they are added
# as explicit dependancies to the laser_camera_segmentation project.
cv2np_type_dict = {CV_16S : (np.int16, 1),
CV_16SC1 : (np.int16, 1),
CV_16SC2 : (np.int16, 2),
CV_16SC3 : (np.int16, 3),
CV_16SC4 : (np.int16, 4),
CV_16U : (np.uint16, 1),
CV_16UC1 : (np.uint16, 1),
CV_16UC2 : (np.uint16, 2),
CV_16UC3 : (np.uint16, 3),
CV_16UC4 : (np.uint16, 4),
CV_32F : (np.float32, 1),
CV_32FC1 : (np.float32, 1),
CV_32FC2 : (np.float32, 2),
CV_32FC3 : (np.float32, 3),
CV_32FC4 : (np.float32, 4),
CV_32S : (np.int32, 1),
CV_32SC1 : (np.int32, 1),
CV_32SC2 : (np.int32, 2),
CV_32SC3 : (np.int32, 3),
CV_32SC4 : (np.int32, 4),
CV_64F : (np.float64, 1),
CV_64FC1 : (np.float64, 1),
CV_64FC2 : (np.float64, 2),
CV_64FC3 : (np.float64, 3),
CV_64FC4 : (np.float64, 4),
CV_8S : (np.int8, 1),
CV_8SC1 : (np.int8, 1),
CV_8SC2 : (np.int8, 2),
CV_8SC3 : (np.int8, 3),
CV_8SC4 : (np.int8, 4),
CV_8U : (np.uint8, 1),
CV_8UC1 : (np.uint8, 1),
CV_8UC2 : (np.uint8, 2),
CV_8UC3 : (np.uint8, 3),
CV_8UC4 : (np.uint8, 4)}
cv2np_type_dict_invertible = {CV_16SC1 : (np.int16, 1),
CV_16SC2 : (np.int16, 2),
CV_16SC3 : (np.int16, 3),
CV_16SC4 : (np.int16, 4),
CV_16UC1 : (np.uint16, 1),
CV_16UC2 : (np.uint16, 2),
CV_16UC3 : (np.uint16, 3),
CV_16UC4 : (np.uint16, 4),
CV_32FC1 : (np.float32, 1),
CV_32FC2 : (np.float32, 2),
CV_32FC3 : (np.float32, 3),
CV_32FC4 : (np.float32, 4),
CV_32SC1 : (np.int32, 1),
CV_32SC2 : (np.int32, 2),
CV_32SC3 : (np.int32, 3),
CV_32SC4 : (np.int32, 4),
CV_64FC1 : (np.float64, 1),
CV_64FC2 : (np.float64, 2),
CV_64FC3 : (np.float64, 3),
CV_64FC4 : (np.float64, 4),
CV_8SC1 : (np.int8, 1),
CV_8SC2 : (np.int8, 2),
CV_8SC3 : (np.int8, 3),
CV_8SC4 : (np.int8, 4),
CV_8UC1 : (np.uint8, 1),
CV_8UC2 : (np.uint8, 2),
CV_8UC3 : (np.uint8, 3),
CV_8UC4 : (np.uint8, 4)}
#def cv2np(im):
# numpy_type, nchannels = cv2np_type_dict[cv.cvGetElemType(im)]
# array_size = [im.height, im.width, nchannels]
# np_im = np.frombuffer(im.imageData, dtype=numpy_type)
# return np.reshape(np_im, array_size)
def cv2np(im, format='RGB'):
"""This function converts an image from openCV format to a numpy array.
This utility needs both NUMPY and OPENCV to accomplish the conversion.
cv2np(im, format='RGB')
"""
if format == 'BGR':
cvCvtColor( im, im, CV_BGR2RGB )
numpy_type, nchannels = cv2np_type_dict[cvGetElemType(im)]
array_size = [im.height, im.width, nchannels]
#Removed multiplication of size by (im.depth/8) as numpy takes
#into account of that in numpy_type
if im.__doc__ == None:
# ctypes-opencv
return im.as_numpy_array()
else:
np_im = np.array( np.frombuffer(im.imageData, dtype=numpy_type,
count=im.height*im.width*nchannels))
return np.reshape(np_im, array_size)
def np2pil( im ):
""" for grayscale - all values must be between 0 and 255.
not sure about color yet.
np2pil(im)
"""
#TODO: print 'util.np2cv: works for texseg.py'
#TODO: print 'util.np2cv: more extensive tests would be useful'
if len(im.shape) == 3:
shp = im.shape
channels = shp[2]
height, width = shp[0], shp[1]
elif len(im.shape) == 2:
height, width = im.shape
channels = 1
else:
raise AssertionError("unrecognized shape for the input image. should be 3 or 2, but was %d." % len(im.shape))
if channels == 3:
image = Image.fromstring( "RGB", (width, height), im.tostring() )
if channels == 1:
im = np.array(im, dtype=np.uint8)
#image = Image.fromarray(im)
image = Image.fromstring( "L", (width, height), im.tostring() )
return image
if True:
np2cv_type_dict = dict([(str(np.dtype(v[0])), v[1]), k] for
k,v in cv2np_type_dict_invertible.items())
def np2cv(im, force_color=False):
''' Note: force_color -- force grayscale np image into a color cv image
np2cv(im, force_color=False)
'''
image = np2pil( im )
image.save('test.bmp', 'BMP')
if len(im.shape) == 3:
cvim = cvLoadImage('test.bmp')
elif len(im.shape) == 2:
if force_color == False:
cvim = cvLoadImage('test.bmp', CV_LOAD_IMAGE_GRAYSCALE)
else:
cvim = cvLoadImage('test.bmp')
else:
raise AssertionError("unrecognized shape for the input image. should be 3 or 2, but was %d." % len(im.shape))
return cvim
| ajibawa-2023/Python-Code-Large/train/row_99490 | 131 | 338 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0089, 0.003, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0118, 0.003, 0, 0.66, 0.0323, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Import_L5_C0", "label": "pickle import pk", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0148, 0.003, 0, 0.66, 0.0645, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pk"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pickle as pk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Import_L6_C0", "label": "time import time", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0178, 0.003, 0, 0.66, 0.0968, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:ImportFrom_L12_C0", "label": "from opencv.cv import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0355, 0.003, 0, 0.66, 0.129, 718, 0, 1, 0, 0, 718, 0, 0], "semantic": {"name": "opencv.cv", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from opencv.cv import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:ImportFrom_L13_C0", "label": "from opencv.highgui import *", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.003, 0, 0.66, 0.1613, 453, 0, 1, 0, 0, 453, 0, 0], "semantic": {"name": "opencv.highgui", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from opencv.highgui import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Import_L14_C0", "label": "numpy import np", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0414, 0.003, 0, 0.66, 0.1935, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Import_L15_C0", "label": "Image import Image", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0444, 0.003, 0, 0.66, 0.2258, 721, 0, 1, 0, 0, 721, 0, 0], "semantic": {"name": "Image", "arg_names": [], "import_names": ["Image"], "rhs_call_name": "", "annotation": ""}, "snippet": "import Image as Image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L20_C0", "label": "getTime", "type": "function", "loc": [20, 21], "level": 0, "parent": null, "vector": [2, 0, 0.0607, 0.0059, 0, 0.66, 0.2581, 732, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "getTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getTime():\n return '['+time.strftime(\"%H:%M:%S\", time.localtime())+']'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L21_C4", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L20_C0", "vector": [13, 1, 0.0621, 0.003, 1, 0.09, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '['+time.strftime(\"%H:%M:%S\", time.localtime())+']'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L23_C0", "label": "standard_rad", "type": "function", "loc": [23, 27], "level": 0, "parent": null, "vector": [2, 0, 0.074, 0.0148, 0, 0.66, 0.2903, 54, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "standard_rad", "arg_names": ["t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def standard_rad(t):\n if t > 0:\n return ((t + np.pi) % (np.pi * 2)) - np.pi\n else:\n return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L24_C4", "label": "if", "type": "if", "loc": [24, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L23_C0", "vector": [4, 1, 0.0754, 0.0118, 1, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t > 0:\n return ((t + np.pi) % (np.pi * 2)) - np.pi\n else:\n return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L25_C8", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L24_C4", "vector": [13, 2, 0.074, 0.003, 2, 0.19, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t + np.pi) % (np.pi * 2)) - np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L24_C4", "vector": [13, 2, 0.0799, 0.003, 2, 0.19, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((t - np.pi) % (np.pi * -2)) + np.pi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L34_C0", "label": "list_mat_to_mat", "type": "function", "loc": [34, 35], "level": 0, "parent": null, "vector": [2, 0, 0.1021, 0.0059, 0, 0.66, 0.3226, 162, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "list_mat_to_mat", "arg_names": ["list_mat", "axis"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def list_mat_to_mat(list_mat, axis=0):\n return np.concatenate(tuple(list_mat), axis=axis)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L34_C0", "vector": [13, 1, 0.1036, 0.003, 1, 0.39, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.concatenate(tuple(list_mat), axis=axis)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L40_C0", "label": "formatted_time", "type": "function", "loc": [40, 44], "level": 0, "parent": null, "vector": [2, 0, 0.1243, 0.0148, 0, 0.66, 0.3548, 353, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "formatted_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def formatted_time():\n date_name = time.strftime('%Y%h%d_%H%M%S', time.localtime())\n# curtime = time.localtime()\n# date_name = time.strftime('%Y%m%d_%I%M%S', curtime)\n return date_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L41_C4", "label": "date_name = strftime()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L40_C0", "vector": [14, 1, 0.1213, 0.003, 1, 0.85, 0.0, 532, 3, 2, 0, 0, 668, 10, 2], "semantic": {"name": "date_name", "arg_names": [], "import_names": [], "rhs_call_name": "strftime", "annotation": ""}, "snippet": " date_name = time.strftime('%Y%h%d_%H%M%S', time.localtime())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L44_C4", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L40_C0", "vector": [13, 1, 0.1302, 0.003, 1, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return date_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "label": "load_pickle", "type": "function", "loc": [49, 53], "level": 0, "parent": null, "vector": [2, 0, 0.1509, 0.0148, 0, 0.66, 0.3871, 65, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "load_pickle", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load_pickle(filename):\n p = open(filename, 'r')\n picklelicious = pk.load(p)\n p.close()\n return picklelicious"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L50_C4", "label": "p = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "vector": [14, 1, 0.1479, 0.003, 1, 0.88, 0.0, 491, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " p = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L51_C4", "label": "picklelicious = load()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "vector": [14, 1, 0.1509, 0.003, 1, 0.88, 0.3333, 536, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "picklelicious", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " picklelicious = pk.load(p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L52_C4", "label": "close()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "vector": [8, 1, 0.1538, 0.003, 1, 0.88, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " p.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L53_C4", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "vector": [13, 1, 0.1568, 0.003, 1, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return picklelicious"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L58_C0", "label": "save_pickle", "type": "function", "loc": [58, 61], "level": 0, "parent": null, "vector": [2, 0, 0.176, 0.0118, 0, 0.66, 0.4194, 390, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "save_pickle", "arg_names": ["object", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def save_pickle(object, filename):\n pickle_file = open(filename, 'w')\n pk.dump(object, pickle_file)\n pickle_file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L59_C4", "label": "pickle_file = open()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L58_C0", "vector": [14, 1, 0.1746, 0.003, 1, 0.41, 0.0, 757, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "pickle_file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " pickle_file = open(filename, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L60_C4", "label": "dump()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L58_C0", "vector": [8, 1, 0.1775, 0.003, 1, 0.41, 0.5, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pk.dump(object, pickle_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L61_C4", "label": "close()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L58_C0", "vector": [8, 1, 0.1805, 0.003, 1, 0.41, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " pickle_file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L65_C0", "label": "norm", "type": "function", "loc": [65, 66], "level": 0, "parent": null, "vector": [2, 0, 0.1938, 0.0059, 0, 0.66, 0.4516, 902, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "norm", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def norm(mat):\n return np.power(np.sum(np.power(mat,2), axis=0), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L66_C4", "label": "return", "type": "return", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L65_C0", "vector": [13, 1, 0.1953, 0.003, 1, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.power(np.sum(np.power(mat,2), axis=0), 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L69_C0", "label": "approx_equal", "type": "function", "loc": [69, 70], "level": 0, "parent": null, "vector": [2, 0, 0.2056, 0.0059, 0, 0.66, 0.4839, 662, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "approx_equal", "arg_names": ["a", "b", "epsilon"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def approx_equal(a, b, epsilon=.001):\n return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L69_C0", "vector": [13, 1, 0.2071, 0.003, 1, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (b < (a+epsilon)) and ((a-epsilon) < b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "label": "unipolar_limit", "type": "function", "loc": [73, 83], "level": 0, "parent": null, "vector": [2, 0, 0.2308, 0.0325, 0, 0.66, 0.5161, 78, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "unipolar_limit", "arg_names": ["x", "upper"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def unipolar_limit( x, upper ):\n \"\"\" limit the value of x such that\n 0 <= x <= upper\n \"\"\"\n\n if x > upper:\n x=upper\n if x < 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L74_C4", "label": "expression", "type": "expression", "loc": [74, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "vector": [8, 1, 0.2219, 0.0089, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" limit the value of x such that\n 0 <= x <= upper\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L78_C4", "label": "if", "type": "if", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "vector": [4, 1, 0.2322, 0.0059, 1, 0.57, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x > upper:\n x=upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L79_C8", "label": "x =", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L78_C4", "vector": [14, 2, 0.2337, 0.003, 2, 0.46, 0.0, 190, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x=upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L80_C4", "label": "if", "type": "if", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "vector": [4, 1, 0.2382, 0.0059, 1, 0.57, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x < 0:\n x=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L81_C8", "label": "x =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L80_C4", "vector": [14, 2, 0.2396, 0.003, 2, 0.67, 0.0, 190, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L83_C4", "label": "return", "type": "return", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "vector": [13, 1, 0.2456, 0.003, 1, 0.57, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "label": "cart_of_pol", "type": "function", "loc": [85, 91], "level": 0, "parent": null, "vector": [2, 0, 0.2604, 0.0207, 0, 0.66, 0.5484, 212, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "cart_of_pol", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cart_of_pol(p):\n \"\"\" Finds cartesian coordinates of polar points [r, t]' \"\"\"\n r = p[0,:]\n t = p[1,:]\n x = numpy.multiply(numpy.cos(t), r)\n y = numpy.multiply(numpy.sin(t), r)\n return numpy.vstack((x,y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L86_C3", "label": "expression", "type": "expression", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "vector": [8, 1, 0.2544, 0.003, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Finds cartesian coordinates of polar points [r, t]' \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L87_C3", "label": "r =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "vector": [14, 1, 0.2574, 0.003, 1, 0.57, 0.2, 436, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = p[0,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L88_C3", "label": "t =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "vector": [14, 1, 0.2604, 0.003, 1, 0.57, 0.4, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = p[1,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L89_C3", "label": "x = multiply()", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "vector": [14, 1, 0.2633, 0.003, 1, 0.57, 0.6, 190, 3, 2, 0, 0, 960, 10, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " x = numpy.multiply(numpy.cos(t), r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L90_C3", "label": "y = multiply()", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "vector": [14, 1, 0.2663, 0.003, 1, 0.57, 0.8, 304, 3, 2, 0, 0, 960, 10, 2], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " y = numpy.multiply(numpy.sin(t), r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L91_C3", "label": "return", "type": "return", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "vector": [13, 1, 0.2692, 0.003, 1, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.vstack((x,y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "label": "pol_of_cart", "type": "function", "loc": [93, 97], "level": 0, "parent": null, "vector": [2, 0, 0.2811, 0.0148, 0, 0.66, 0.5806, 754, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "pol_of_cart", "arg_names": ["p"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pol_of_cart(p):\n \"\"\" Find polar coordinates of cartesian points [x, y]' \"\"\"\n norm = numpy.linalg.norm(p)\n ang = math.atan2(p[1,0], p[0,0])\n return numpy.matrix([norm, ang]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L94_C4", "label": "expression", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "vector": [8, 1, 0.2781, 0.003, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Find polar coordinates of cartesian points [x, y]' \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L95_C4", "label": "norm = norm()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "vector": [14, 1, 0.2811, 0.003, 1, 0.39, 0.3333, 902, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "norm", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " norm = numpy.linalg.norm(p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L96_C4", "label": "ang = atan2()", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "vector": [14, 1, 0.284, 0.003, 1, 0.39, 0.6667, 762, 3, 2, 0, 0, 572, 10, 1], "semantic": {"name": "ang", "arg_names": [], "import_names": [], "rhs_call_name": "atan2", "annotation": ""}, "snippet": " ang = math.atan2(p[1,0], p[0,0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L97_C4", "label": "return", "type": "return", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "vector": [13, 1, 0.287, 0.003, 1, 0.39, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return numpy.matrix([norm, ang]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L102_C0", "label": "bound", "type": "function", "loc": [102, 112], "level": 0, "parent": null, "vector": [2, 0, 0.3166, 0.0325, 0, 0.66, 0.6129, 996, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "bound", "arg_names": ["value", "lower", "upper"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bound(value, lower, upper):\n if lower >= upper:\n t = lower\n lower = upper\n upper = t\n# print 'bound', value, 'lower', lower, 'upper', upper\n #return min(max(value, lower), upper)\n ret_val = min(max(value, lower), upper)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L103_C4", "label": "if", "type": "if", "loc": [103, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L102_C0", "vector": [4, 1, 0.3092, 0.0118, 1, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lower >= upper:\n t = lower\n lower = upper\n upper = t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L104_C8", "label": "t =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L103_C4", "vector": [14, 2, 0.3077, 0.003, 2, 0.83, 0.0, 15, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = lower"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L105_C8", "label": "lower =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L103_C4", "vector": [14, 2, 0.3107, 0.003, 2, 0.83, 0.5, 432, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lower = upper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L106_C8", "label": "upper =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L103_C4", "vector": [14, 2, 0.3136, 0.003, 2, 0.83, 1.0, 347, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upper = t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L109_C4", "label": "ret_val = min()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L102_C0", "vector": [14, 1, 0.3225, 0.003, 1, 0.53, 0.5, 876, 3, 2, 0, 0, 867, 10, 2], "semantic": {"name": "ret_val", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " ret_val = min(max(value, lower), upper)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L112_C4", "label": "return", "type": "return", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L102_C0", "vector": [13, 1, 0.3314, 0.003, 1, 0.53, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ret_val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "label": "wrap_np_array", "type": "function", "loc": [120, 125], "level": 0, "parent": null, "vector": [2, 0, 0.3624, 0.0178, 0, 0.66, 0.6452, 696, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "wrap_np_array", "arg_names": ["nparr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wrap_np_array(nparr):\n shp = nparr.shape\n npstr = nparr.tostring()\n npdtype = str(nparr.dtype)\n nparr_ros = NumpyArray(None,npstr,shp,npdtype)\n return nparr_ros"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L121_C4", "label": "shp =", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "vector": [14, 1, 0.358, 0.003, 1, 0.36, 0.0, 185, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "shp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shp = nparr.shape"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L122_C4", "label": "npstr = tostring()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "vector": [14, 1, 0.3609, 0.003, 1, 0.36, 0.25, 619, 3, 0, 0, 0, 347, 10, 1], "semantic": {"name": "npstr", "arg_names": [], "import_names": [], "rhs_call_name": "tostring", "annotation": ""}, "snippet": " npstr = nparr.tostring()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L123_C4", "label": "npdtype = str()", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "vector": [14, 1, 0.3639, 0.003, 1, 0.36, 0.5, 415, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "npdtype", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " npdtype = str(nparr.dtype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L124_C4", "label": "nparr_ros = NumpyArray()", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "vector": [14, 1, 0.3669, 0.003, 1, 0.36, 0.75, 497, 3, 4, 0, 0, 857, 10, 1], "semantic": {"name": "nparr_ros", "arg_names": [], "import_names": [], "rhs_call_name": "NumpyArray", "annotation": ""}, "snippet": " nparr_ros = NumpyArray(None,npstr,shp,npdtype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L125_C4", "label": "return", "type": "return", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "vector": [13, 1, 0.3698, 0.003, 1, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return nparr_ros"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "label": "unwrap_np_array", "type": "function", "loc": [130, 134], "level": 0, "parent": null, "vector": [2, 0, 0.3905, 0.0148, 0, 0.66, 0.6774, 77, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "unwrap_np_array", "arg_names": ["nparr_ros"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def unwrap_np_array(nparr_ros):\n npstr,shp,npdtype = nparr_ros.data,nparr_ros.shape,nparr_ros.dtype\n nparr = np.fromstring(npstr,dtype=npdtype)\n nparr = nparr.reshape(shp)\n return nparr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L131_C4", "label": "npstr, shp, npdtype =", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "vector": [14, 1, 0.3876, 0.003, 1, 0.44, 0.0, 455, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "npstr, shp, npdtype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " npstr,shp,npdtype = nparr_ros.data,nparr_ros.shape,nparr_ros.dtype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L132_C4", "label": "nparr = fromstring()", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "vector": [14, 1, 0.3905, 0.003, 1, 0.44, 0.3333, 313, 3, 2, 0, 0, 551, 10, 1], "semantic": {"name": "nparr", "arg_names": [], "import_names": [], "rhs_call_name": "fromstring", "annotation": ""}, "snippet": " nparr = np.fromstring(npstr,dtype=npdtype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L133_C4", "label": "nparr = reshape()", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "vector": [14, 1, 0.3935, 0.003, 1, 0.44, 0.6667, 313, 3, 1, 0, 0, 276, 10, 1], "semantic": {"name": "nparr", "arg_names": [], "import_names": [], "rhs_call_name": "reshape", "annotation": ""}, "snippet": " nparr = nparr.reshape(shp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L134_C4", "label": "return", "type": "return", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "vector": [13, 1, 0.3964, 0.003, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return nparr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L143_C0", "label": "cartesian_product", "type": "function", "loc": [143, 150], "level": 0, "parent": null, "vector": [2, 0, 0.4334, 0.0237, 0, 0.66, 0.7097, 267, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "cartesian_product", "arg_names": ["lists", "previous_elements"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cartesian_product(lists, previous_elements = []):\n if len(lists) == 1:\n for elem in lists[0]:\n yield previous_elements + [elem, ]\n else:\n for elem in lists[0]:\n for x in cartesian_product(lists[1:], previous_elements + [elem, ]):\n yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L144_C4", "label": "if", "type": "if", "loc": [144, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L143_C0", "vector": [4, 1, 0.4349, 0.0207, 1, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(lists) == 1:\n for elem in lists[0]:\n yield previous_elements + [elem, ]\n else:\n for elem in lists[0]:\n for x in cartesian_product(lists[1:], previous_elements + [elem, ]):\n yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L145_C8", "label": "for elem", "type": "for", "loc": [145, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L144_C4", "vector": [6, 2, 0.4305, 0.0059, 2, 0.86, 0.0, 63, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for elem in lists[0]:\n yield previous_elements + [elem, ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L146_C12", "label": "expression", "type": "expression", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L145_C8", "vector": [8, 3, 0.432, 0.003, 3, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield previous_elements + [elem, ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L148_C8", "label": "for elem", "type": "for", "loc": [148, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L144_C4", "vector": [6, 2, 0.4408, 0.0089, 2, 0.86, 1.0, 63, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for elem in lists[0]:\n for x in cartesian_product(lists[1:], previous_elements + [elem, ]):\n yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L149_C12", "label": "for x", "type": "for", "loc": [149, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L148_C8", "vector": [6, 3, 0.4423, 0.0059, 3, 0.57, 0.0, 190, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in cartesian_product(lists[1:], previous_elements + [elem, ]):\n yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L150_C16", "label": "expression", "type": "expression", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L149_C12", "vector": [8, 4, 0.4438, 0.003, 4, 0.92, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L155_C0", "label": "choose_without_replacement", "type": "function", "loc": [155, 157], "level": 0, "parent": null, "vector": [2, 0, 0.4615, 0.0089, 0, 0.66, 0.7419, 804, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "choose_without_replacement", "arg_names": ["list", "n"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def choose_without_replacement(list, n):\n lists = [list for i in range(n)]\n return _choose_without_replacement(lists)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L156_C4", "label": "lists =", "type": "assigned_variable", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L155_C0", "vector": [14, 1, 0.4615, 0.003, 1, 0.26, 0.0, 194, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "lists", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lists = [list for i in range(n)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L157_C4", "label": "return", "type": "return", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L155_C0", "vector": [13, 1, 0.4645, 0.003, 1, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _choose_without_replacement(lists)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L159_C0", "label": "_choose_without_replacement", "type": "function", "loc": [159, 166], "level": 0, "parent": null, "vector": [2, 0, 0.4808, 0.0237, 0, 0.66, 0.7742, 694, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "_choose_without_replacement", "arg_names": ["lists", "previous_elements", "ignore_count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _choose_without_replacement(lists,previous_elements=[],ignore_count=0):\n if len(lists) == 1:\n for elem in lists[0][ignore_count:]:\n yield previous_elements + [elem, ]\n else:\n for i,elem in enumerate(lists[0][ignore_count:]):\n for x in _choose_without_replacement(lists[1:],previous_elements + [elem, ],ignore_count+i+1):\n yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L160_C4", "label": "if", "type": "if", "loc": [160, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L159_C0", "vector": [4, 1, 0.4822, 0.0207, 1, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(lists) == 1:\n for elem in lists[0][ignore_count:]:\n yield previous_elements + [elem, ]\n else:\n for i,elem in enumerate(lists[0][ignore_count:]):\n for x in _choose_without_replacement(lists[1:],previous_elements + [elem, ],ignore_count+i+1):\n yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L161_C8", "label": "for elem", "type": "for", "loc": [161, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L160_C4", "vector": [6, 2, 0.4778, 0.0059, 2, 0.0, 0.0, 63, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for elem in lists[0][ignore_count:]:\n yield previous_elements + [elem, ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L162_C12", "label": "expression", "type": "expression", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L161_C8", "vector": [8, 3, 0.4793, 0.003, 3, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield previous_elements + [elem, ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L164_C8", "label": "for i, elem", "type": "for", "loc": [164, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L160_C4", "vector": [6, 2, 0.4882, 0.0089, 2, 0.0, 1.0, 751, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i, elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i,elem in enumerate(lists[0][ignore_count:]):\n for x in _choose_without_replacement(lists[1:],previous_elements + [elem, ],ignore_count+i+1):\n yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L165_C12", "label": "for x", "type": "for", "loc": [165, 166], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L164_C8", "vector": [6, 3, 0.4896, 0.0059, 3, 0.54, 0.0, 190, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in _choose_without_replacement(lists[1:],previous_elements + [elem, ],ignore_count+i+1):\n yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L166_C16", "label": "expression", "type": "expression", "loc": [166, 166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L165_C12", "vector": [8, 4, 0.4911, 0.003, 4, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L171_C0", "label": "say", "type": "function", "loc": [171, 172], "level": 0, "parent": null, "vector": [2, 0, 0.5074, 0.0059, 0, 0.66, 0.8065, 890, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "say", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def say(text):\n os.system( 'echo \"' + text + '\" | festival --tts' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L172_C4", "label": "system()", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L171_C0", "vector": [8, 1, 0.5089, 0.003, 1, 0.26, 0.0, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system( 'echo \"' + text + '\" | festival --tts' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L178_C0", "label": "matrixrank", "type": "function", "loc": [178, 180], "level": 0, "parent": null, "vector": [2, 0, 0.5296, 0.0089, 0, 0.66, 0.8387, 135, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "matrixrank", "arg_names": ["A", "tol"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def matrixrank(A,tol=1e-8):\n s = np.linalg.svd(A,compute_uv=0)\n return sum( np.where( s>tol, 1, 0 ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L179_C4", "label": "s = svd()", "type": "assigned_variable", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L178_C0", "vector": [14, 1, 0.5296, 0.003, 1, 0.54, 0.0, 553, 3, 2, 0, 0, 388, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "svd", "annotation": ""}, "snippet": " s = np.linalg.svd(A,compute_uv=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L180_C4", "label": "return", "type": "return", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L178_C0", "vector": [13, 1, 0.5325, 0.003, 1, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sum( np.where( s>tol, 1, 0 ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L193_C0", "label": "cv2np_type_dict =", "type": "assigned_variable", "loc": [193, 227], "level": 0, "parent": null, "vector": [14, 0, 0.6213, 0.1036, 0, 0.66, 0.871, 50, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cv2np_type_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "cv2np_type_dict = {CV_16S : (np.int16, 1), \n CV_16SC1 : (np.int16, 1), \n CV_16SC2 : (np.int16, 2), \n CV_16SC3 : (np.int16, 3), \n CV_16SC4 : (np.int16, 4), \n CV_16U : (np.uint16, 1), \n CV_16UC1 : (np.uint16, 1), \n CV_16UC2 : (np.uint16, 2), "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L230_C0", "label": "cv2np_type_dict_invertible =", "type": "assigned_variable", "loc": [230, 257], "level": 0, "parent": null, "vector": [14, 0, 0.7204, 0.0828, 0, 0.66, 0.9032, 592, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cv2np_type_dict_invertible", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "cv2np_type_dict_invertible = {CV_16SC1 : (np.int16, 1), \n CV_16SC2 : (np.int16, 2), \n CV_16SC3 : (np.int16, 3), \n CV_16SC4 : (np.int16, 4), \n CV_16UC1 : (np.uint16, 1), \n CV_16UC2 : (np.uint16, 2), \n CV_16UC3 : (np.uint16, 3), \n CV_16UC4 : (np.uint16, 4), "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "label": "cv2np", "type": "function", "loc": [266, 285], "level": 0, "parent": null, "vector": [2, 0, 0.8151, 0.0592, 0, 0.66, 0.9355, 366, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "cv2np", "arg_names": ["im", "format"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cv2np(im, format='RGB'):\n \"\"\"This function converts an image from openCV format to a numpy array.\n This utility needs both NUMPY and OPENCV to accomplish the conversion.\n cv2np(im, format='RGB')\n \"\"\"\n if format == 'BGR':\n cvCvtColor( im, im, CV_BGR2RGB )\n numpy_type, nchannels = cv2np_type_dict[cvGetElemType(im)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L267_C4", "label": "expression", "type": "expression", "loc": [267, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "vector": [8, 1, 0.7944, 0.0118, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"This function converts an image from openCV format to a numpy array.\n This utility needs both NUMPY and OPENCV to accomplish the conversion.\n cv2np(im, format='RGB')\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L271_C4", "label": "if", "type": "if", "loc": [271, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "vector": [4, 1, 0.8033, 0.0059, 1, 0.58, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if format == 'BGR':\n cvCvtColor( im, im, CV_BGR2RGB )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L272_C8", "label": "cvCvtColor()", "type": "expression", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L271_C4", "vector": [8, 2, 0.8047, 0.003, 2, 0.09, 0.0, 709, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "cvCvtColor", "arg_names": [], "import_names": [], "rhs_call_name": "cvCvtColor", "annotation": ""}, "snippet": " cvCvtColor( im, im, CV_BGR2RGB )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L273_C4", "label": "numpy_type, nchannels =", "type": "assigned_variable", "loc": [273, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "vector": [14, 1, 0.8077, 0.003, 1, 0.58, 0.4, 539, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "numpy_type, nchannels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " numpy_type, nchannels = cv2np_type_dict[cvGetElemType(im)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L274_C4", "label": "array_size =", "type": "assigned_variable", "loc": [274, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "vector": [14, 1, 0.8107, 0.003, 1, 0.58, 0.6, 14, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "array_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " array_size = [im.height, im.width, nchannels]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L278_C4", "label": "if", "type": "if", "loc": [278, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "vector": [4, 1, 0.8299, 0.0178, 1, 0.58, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if im.__doc__ == None:\n # ctypes-opencv\n return im.as_numpy_array()\n else:\n np_im = np.array( np.frombuffer(im.imageData, dtype=numpy_type, \n count=im.height*im.width*nchannels))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L280_C8", "label": "return", "type": "return", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L278_C4", "vector": [13, 2, 0.8284, 0.003, 2, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return im.as_numpy_array()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L282_C8", "label": "np_im = array()", "type": "assigned_variable", "loc": [282, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L278_C4", "vector": [14, 2, 0.8358, 0.0059, 2, 0.4, 1.0, 599, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "np_im", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " np_im = np.array( np.frombuffer(im.imageData, dtype=numpy_type, \n count=im.height*im.width*nchannels))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L285_C4", "label": "return", "type": "return", "loc": [285, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "vector": [13, 1, 0.8432, 0.003, 1, 0.58, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.reshape(np_im, array_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "label": "np2pil", "type": "function", "loc": [289, 313], "level": 0, "parent": null, "vector": [2, 0, 0.8905, 0.074, 0, 0.66, 0.9677, 575, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "np2pil", "arg_names": ["im"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def np2pil( im ):\n \"\"\" for grayscale - all values must be between 0 and 255.\n not sure about color yet.\n np2pil(im)\n \"\"\"\n #TODO: print 'util.np2cv: works for texseg.py'\n #TODO: print 'util.np2cv: more extensive tests would be useful'\n if len(im.shape) == 3:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L290_C4", "label": "expression", "type": "expression", "loc": [290, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "vector": [8, 1, 0.8624, 0.0118, 1, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" for grayscale - all values must be between 0 and 255.\n not sure about color yet.\n np2pil(im)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "label": "if", "type": "if", "loc": [296, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "vector": [4, 1, 0.8876, 0.0266, 1, 0.68, 0.25, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(im.shape) == 3:\n shp = im.shape\n channels = shp[2]\n height, width = shp[0], shp[1]\n elif len(im.shape) == 2:\n height, width = im.shape\n channels = 1\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L297_C8", "label": "shp =", "type": "assigned_variable", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "vector": [14, 2, 0.8787, 0.003, 2, 0.89, 0.0, 185, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "shp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shp = im.shape"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L298_C8", "label": "channels =", "type": "assigned_variable", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "vector": [14, 2, 0.8817, 0.003, 2, 0.89, 0.3333, 989, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "channels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " channels = shp[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L299_C8", "label": "height, width =", "type": "assigned_variable", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "vector": [14, 2, 0.8846, 0.003, 2, 0.89, 0.6667, 906, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "height, width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " height, width = shp[0], shp[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L300_C4", "label": "if", "type": "if", "loc": [300, 304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "vector": [4, 2, 0.8935, 0.0148, 2, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(im.shape) == 2:\n height, width = im.shape\n channels = 1\n else:\n raise AssertionError(\"unrecognized shape for the input image. should be 3 or 2, but was %d.\" % len(im.shape))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L301_C8", "label": "height, width =", "type": "assigned_variable", "loc": [301, 301], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L300_C4", "vector": [14, 3, 0.8905, 0.003, 3, 0.51, 0.0, 906, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "height, width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " height, width = im.shape"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L302_C8", "label": "channels =", "type": "assigned_variable", "loc": [302, 302], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L300_C4", "vector": [14, 3, 0.8935, 0.003, 3, 0.51, 1.0, 989, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "channels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " channels = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L306_C4", "label": "if", "type": "if", "loc": [306, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "vector": [4, 1, 0.9068, 0.0059, 1, 0.68, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if channels == 3:\n image = Image.fromstring( \"RGB\", (width, height), im.tostring() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L307_C8", "label": "image = fromstring()", "type": "assigned_variable", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L306_C4", "vector": [14, 2, 0.9083, 0.003, 2, 0.81, 0.0, 505, 3, 3, 0, 0, 551, 10, 2], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "fromstring", "annotation": ""}, "snippet": " image = Image.fromstring( \"RGB\", (width, height), im.tostring() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L308_C4", "label": "if", "type": "if", "loc": [308, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "vector": [4, 1, 0.9157, 0.0118, 1, 0.68, 0.75, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if channels == 1:\n im = np.array(im, dtype=np.uint8)\n #image = Image.fromarray(im)\n image = Image.fromstring( \"L\", (width, height), im.tostring() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L309_C8", "label": "im = array()", "type": "assigned_variable", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L308_C4", "vector": [14, 2, 0.9142, 0.003, 2, 0.93, 0.0, 940, 3, 2, 0, 0, 80, 10, 1], "semantic": {"name": "im", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " im = np.array(im, dtype=np.uint8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L311_C8", "label": "image = fromstring()", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L308_C4", "vector": [14, 2, 0.9201, 0.003, 2, 0.93, 1.0, 505, 3, 3, 0, 0, 551, 10, 2], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "fromstring", "annotation": ""}, "snippet": " image = Image.fromstring( \"L\", (width, height), im.tostring() )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L313_C4", "label": "return", "type": "return", "loc": [313, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "vector": [13, 1, 0.926, 0.003, 1, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L316_C0", "label": "if", "type": "if", "loc": [316, 337], "level": 0, "parent": null, "vector": [4, 0, 0.966, 0.0651, 0, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if True:\n np2cv_type_dict = dict([(str(np.dtype(v[0])), v[1]), k] for\n k,v in cv2np_type_dict_invertible.items())\n\n\n def np2cv(im, force_color=False):\n ''' Note: force_color -- force grayscale np image into a color cv image\n np2cv(im, force_color=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L317_C4", "label": "np2cv_type_dict = dict()", "type": "assigned_variable", "loc": [317, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L316_C0", "vector": [14, 1, 0.9393, 0.0059, 1, 0.28, 0.0, 346, 3, 1, 0, 0, 827, 10, 4], "semantic": {"name": "np2cv_type_dict", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " np2cv_type_dict = dict([(str(np.dtype(v[0])), v[1]), k] for\n k,v in cv2np_type_dict_invertible.items())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "label": "np2cv", "type": "function", "loc": [321, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L316_C0", "vector": [2, 1, 0.9734, 0.0503, 1, 0.28, 1.0, 672, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "np2cv", "arg_names": ["im", "force_color"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def np2cv(im, force_color=False):\n ''' Note: force_color -- force grayscale np image into a color cv image\n np2cv(im, force_color=False)\n '''\n image = np2pil( im )\n image.save('test.bmp', 'BMP')\n if len(im.shape) == 3:\n cvim = cvLoadImage('test.bmp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L322_C8", "label": "expression", "type": "expression", "loc": [322, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "vector": [8, 2, 0.9556, 0.0089, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ''' Note: force_color -- force grayscale np image into a color cv image\n np2cv(im, force_color=False)\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L325_C8", "label": "image = np2pil()", "type": "assigned_variable", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "vector": [14, 2, 0.9615, 0.003, 2, 0.28, 0.25, 505, 3, 1, 0, 0, 575, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "np2pil", "annotation": ""}, "snippet": " image = np2pil( im )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L326_C8", "label": "save()", "type": "expression", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "vector": [8, 2, 0.9645, 0.003, 2, 0.28, 0.5, 928, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " image.save('test.bmp', 'BMP')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L327_C8", "label": "if", "type": "if", "loc": [327, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "vector": [4, 2, 0.9793, 0.0266, 2, 0.28, 0.75, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(im.shape) == 3:\n cvim = cvLoadImage('test.bmp')\n elif len(im.shape) == 2:\n if force_color == False:\n cvim = cvLoadImage('test.bmp', CV_LOAD_IMAGE_GRAYSCALE)\n else:\n cvim = cvLoadImage('test.bmp')\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L328_C12", "label": "cvim = cvLoadImage()", "type": "assigned_variable", "loc": [328, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L327_C8", "vector": [14, 3, 0.9704, 0.003, 3, 0.06, 0.0, 758, 3, 1, 0, 0, 45, 10, 1], "semantic": {"name": "cvim", "arg_names": [], "import_names": [], "rhs_call_name": "cvLoadImage", "annotation": ""}, "snippet": " cvim = cvLoadImage('test.bmp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L329_C8", "label": "if", "type": "if", "loc": [329, 335], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L327_C8", "vector": [4, 3, 0.9822, 0.0207, 3, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(im.shape) == 2:\n if force_color == False:\n cvim = cvLoadImage('test.bmp', CV_LOAD_IMAGE_GRAYSCALE)\n else:\n cvim = cvLoadImage('test.bmp')\n else:\n raise AssertionError(\"unrecognized shape for the input image. should be 3 or 2, but was %d.\" % len(im.shape))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L330_C12", "label": "if", "type": "if", "loc": [330, 333], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L329_C8", "vector": [4, 4, 0.9808, 0.0118, 4, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if force_color == False:\n cvim = cvLoadImage('test.bmp', CV_LOAD_IMAGE_GRAYSCALE)\n else:\n cvim = cvLoadImage('test.bmp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L331_C16", "label": "cvim = cvLoadImage()", "type": "assigned_variable", "loc": [331, 331], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L330_C12", "vector": [14, 5, 0.9793, 0.003, 5, 0.12, 0.0, 758, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "cvim", "arg_names": [], "import_names": [], "rhs_call_name": "cvLoadImage", "annotation": ""}, "snippet": " cvim = cvLoadImage('test.bmp', CV_LOAD_IMAGE_GRAYSCALE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L333_C16", "label": "cvim = cvLoadImage()", "type": "assigned_variable", "loc": [333, 333], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L330_C12", "vector": [14, 5, 0.9852, 0.003, 5, 0.12, 1.0, 758, 3, 1, 0, 0, 45, 10, 1], "semantic": {"name": "cvim", "arg_names": [], "import_names": [], "rhs_call_name": "cvLoadImage", "annotation": ""}, "snippet": " cvim = cvLoadImage('test.bmp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L337_C8", "label": "return", "type": "return", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "vector": [13, 2, 0.997, 0.003, 2, 0.28, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cvim"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L86_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L87_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L88_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L89_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L90_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L91_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L102_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L102_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L102_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L149_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L150_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L159_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:For_L165_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L166_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L271_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L278_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L278_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L296_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L289_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Expr_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L329_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L329_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L330_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L330_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L331_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:If_L330_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Assign_L333_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99490:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99490:Return_L337_C8"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import util as ut #Local function. Uses only: getTime
import processor #Used for LABEL_CLUTTER, LABEL_SURFACE, config.path, and feature_type
class classifier(object):
'''
classdocs
'''
processor = None
features = 'all'
def __init__(self, processor, features):
'''
Constructor
'''
self.processor = processor
self.features = features
def train(self):
return None
#abstract
def test(self, feature_data = None):
return None
#dict are the loaded features including the ground truth, labels the algorithm output
def test_results(self, dict, labels):
current_set_size = dict['set_size']
count_correct = 0
count_clutter_correct = 0
count_surface_correct = 0
count_clutter = 0
count_surface = 0
count = 0
for index in dict['point_indices']:
label = labels[index]
if label == dict['labels'][count]:
count_correct += 1
if dict['labels'][count] == processor.LABEL_CLUTTER:
count_clutter += 1
if label == dict['labels'][count]:
count_clutter_correct += 1
if dict['labels'][count] == processor.LABEL_SURFACE:
count_surface += 1
if label == dict['labels'][count]:
count_surface_correct += 1
count += 1
print ut.getTime(), '##########################################'
print ut.getTime(), '####tested on ', self.features, '###########################'
print ut.getTime(), '==================================='
print ut.getTime(), 'percent in total: surface:',(float(count_surface)/float(current_set_size)*100), '%, clutter:',(float(count_clutter)/float(current_set_size)*100),'%'
print ut.getTime(), '#points surface:',count_surface,'clutter:',count_clutter
print ut.getTime(), '#points correct: surface:',count_surface_correct,'clutter:',count_clutter_correct
if count_surface > 0:
percent_surface_correct = float(count_surface_correct)/float(count_surface) * 100
else:
percent_surface_correct = 100
if count_clutter > 0:
percent_clutter_correct = float(count_clutter_correct)/float(count_clutter) * 100
else:
percent_clutter_correct = 100
print ut.getTime(), '#percent correct: surface:',percent_surface_correct,'clutter:',percent_clutter_correct
print ut.getTime(), '==================================='
print ut.getTime(), '##########################################'
testresults = (count_surface, count_clutter,count_surface_correct, count_clutter_correct, percent_surface_correct, percent_clutter_correct)
return testresults
def get_filename(self):
return self.processor.config.path+'/classifier_'+self.features+'_'+self.processor.feature_type+'_k'+str(self.processor.feature_neighborhood)+'_r'+str(self.processor.feature_radius)+'.XML'
def save(self):
return None
def load(self):
return None
| ajibawa-2023/Python-Code-Large/train/row_99492 | 52 | 116 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Import_L30_C0", "label": "util import ut", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.2586, 0.0086, 0, 0.66, 0.0, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util as ut #Local function. Uses only: getTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Import_L31_C0", "label": "processor import processor", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.2672, 0.0086, 0, 0.66, 0.5, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "processor", "arg_names": [], "import_names": ["processor"], "rhs_call_name": "", "annotation": ""}, "snippet": "import processor #Used for LABEL_CLUTTER, LABEL_SURFACE, config.path, and feature_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "label": "classifier", "type": "class", "loc": [34, 114], "level": 0, "parent": null, "vector": [3, 0, 0.6379, 0.6983, 0, 0.66, 1.0, 71, 0, 7, 0, 0, 186, 0, 28], "semantic": {"name": "classifier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class classifier(object):\n '''\n classdocs\n '''\n\n processor = None\n features = 'all'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L35_C4", "label": "expression", "type": "expression", "loc": [35, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [8, 1, 0.3103, 0.0259, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L39_C4", "label": "processor =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [14, 1, 0.3362, 0.0086, 1, 0.08, 0.1111, 177, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "processor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " processor = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L40_C4", "label": "features =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [14, 1, 0.3448, 0.0086, 1, 0.08, 0.2222, 479, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "features", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " features = 'all'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L42_C4", "label": "__init__", "type": "function", "loc": [42, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [2, 1, 0.3836, 0.0517, 1, 0.08, 0.3333, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "processor", "features"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, processor, features):\n '''\n Constructor\n '''\n self.processor = processor\n self.features = features"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L43_C8", "label": "expression", "type": "expression", "loc": [43, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L42_C4", "vector": [8, 2, 0.3793, 0.0259, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L46_C8", "label": "self.processor =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L42_C4", "vector": [14, 2, 0.3966, 0.0086, 2, 0.88, 0.5, 855, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.processor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.processor = processor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L47_C8", "label": "self.features =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L42_C4", "vector": [14, 2, 0.4052, 0.0086, 2, 0.88, 1.0, 164, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.features", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.features = features"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L50_C4", "label": "train", "type": "function", "loc": [50, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [2, 1, 0.4353, 0.0172, 1, 0.08, 0.4444, 371, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "train", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def train(self):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L51_C8", "label": "return", "type": "return", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L50_C4", "vector": [13, 2, 0.4397, 0.0086, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L54_C4", "label": "test", "type": "function", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [2, 1, 0.4698, 0.0172, 1, 0.08, 0.5556, 224, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "test", "arg_names": ["self", "feature_data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test(self, feature_data = None):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L54_C4", "vector": [13, 2, 0.4741, 0.0086, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "label": "test_results", "type": "function", "loc": [58, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [2, 1, 0.6897, 0.3879, 1, 0.08, 0.6667, 372, 0, 3, 1, 0, 0, 0, 26], "semantic": {"name": "test_results", "arg_names": ["self", "dict", "labels"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_results(self, dict, labels):\n current_set_size = dict['set_size']\n count_correct = 0\n count_clutter_correct = 0\n count_surface_correct = 0\n count_clutter = 0\n count_surface = 0\n count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L59_C8", "label": "current_set_size =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [14, 2, 0.5086, 0.0086, 2, 0.76, 0.0, 575, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "current_set_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current_set_size = dict['set_size']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L60_C8", "label": "count_correct =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [14, 2, 0.5172, 0.0086, 2, 0.76, 0.05, 315, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count_correct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count_correct = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L61_C8", "label": "count_clutter_correct =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [14, 2, 0.5259, 0.0086, 2, 0.76, 0.1, 395, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count_clutter_correct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count_clutter_correct = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L62_C8", "label": "count_surface_correct =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [14, 2, 0.5345, 0.0086, 2, 0.76, 0.15, 545, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count_surface_correct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count_surface_correct = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L63_C8", "label": "count_clutter =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [14, 2, 0.5431, 0.0086, 2, 0.76, 0.2, 381, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count_clutter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count_clutter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L64_C8", "label": "count_surface =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [14, 2, 0.5517, 0.0086, 2, 0.76, 0.25, 765, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count_surface", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count_surface = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L65_C8", "label": "count =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [14, 2, 0.5603, 0.0086, 2, 0.76, 0.3, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "label": "for index", "type": "for", "loc": [66, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [6, 2, 0.6336, 0.1379, 2, 0.76, 0.35, 780, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index in dict['point_indices']:\n label = labels[index]\n \n if label == dict['labels'][count]:\n count_correct += 1\n \n if dict['labels'][count] == processor.LABEL_CLUTTER:\n count_clutter += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L67_C12", "label": "label =", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "vector": [14, 3, 0.5776, 0.0086, 3, 0.79, 0.0, 811, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "label", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " label = labels[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L69_C12", "label": "if", "type": "if", "loc": [69, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "vector": [4, 3, 0.5991, 0.0172, 3, 0.79, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if label == dict['labels'][count]:\n count_correct += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L72_C12", "label": "if", "type": "if", "loc": [72, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "vector": [4, 3, 0.6336, 0.0345, 3, 0.79, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dict['labels'][count] == processor.LABEL_CLUTTER:\n count_clutter += 1\n if label == dict['labels'][count]:\n count_clutter_correct += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L74_C16", "label": "if", "type": "if", "loc": [74, 75], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L72_C12", "vector": [4, 4, 0.6422, 0.0172, 4, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if label == dict['labels'][count]:\n count_clutter_correct += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L76_C12", "label": "if", "type": "if", "loc": [76, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "vector": [4, 3, 0.6681, 0.0345, 3, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dict['labels'][count] == processor.LABEL_SURFACE:\n count_surface += 1\n if label == dict['labels'][count]:\n count_surface_correct += 1 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L78_C16", "label": "if", "type": "if", "loc": [78, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L76_C12", "vector": [4, 4, 0.6767, 0.0172, 4, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if label == dict['labels'][count]:\n count_surface_correct += 1 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L83_C8", "label": "print()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.7155, 0.0086, 2, 0.76, 0.4, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), '##########################################')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L84_C8", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.7241, 0.0086, 2, 0.76, 0.45, 535, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), '####tested on ', self.features, '###########################')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L85_C8", "label": "print()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.7328, 0.0086, 2, 0.76, 0.5, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), '===================================')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L86_C8", "label": "print()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.7414, 0.0086, 2, 0.76, 0.55, 535, 3, 6, 0, 0, 0, 0, 6], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'percent in total: surface:',(float(count_surface)/float(current_set_size)*100), '%, clutter:',(float(count_clutter)/float(current_set_size)*100),'%')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L87_C8", "label": "print()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.75, 0.0086, 2, 0.76, 0.6, 535, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), '#points surface:',count_surface,'clutter:',count_clutter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L88_C8", "label": "print()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.7586, 0.0086, 2, 0.76, 0.65, 535, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), '#points correct: surface:',count_surface_correct,'clutter:',count_clutter_correct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L89_C8", "label": "if", "type": "if", "loc": [89, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [4, 2, 0.7802, 0.0345, 2, 0.76, 0.7, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count_surface > 0:\n percent_surface_correct = float(count_surface_correct)/float(count_surface) * 100\n else:\n percent_surface_correct = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L90_C12", "label": "percent_surface_correct =", "type": "assigned_variable", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L89_C8", "vector": [14, 3, 0.7759, 0.0086, 3, 0.12, 0.0, 486, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "percent_surface_correct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " percent_surface_correct = float(count_surface_correct)/float(count_surface) * 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L92_C12", "label": "percent_surface_correct =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L89_C8", "vector": [14, 3, 0.7931, 0.0086, 3, 0.12, 1.0, 486, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "percent_surface_correct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " percent_surface_correct = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L93_C8", "label": "if", "type": "if", "loc": [93, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [4, 2, 0.8147, 0.0345, 2, 0.76, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count_clutter > 0:\n percent_clutter_correct = float(count_clutter_correct)/float(count_clutter) * 100\n else:\n percent_clutter_correct = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L94_C12", "label": "percent_clutter_correct =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L93_C8", "vector": [14, 3, 0.8103, 0.0086, 3, 0.1, 0.0, 363, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "percent_clutter_correct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " percent_clutter_correct = float(count_clutter_correct)/float(count_clutter) * 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L96_C12", "label": "percent_clutter_correct =", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L93_C8", "vector": [14, 3, 0.8276, 0.0086, 3, 0.1, 1.0, 363, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "percent_clutter_correct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " percent_clutter_correct = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L97_C8", "label": "print()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.8362, 0.0086, 2, 0.76, 0.8, 535, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), '#percent correct: surface:',percent_surface_correct,'clutter:',percent_clutter_correct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L98_C8", "label": "print()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.8448, 0.0086, 2, 0.76, 0.85, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), '===================================')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L99_C8", "label": "print()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [8, 2, 0.8534, 0.0086, 2, 0.76, 0.9, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), '##########################################')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L100_C8", "label": "testresults =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [14, 2, 0.8621, 0.0086, 2, 0.76, 0.95, 933, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "testresults", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " testresults = (count_surface, count_clutter,count_surface_correct, count_clutter_correct, percent_surface_correct, percent_clutter_correct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L102_C8", "label": "return", "type": "return", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "vector": [13, 2, 0.8793, 0.0086, 2, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return testresults "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L106_C4", "label": "get_filename", "type": "function", "loc": [106, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [2, 1, 0.9181, 0.0172, 1, 0.08, 0.7778, 676, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_filename", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_filename(self):\n return self.processor.config.path+'/classifier_'+self.features+'_'+self.processor.feature_type+'_k'+str(self.processor.feature_neighborhood)+'_r'+str(self.processor.feature_radius)+'.XML'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L106_C4", "vector": [13, 2, 0.9224, 0.0086, 2, 0.03, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.processor.config.path+'/classifier_'+self.features+'_'+self.processor.feature_type+'_k'+str(self.processor.feature_neighborhood)+'_r'+str(self.processor.feature_radius)+'.XML'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L109_C4", "label": "save", "type": "function", "loc": [109, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [2, 1, 0.944, 0.0172, 1, 0.08, 0.8889, 928, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "save", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L109_C4", "vector": [13, 2, 0.9483, 0.0086, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L113_C4", "label": "load", "type": "function", "loc": [113, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "vector": [2, 1, 0.9784, 0.0172, 1, 0.08, 1.0, 37, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "load", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def load(self):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L114_C8", "label": "return", "type": "return", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L113_C4", "vector": [13, 2, 0.9828, 0.0086, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L74_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L78_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99492:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99492:Return_L114_C8"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Hai Nguyen (Healthcare Robotics Lab, Georgia Tech.)
import util as ut #Usage: cv2np, np2cv
import numpy as np
import opencv as cv
import opencv.highgui as hg
##
# calculates eigen values of covariance matrix accumulating statistics of sobel filter responses in an image block
#
# @param cv_image opencv image to calculate texture over
# @param blocksize size of block to accumulate statistics (in pixels)
# @param filtersize size of sobel filter to use (in pixels)
# @return numpy matrix of size (width, height, 2) where [:,:,0] is the set of first eigen values and [:,:,1] is the second set
def eigen_texture(cv_image, blocksize=8, filtersize=3):
gray_image = cv.cvCreateImage(cv.cvSize(cv_image.width, cv_image.height), cv.IPL_DEPTH_8U, 1)
eig_tex = cv.cvCreateImage(cv.cvSize(cv_image.width*6, cv_image.height), cv.IPL_DEPTH_32F, 1)
cv.cvCvtColor(cv_image, gray_image, cv.CV_BGR2GRAY)
cv.cvCornerEigenValsAndVecs(gray_image, eig_tex, blocksize, filtersize)
eig_tex_np = ut.cv2np(eig_tex)
eig_tex_np = np.reshape(eig_tex_np, [cv_image.height, cv_image.width, 6])
return eig_tex_np[:,:,0:2]
def visualize(eigens):
l1 = eigens[:,:,0]
l2 = eigens[:,:,1]
m1 = np.min(l1)
m2 = np.min(l2)
r1 = np.max(l1) - m1
r2 = np.max(l2) - m2
if r1 == 0:
r1 = 1
if r2 == 0:
r2 = 1
l1cv = ut.np2cv(np.array( (1 - ((l1-m1) / r1)) * 255, dtype='uint8'))
l2cv = ut.np2cv(np.array( (1 - ((l2-m2) / r2)) * 255, dtype='uint8'))
hg.cvNamedWindow('eigen value 1', 1)
hg.cvNamedWindow('eigen value 2', 1)
hg.cvShowImage('eigen value 1', l1cv)
hg.cvShowImage('eigen value 2', l2cv)
while True:
k = hg.cvWaitKey(33)
if k == ' ':
return
if k == 'x':
exit()
if __name__ == '__main__':
#hg.cvNamedWindow('win', 1)
im = hg.cvLoadImage('/home/haidai/svn/robot1/src/projects/08_03_dog_commands/dragonfly_color_calibration/untitled folder/camera_image.png')
#hg.cvShowImage('win', im)
for i in range(40):
s = (i+1) * 2
print s
eig_tex_np = eigen_texture(im, blocksize=s, filtersize=3)
visualize(eig_tex_np)
# pdb.set_trace()
# def texture_features(self, block_size=5, filter_size=3):
# """
# Calculates the texture features associated with the image.
# block_size gives the size of the texture neighborhood to be processed
# filter_size gives the size of the Sobel operator used to find gradient information
# """
# #block_size = cv.cvSize(block_size, block_size)
#
# #convert to grayscale float
# channels = 1
# self.gray_image = cv.cvCreateImage(cv.cvSize(self.im_width, self.im_height),
# cv.IPL_DEPTH_8U, #cv.IPL_DEPTH_16U, #cv.IPL_DEPTH_32F,
# channels)
#
#
# #cv.CV_32FC1, #cv.IPL_DEPTH_32F, #cv.IPL_DEPTH_8U, #cv.IPL_DEPTH_16U,
# channels = 1
# eig_tex = cv.cvCreateImage(cv.cvSize(self.im_width*6, self.im_height),
# cv.IPL_DEPTH_32F,
# channels)
#
#
# cv.cvCvtColor(self.image, self.gray_image, cv.CV_BGR2GRAY);
#
# #cv.cvAdd(const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL );
#
# #hg.cvConvertImage(self.image, self.gray_image)
#
# cv.cvCornerEigenValsAndVecs(self.gray_image, eig_tex,#CvArr* eigenvv,
# block_size, filter_size)
#
# eig_tex = ut.cv2np(eig_tex)
# eig_tex = np.reshape(eig_tex, [self.im_height, self.im_width, 6])
# #print eig_tex.shape ## [480,640,3]
# ## (l1, l2, x1, y1, x2, y2), where
# ## l1, l2 - eigenvalues of M; not sorted
# ## (x1, y1) - eigenvector corresponding to l1
# ## (x2, y2) - eigenvector corresponding to l2
# tex_feat = np.zeros([3, self.im_height * self.im_width], dtype=np.float32)
# tmp = np.reshape(eig_tex, [self.im_height * self.im_width, 6]).T
# s = tmp[0] > tmp[1]
# tex_feat[1:3, s] = tmp[0, s] * tmp[2:4, s]
# tex_feat[0, s] = tmp[1, s]
# tex_feat[1:3, -s] = tmp[1, -s] * tmp[4:6, -s]
# tex_feat[0, -s] = tmp[0, -s]
#
# self.tex_feat = tex_feat.T
# self.tex_image = np.reshape(self.tex_feat, [self.im_height, self.im_width, 3])
| ajibawa-2023/Python-Code-Large/train/row_99493 | 42 | 155 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Import_L30_C0", "label": "util import ut", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.1935, 0.0065, 0, 0.66, 0.0, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util as ut #Usage: cv2np, np2cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Import_L31_C0", "label": "numpy import np", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.0065, 0, 0.66, 0.1667, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Import_L32_C0", "label": "opencv import cv", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.2065, 0.0065, 0, 0.66, 0.3333, 437, 0, 1, 0, 0, 437, 0, 0], "semantic": {"name": "opencv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import opencv as cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Import_L33_C0", "label": "opencv.highgui import hg", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.2129, 0.0065, 0, 0.66, 0.5, 453, 0, 1, 0, 0, 453, 0, 0], "semantic": {"name": "opencv.highgui", "arg_names": [], "import_names": ["hg"], "rhs_call_name": "", "annotation": ""}, "snippet": "import opencv.highgui as hg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "label": "eigen_texture", "type": "function", "loc": [42, 51], "level": 0, "parent": null, "vector": [2, 0, 0.3, 0.0645, 0, 0.66, 0.6667, 5, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "eigen_texture", "arg_names": ["cv_image", "blocksize", "filtersize"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def eigen_texture(cv_image, blocksize=8, filtersize=3):\n gray_image = cv.cvCreateImage(cv.cvSize(cv_image.width, cv_image.height), cv.IPL_DEPTH_8U, 1)\n eig_tex = cv.cvCreateImage(cv.cvSize(cv_image.width*6, cv_image.height), cv.IPL_DEPTH_32F, 1)\n \n cv.cvCvtColor(cv_image, gray_image, cv.CV_BGR2GRAY) \n cv.cvCornerEigenValsAndVecs(gray_image, eig_tex, blocksize, filtersize)\n eig_tex_np = ut.cv2np(eig_tex)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L43_C4", "label": "gray_image = cvCreateImage()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "vector": [14, 1, 0.2774, 0.0065, 1, 0.1, 0.0, 749, 3, 3, 0, 0, 953, 10, 2], "semantic": {"name": "gray_image", "arg_names": [], "import_names": [], "rhs_call_name": "cvCreateImage", "annotation": ""}, "snippet": " gray_image = cv.cvCreateImage(cv.cvSize(cv_image.width, cv_image.height), cv.IPL_DEPTH_8U, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L44_C4", "label": "eig_tex = cvCreateImage()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "vector": [14, 1, 0.2839, 0.0065, 1, 0.1, 0.1667, 776, 3, 3, 0, 0, 953, 10, 2], "semantic": {"name": "eig_tex", "arg_names": [], "import_names": [], "rhs_call_name": "cvCreateImage", "annotation": ""}, "snippet": " eig_tex = cv.cvCreateImage(cv.cvSize(cv_image.width*6, cv_image.height), cv.IPL_DEPTH_32F, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L46_C4", "label": "cvCvtColor()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "vector": [8, 1, 0.2968, 0.0065, 1, 0.1, 0.3333, 709, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "cvCvtColor", "arg_names": [], "import_names": [], "rhs_call_name": "cvCvtColor", "annotation": ""}, "snippet": " cv.cvCvtColor(cv_image, gray_image, cv.CV_BGR2GRAY) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L47_C4", "label": "cvCornerEigenValsAndVecs()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "vector": [8, 1, 0.3032, 0.0065, 1, 0.1, 0.5, 250, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "cvCornerEigenValsAndVecs", "arg_names": [], "import_names": [], "rhs_call_name": "cvCornerEigenValsAndVecs", "annotation": ""}, "snippet": " cv.cvCornerEigenValsAndVecs(gray_image, eig_tex, blocksize, filtersize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L48_C4", "label": "eig_tex_np = cv2np()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "vector": [14, 1, 0.3097, 0.0065, 1, 0.1, 0.6667, 320, 3, 1, 0, 0, 366, 10, 1], "semantic": {"name": "eig_tex_np", "arg_names": [], "import_names": [], "rhs_call_name": "cv2np", "annotation": ""}, "snippet": " eig_tex_np = ut.cv2np(eig_tex)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L50_C4", "label": "eig_tex_np = reshape()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "vector": [14, 1, 0.3226, 0.0065, 1, 0.1, 0.8333, 320, 3, 2, 0, 0, 276, 10, 1], "semantic": {"name": "eig_tex_np", "arg_names": [], "import_names": [], "rhs_call_name": "reshape", "annotation": ""}, "snippet": " eig_tex_np = np.reshape(eig_tex_np, [cv_image.height, cv_image.width, 6]) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Return_L51_C4", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "vector": [13, 1, 0.329, 0.0065, 1, 0.1, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return eig_tex_np[:,:,0:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "label": "visualize", "type": "function", "loc": [53, 75], "level": 0, "parent": null, "vector": [2, 0, 0.4129, 0.1484, 0, 0.66, 0.8333, 705, 0, 1, 0, 0, 0, 0, 14], "semantic": {"name": "visualize", "arg_names": ["eigens"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def visualize(eigens):\n l1 = eigens[:,:,0]\n l2 = eigens[:,:,1] \n m1 = np.min(l1)\n m2 = np.min(l2)\n r1 = np.max(l1) - m1 \n r2 = np.max(l2) - m2\n if r1 == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L54_C4", "label": "l1 =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [14, 1, 0.3484, 0.0065, 1, 0.49, 0.0, 888, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "l1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l1 = eigens[:,:,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L55_C4", "label": "l2 =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [14, 1, 0.3548, 0.0065, 1, 0.49, 0.0714, 40, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "l2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l2 = eigens[:,:,1] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L56_C4", "label": "m1 = min()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [14, 1, 0.3613, 0.0065, 1, 0.49, 0.1429, 814, 3, 1, 0, 0, 867, 10, 1], "semantic": {"name": "m1", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " m1 = np.min(l1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L57_C4", "label": "m2 = min()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [14, 1, 0.3677, 0.0065, 1, 0.49, 0.2143, 562, 3, 1, 0, 0, 867, 10, 1], "semantic": {"name": "m2", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " m2 = np.min(l2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L58_C4", "label": "r1 =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [14, 1, 0.3742, 0.0065, 1, 0.49, 0.2857, 648, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "r1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r1 = np.max(l1) - m1 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L59_C4", "label": "r2 =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [14, 1, 0.3806, 0.0065, 1, 0.49, 0.3571, 959, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "r2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r2 = np.max(l2) - m2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L60_C4", "label": "if", "type": "if", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [4, 1, 0.3903, 0.0129, 1, 0.49, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r1 == 0:\n r1 = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L61_C8", "label": "r1 =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L60_C4", "vector": [14, 2, 0.3935, 0.0065, 2, 0.08, 0.0, 648, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "r1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r1 = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [4, 1, 0.4032, 0.0129, 1, 0.49, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r2 == 0:\n r2 = 1 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L63_C8", "label": "r2 =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L62_C4", "vector": [14, 2, 0.4065, 0.0065, 2, 0.89, 0.0, 959, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "r2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r2 = 1 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L64_C4", "label": "l1cv = np2cv()", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [14, 1, 0.4129, 0.0065, 1, 0.49, 0.5714, 769, 3, 1, 0, 0, 672, 10, 2], "semantic": {"name": "l1cv", "arg_names": [], "import_names": [], "rhs_call_name": "np2cv", "annotation": ""}, "snippet": " l1cv = ut.np2cv(np.array( (1 - ((l1-m1) / r1)) * 255, dtype='uint8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L65_C4", "label": "l2cv = np2cv()", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [14, 1, 0.4194, 0.0065, 1, 0.49, 0.6429, 521, 3, 1, 0, 0, 672, 10, 2], "semantic": {"name": "l2cv", "arg_names": [], "import_names": [], "rhs_call_name": "np2cv", "annotation": ""}, "snippet": " l2cv = ut.np2cv(np.array( (1 - ((l2-m2) / r2)) * 255, dtype='uint8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L66_C4", "label": "cvNamedWindow()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [8, 1, 0.4258, 0.0065, 1, 0.49, 0.7143, 431, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "cvNamedWindow", "arg_names": [], "import_names": [], "rhs_call_name": "cvNamedWindow", "annotation": ""}, "snippet": " hg.cvNamedWindow('eigen value 1', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L67_C4", "label": "cvNamedWindow()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [8, 1, 0.4323, 0.0065, 1, 0.49, 0.7857, 431, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "cvNamedWindow", "arg_names": [], "import_names": [], "rhs_call_name": "cvNamedWindow", "annotation": ""}, "snippet": " hg.cvNamedWindow('eigen value 2', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L68_C4", "label": "cvShowImage()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [8, 1, 0.4387, 0.0065, 1, 0.49, 0.8571, 105, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "cvShowImage", "arg_names": [], "import_names": [], "rhs_call_name": "cvShowImage", "annotation": ""}, "snippet": " hg.cvShowImage('eigen value 1', l1cv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L69_C4", "label": "cvShowImage()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [8, 1, 0.4452, 0.0065, 1, 0.49, 0.9286, 105, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "cvShowImage", "arg_names": [], "import_names": [], "rhs_call_name": "cvShowImage", "annotation": ""}, "snippet": " hg.cvShowImage('eigen value 2', l2cv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:While_L70_C4", "label": "while", "type": "while", "loc": [70, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "vector": [5, 1, 0.4677, 0.0387, 1, 0.49, 1.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n k = hg.cvWaitKey(33)\n if k == ' ':\n return\n if k == 'x':\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L71_C8", "label": "k = cvWaitKey()", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:While_L70_C4", "vector": [14, 2, 0.4581, 0.0065, 2, 0.0, 0.0, 954, 3, 1, 0, 0, 885, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "cvWaitKey", "annotation": ""}, "snippet": " k = hg.cvWaitKey(33)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L72_C8", "label": "if", "type": "if", "loc": [72, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:While_L70_C4", "vector": [4, 2, 0.4677, 0.0129, 2, 0.0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == ' ':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Return_L73_C12", "label": "return", "type": "return", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L72_C8", "vector": [13, 3, 0.471, 0.0065, 3, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L74_C8", "label": "if", "type": "if", "loc": [74, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:While_L70_C4", "vector": [4, 2, 0.4806, 0.0129, 2, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'x':\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L75_C12", "label": "exit()", "type": "expression", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L74_C8", "vector": [8, 3, 0.4839, 0.0065, 3, 0.07, 0.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L78_C0", "label": "if", "type": "if", "loc": [78, 86], "level": 0, "parent": null, "vector": [4, 0, 0.529, 0.0581, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n #hg.cvNamedWindow('win', 1)\n im = hg.cvLoadImage('/home/haidai/svn/robot1/src/projects/08_03_dog_commands/dragonfly_color_calibration/untitled folder/camera_image.png')\n #hg.cvShowImage('win', im)\n for i in range(40):\n s = (i+1) * 2\n print(s)\n eig_tex_np = eigen_texture(im, blocksize=s, filtersize=3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L80_C4", "label": "im = cvLoadImage()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L78_C0", "vector": [14, 1, 0.5161, 0.0065, 1, 0.5, 0.0, 940, 3, 1, 0, 0, 45, 10, 1], "semantic": {"name": "im", "arg_names": [], "import_names": [], "rhs_call_name": "cvLoadImage", "annotation": ""}, "snippet": " im = hg.cvLoadImage('/home/haidai/svn/robot1/src/projects/08_03_dog_commands/dragonfly_color_calibration/untitled folder/camera_image.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "label": "for i", "type": "for", "loc": [82, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L78_C0", "vector": [6, 1, 0.5419, 0.0323, 1, 0.5, 1.0, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(40):\n s = (i+1) * 2\n print(s)\n eig_tex_np = eigen_texture(im, blocksize=s, filtersize=3)\n visualize(eig_tex_np)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L83_C8", "label": "s =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "vector": [14, 2, 0.5355, 0.0065, 2, 0.25, 0.0, 553, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = (i+1) * 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L84_C8", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "vector": [8, 2, 0.5419, 0.0065, 2, 0.25, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L85_C8", "label": "eig_tex_np = eigen_texture()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "vector": [14, 2, 0.5484, 0.0065, 2, 0.25, 0.6667, 320, 3, 3, 0, 0, 5, 10, 1], "semantic": {"name": "eig_tex_np", "arg_names": [], "import_names": [], "rhs_call_name": "eigen_texture", "annotation": ""}, "snippet": " eig_tex_np = eigen_texture(im, blocksize=s, filtersize=3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L86_C8", "label": "visualize()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "vector": [8, 2, 0.5548, 0.0065, 2, 0.25, 1.0, 705, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "visualize", "arg_names": [], "import_names": [], "rhs_call_name": "visualize", "annotation": ""}, "snippet": " visualize(eig_tex_np)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Return_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:While_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:While_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:While_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Return_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:While_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:If_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99493:For_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99493:Expr_L86_C8"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
from features import features
import texture_features
import gaussian_curvature
import scipy.stats as stats
import numpy as np
import opencv as cv
import scipy.spatial.kdtree as kdtree
import util as ut # used for getTime, and cv2np, load_pickle, save_pickle
import os #[for os.path.exists(...)]
import copy #[to copy VOI indices]
import processor ###
#The source file:
# Has a file import statement which uses config.path, etc.
# Heavily uses internal variables of processor.Processor object (called 'processor', must be passed).
# Uses no functions from processor except for rotate_to_plane()
# Vars: pts3d_bound, img, map2d (=camPts_bound), config.path, scan_dataset.id, feature_radius,
# voi_width, rotate_to_plane(), scan_dataset.ground_plane_normal, intensities_bound
class gaussian_histogram_features(features):
'''
classdocs
'''
#all_save_load: set to true only if nonzero_indices contain all pts in pt-cloud!
def prepare(self, features_k_nearest_neighbors, nonzero_indices = None, all_save_load = False, regenerate_neightborhood_indices = False):
#print np.shape(self.processor.pts3d_bound), 'shape pts3d_bound'
imgTmp = cv.cvCloneImage(self.processor.img)
self.imNP = ut.cv2np(imgTmp,format='BGR')
###self.processor.map2d = np.asarray(self.processor.camPts_bound) #copied from laser to image mapping
if features_k_nearest_neighbors == None or features_k_nearest_neighbors == False: #use range
self.kdtree2d = kdtree.KDTree(self.processor.pts3d_bound.T)
#print len(nonzero_indices)
#print np.shape(np.asarray((self.processor.pts3d_bound.T)[nonzero_indices]))
if nonzero_indices != None:
print ut.getTime(), 'query ball tree for ', len(nonzero_indices), 'points'
kdtree_query = kdtree.KDTree((self.processor.pts3d_bound.T)[nonzero_indices])
else:
print ut.getTime(), 'query ball tree'
kdtree_query = kdtree.KDTree(self.processor.pts3d_bound.T)
filename = self.processor.config.path+'/data/'+self.processor.scan_dataset.id+'_sphere_neighborhood_indices_'+str(self.processor.feature_radius)+'.pkl'
if all_save_load == True and os.path.exists(filename) and regenerate_neightborhood_indices == False:
#if its already there, load it:
print ut.getTime(), 'loading',filename
self.kdtree_queried_indices = ut.load_pickle(filename)
else:
self.kdtree_queried_indices = kdtree_query.query_ball_tree(self.kdtree2d, self.processor.feature_radius, 2.0, 0.2) #approximate
print ut.getTime(), 'queried kdtree: ',len(self.kdtree_queried_indices),'points, radius:',self.processor.feature_radius
if all_save_load == True:
ut.save_pickle(self.kdtree_queried_indices, filename)
#make dict out of list for faster operations? (doesn't seem to change speed significantly):
#self.kdtree_queried_indices = dict(zip(xrange(len(self.kdtree_queried_indices)), self.kdtree_queried_indices))
else: #experiemental: use_20_nearest_neighbors == True
#TODO: exclude invalid values in get_featurevector (uncomment code there)
self.kdtree2d = kdtree.KDTree(self.processor.pts3d_bound.T)
self.kdtree_queried_indices = []
print ut.getTime(), 'kdtree single queries for kNN start, k=', features_k_nearest_neighbors
count = 0
for point in ((self.processor.pts3d_bound.T)[nonzero_indices]):
count = count + 1
result = self.kdtree2d.query(point, features_k_nearest_neighbors,0.2,2,self.processor.feature_radius)
#existing = result[0][0] != np.Inf
#print existing
#print result[1]
self.kdtree_queried_indices += [result[1]] #[existing]
if count % 4096 == 0:
print ut.getTime(),count
print ut.getTime(), 'kdtree singe queries end'
#convert to numpy array -> faster access
self.kdtree_queried_indices = np.asarray(self.kdtree_queried_indices)
#print self.kdtree_queried_indices
#takes long to compute:
#avg_len = 0
#minlen = 999999
#maxlen = 0
#for x in self.kdtree_queried_indices:
# avg_len += len(x)
# minlen = min(minlen, len(x))
# maxlen = max(maxlen, len(x))
#avg_len = avg_len / len(self.kdtree_queried_indices)
#print ut.getTime(), "range neighbors: avg_len", avg_len, 'minlen', minlen, 'maxlen', maxlen
#create HSV numpy images:
# compute the hsv version of the image
image_size = cv.cvGetSize(self.processor.img)
img_h = cv.cvCreateImage (image_size, 8, 1)
img_s = cv.cvCreateImage (image_size, 8, 1)
img_v = cv.cvCreateImage (image_size, 8, 1)
img_hsv = cv.cvCreateImage (image_size, 8, 3)
cv.cvCvtColor (self.processor.img, img_hsv, cv.CV_BGR2HSV)
cv.cvSplit (img_hsv, img_h, img_s, img_v, None)
self.imNP_h = ut.cv2np(img_h)
self.imNP_s = ut.cv2np(img_s)
self.imNP_v = ut.cv2np(img_v)
textures = texture_features.eigen_texture(self.processor.img)
self.imNP_tex1 = textures[:,:,0]
self.imNP_tex2 = textures[:,:,1]
self.debug_before_first_featurevector = True
self.generate_voi_histogram(self.processor.point_of_interest,self.processor.voi_width)
#has to have at least length 2 because of openCV matrices!!!!
def get_indexvector(self, type):
var_idx = []
#start indices
rh1 = 0 #zhist, normal, eigenvalue1, ev2
ch1 = rh1 + 6 #hsi zhist, maxheight-diff, tex1, tex2
ci = ch1 + 25
end = ci + 4 #
if type=='range':
for i in range(rh1, ch1):
var_idx.append(i)
elif type=='color':
for i in range(ch1, end):
var_idx.append(i)
#for plotting:
elif type=='hsvi':
for i in range(ci,end):
var_idx.append(i)
else: #all
for i in range(rh1, end):
var_idx.append(i)
return np.array(var_idx)
#get the feature vector for a specific point
def get_featurevector(self, index, count, pts = None):
if pts == None:
pts = self.processor.pts3d_bound
#print 'i',index,'c', count
fv = []
indices = np.asarray(self.kdtree_queried_indices[count])
invalid_value = np.shape(pts)[1]
#print indices
#print 'iv',invalid_value
indices = indices[indices != invalid_value]
#print ut.getTime(), indices
#print ut.getTime(), 'number of pts', len(indices)
a = pts[:,indices]
view = processor.rotate_to_plane(self.processor.scan_dataset.ground_plane_normal, np.matrix([-1,0,0.]).T)
normal, eigenvalues = gaussian_curvature.gaussian_curvature(a,view)
#eigenvalues = eigenvalues / np.square(r)
#fv += [normal[0,0],0,normal[2,0]]
#fv += normal.T.A[0].tolist()
#fv += eigenvalues.tolist()
#print np.asarray(pts[:,index].T[0])[0]
# print 'pt',np.asarray(pts[:,index].T[0])
point = pts[:,index]
ev1, ev2 = self.get_voi_histogram_spread(point)
#z_max_height_diff = pts[2,index] - self.get_voi_maxcount_height()
#fv += [self.get_voi_histogram_value(point),z_max_height_diff,normal[0,0],normal[1,0],normal[2,0], ev1, ev2]
fv += [self.get_voi_histogram_value(point),normal[0,0],normal[1,0],normal[2,0], ev1, ev2]
h = self.imNP_h[self.processor.map2d[1,index],self.processor.map2d[0,index]]
s = self.imNP_s[self.processor.map2d[1,index],self.processor.map2d[0,index]]
i = self.processor.intensities_bound[index]
hsi = self.get_voi_hsi_histogram_values(point,h,s,i)
fv += [hsi[0],hsi[1],hsi[2]]
#print np.shape(self.imNP_tex1)
#print np.shape(self.map2d)
tex1 = self.imNP_tex1[self.processor.map2d[1,index],self.processor.map2d[0,index]]
tex2 = self.imNP_tex2[self.processor.map2d[1,index],self.processor.map2d[0,index]]
fv += [tex1, tex2]
#print tex1, tex2
#color histograms:
colors_h = []
colors_s = []
colors_v = []
for idx in indices:
colors_h.append(float(self.imNP_h[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))
colors_s.append(float(self.imNP_s[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))
colors_v.append(float(self.imNP_v[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))
color_hist = stats.histogram2(np.array(colors_h), [0,51,102,153,204])
color_hist = color_hist / float(np.sum(color_hist))
color_hist = list(color_hist)
fv += color_hist
color_hist = stats.histogram2(np.array(colors_s), [0,51,102,153,204])
color_hist = color_hist / float(np.sum(color_hist))
color_hist = list(color_hist)
fv += color_hist
color_hist = stats.histogram2(np.array(colors_v), [0,51,102,153,204])
color_hist = color_hist / float(np.sum(color_hist))
color_hist = list(color_hist)
fv += color_hist
#intensities
intensities = self.processor.intensities_bound[indices]
intensities = np.asarray(intensities)
#map to 0-255-range: TODO: perhaps do some nonlinear transformation here?
intensities = intensities / 10000 * 255
intensity_hist = stats.histogram2(intensities, [0,51,102,153,204])
intensity_hist = intensity_hist / float(np.sum(intensity_hist))
intensity_hist = list(intensity_hist)
fv += intensity_hist
#current colors:
fv += [float(self.imNP_h[self.processor.map2d[1,index],self.processor.map2d[0,index]]) / 255.0]
fv += [float(self.imNP_s[self.processor.map2d[1,index],self.processor.map2d[0,index]]) / 255.0]
fv += [float(self.imNP_v[self.processor.map2d[1,index],self.processor.map2d[0,index]]) / 255.0]
#current intensity value (scaled)
intensity = self.processor.intensities_bound[index]
#scale:
intensity = intensity / 15000.0
intensity = [intensity]
fv += intensity
if self.debug_before_first_featurevector == True:
self.debug_before_first_featurevector = False
print ut.getTime(), 'get_featurevector: Choosing not to print Feature Vector Sample'
#print ut.getTime(), 'feature vector sample(gaussian histograms):', fv
return fv
#poi and width: cube of interest around point
#min, max, bincount gives the height slices
def generate_voi_histogram(self, poi, width):
print 'poi',poi,'width',width
# indices of points in volume of interest (poi)
pts_indices = self.get_voi_pts_indices(poi, width)
self.voi_pts_indices = pts_indices
pts = np.asarray(self.processor.pts3d_bound)
pts = pts[:,pts_indices] #truncate points to volume of interest
self.voi_pts = pts
#mlab.points3d(pts[0,:],pts[1,:],pts[2,:], mode='point')
#mlab.show()
#go from 0 to 2m, create histogram with 80 bins = bin of 2.5cm (=height-slice)
min = 0.
max = 2.
self.voi_bincount = 80
self.voi_interval_size = max - min
bins = np.asarray(range(self.voi_bincount)) * self.voi_interval_size/float(self.voi_bincount)
#print 'bins',bins
hist = stats.histogram2(pts[2],bins) / float(len(pts[2]))
#print 'zhist',hist
#print zip(bins, hist)
self.z_hist = hist
self.z_hist_bins = bins
slices = self.get_voi_slice_indices()
self.z_hist_slices_indices = slices
#precalculate spread values:
self.z_hist_spread = []
for indices in self.z_hist_slices_indices:
a = self.processor.pts3d_bound[:,indices]
# ev12 gives an indication about how far points are spread out in a specific height-slice
u, ev12 = gaussian_curvature.spread(a)
self.z_hist_spread += [(ev12[0], ev12[1])]
#create h,s,i histograms for each slice:
pts_h = []
pts_s = []
#print self.processor.pts3d_bound
#TODO: does this use the volume of interest? should it???
n,m = np.shape(np.asarray(self.processor.pts3d_bound))
#print 'm',m,'len(self.processor.pts3d_bound[2,:].A1)',len(self.processor.pts3d_bound[2,:].A1)
for index in range(m):
pts_h.append(float(self.imNP_h[self.processor.map2d[1,index],self.processor.map2d[0,index]]))
for index in range(m):
pts_s.append(float(self.imNP_s[self.processor.map2d[1,index],self.processor.map2d[0,index]]))
pts_i = np.asarray(self.processor.intensities_bound)
#print 'ptsi',pts_i
if np.max(pts_i) > 0:
self.intensity_normalization_factor = 1.0 / float(np.max(pts_i)) * 255
else:
self.intensity_normalization_factor = 1.
#print 'self.intensity_normalization_factor', self.intensity_normalization_factor
#print pts_i
pts_i *= self.intensity_normalization_factor
pts_h = np.asarray(pts_h)
pts_s = np.asarray(pts_s)
self.z_hist_h_hists = []
self.z_hist_s_hists = []
self.z_hist_i_hists = []
#normalize by maximum slice:
max_count = 0
max_count_index = 0
for count_idx, indices in enumerate(slices):
n = np.shape(indices)
if n[0] > max_count:
max_count = n[0]
max_count_index = count_idx
slize_height = (self.voi_interval_size / float(self.voi_bincount))
self.z_hist_height_max = slize_height * (max_count_index + 0.5)
#print 'max_count', max_count,'index',max_count_index, 'height in max bin', self.z_hist_height_max
for indices in slices:
pts_h_slice = pts_h[indices]
pts_s_slice = pts_s[indices]
pts_i_slice = pts_i[indices]
self.hsi_hist_bincount = 5
bins = np.asarray(range(0,self.hsi_hist_bincount))*float(255.0/float(self.hsi_hist_bincount))
#print bins
#todo: smooth with kernel fct
count = float(len(pts_h_slice))
if count == 0:
count = 1
hist_h = stats.histogram2(pts_h_slice,bins) / count
self.z_hist_h_hists.append(hist_h)
hist_s = stats.histogram2(pts_s_slice,bins) / count
self.z_hist_s_hists.append(hist_s)
hist_i = stats.histogram2(pts_i_slice,bins) / count
#print 'hist_i', hist_i, pts_i_slice, bins, pts_i
self.z_hist_i_hists.append(hist_i)
#print 'hh',self.z_hist_h_hists
#print 'sh',self.z_hist_s_hists
#print 'ih',self.z_hist_i_hists
def get_voi_pts_indices(self, poi, width):
pts = np.asarray(self.processor.pts3d_bound)
#region of interest:
conditions = np.multiply(np.multiply(np.multiply(np.multiply(np.multiply(pts[0] < poi[0]+width/2.0, pts[0] > poi[0]-width/2.0),
pts[1] < poi[1]+width/2.0), pts[1] > poi[1]-width/2.0),
pts[2] < poi[2]+width/2.0), pts[2] > poi[2]-width/2.0)
indices = np.where(conditions)[0]
return indices
def get_voi_slice_indices(self):
slices = []
last_z = -999999
for z in self.z_hist_bins:
indices = copy.copy(self.voi_pts_indices)
pts = self.voi_pts
conditions = np.multiply(pts[2] < z, pts[2] > last_z)
indices = indices[np.where(conditions)[0]]
slices += [indices]
last_z = z
return slices
def get_voi_histogram_value(self, point):
z = point[2]
z = int(z*self.voi_bincount / float(self.voi_interval_size))
if z >= 0 and z < self.voi_bincount:
# print z, self.z_hist[z]
return self.z_hist[z]
else:
#print z,0
return 0
def get_voi_histogram_spread(self, point):
z = point[2]
z = int(z*self.voi_bincount / float(self.voi_interval_size))
if z >= 0 and z < self.voi_bincount:
# indices = self.z_hist_slices_indices[z]
# a = self.processor.pts3d_bound[:,indices]
# u, ev12 = gaussian_curvature.spread(a)
# if abs(self.z_hist_spread[z][0] - ev12[0]) > 0.0000000001 or abs(self.z_hist_spread[z][1] - ev12[1]) > 0.0000000001:
# print 'ERROR', self.z_hist_spread[z], '!=', (ev12[0], ev12[1])
# return ev12[0], ev12[1]
return self.z_hist_spread[z]
else:
#print z,0
return 0, 0
def get_voi_hsi_histogram_values(self, point,h ,s, i):
z = point[2]
z = int(z*self.voi_bincount / float(self.voi_interval_size))
if z >= 0 and z < self.voi_bincount:
h_index = int(h * self.hsi_hist_bincount / 255.0)
s_index = int(s * self.hsi_hist_bincount / 255.0)
i *= self.intensity_normalization_factor
i_index = int(i * self.hsi_hist_bincount / 255.0)
h_hist = self.z_hist_h_hists[z][h_index]
s_hist = self.z_hist_s_hists[z][s_index]
#print 'z',z,'i_index',i_index, i
#print self.z_hist_i_hists, np.shape(self.z_hist_i_hists)
i_hist = self.z_hist_i_hists[z][i_index]
return h_hist, s_hist, i_hist
else:
#print z,0
return 0, 0, 0
def get_voi_maxcount_height(self):
return self.z_hist_height_max
| ajibawa-2023/Python-Code-Large/train/row_99495 | 224 | 449 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99495:ImportFrom_L30_C0", "label": "from features import features", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.0668, 0.0022, 0, 0.66, 0.0, 479, 0, 1, 0, 0, 479, 0, 0], "semantic": {"name": "features", "arg_names": [], "import_names": ["features"], "rhs_call_name": "", "annotation": ""}, "snippet": "from features import features"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L31_C0", "label": "texture_features import texture_features", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.069, 0.0022, 0, 0.66, 0.0909, 985, 0, 1, 0, 0, 985, 0, 0], "semantic": {"name": "texture_features", "arg_names": [], "import_names": ["texture_features"], "rhs_call_name": "", "annotation": ""}, "snippet": "import texture_features"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L32_C0", "label": "gaussian_curvature import gaussian_curvature", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.0713, 0.0022, 0, 0.66, 0.1818, 973, 0, 1, 0, 0, 973, 0, 0], "semantic": {"name": "gaussian_curvature", "arg_names": [], "import_names": ["gaussian_curvature"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gaussian_curvature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L34_C0", "label": "scipy.stats import stats", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.0757, 0.0022, 0, 0.66, 0.2727, 413, 0, 1, 0, 0, 413, 0, 0], "semantic": {"name": "scipy.stats", "arg_names": [], "import_names": ["stats"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.stats as stats"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L35_C0", "label": "numpy import np", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.078, 0.0022, 0, 0.66, 0.3636, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L36_C0", "label": "opencv import cv", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.0802, 0.0022, 0, 0.66, 0.4545, 437, 0, 1, 0, 0, 437, 0, 0], "semantic": {"name": "opencv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import opencv as cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L37_C0", "label": "scipy.spatial.kdtree import kdtree", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.0824, 0.0022, 0, 0.66, 0.5455, 15, 0, 1, 0, 0, 15, 0, 0], "semantic": {"name": "scipy.spatial.kdtree", "arg_names": [], "import_names": ["kdtree"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.spatial.kdtree as kdtree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L38_C0", "label": "util import ut", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.0846, 0.0022, 0, 0.66, 0.6364, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util as ut # used for getTime, and cv2np, load_pickle, save_pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L40_C0", "label": "os import os", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.0891, 0.0022, 0, 0.66, 0.7273, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os #[for os.path.exists(...)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L41_C0", "label": "copy import copy", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.0913, 0.0022, 0, 0.66, 0.8182, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["copy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import copy #[to copy VOI indices]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Import_L43_C0", "label": "processor import processor", "type": "import", "loc": [43, 43], "level": 0, "parent": null, "vector": [1, 0, 0.0958, 0.0022, 0, 0.66, 0.9091, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "processor", "arg_names": [], "import_names": ["processor"], "rhs_call_name": "", "annotation": ""}, "snippet": "import processor ###"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "label": "gaussian_histogram_features", "type": "class", "loc": [53, 447], "level": 0, "parent": null, "vector": [3, 0, 0.5568, 0.8797, 0, 0.66, 1.0, 9, 0, 10, 0, 0, 479, 0, 99], "semantic": {"name": "gaussian_histogram_features", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class gaussian_histogram_features(features):\n '''\n classdocs\n '''\n \n #all_save_load: set to true only if nonzero_indices contain all pts in pt-cloud!\n def prepare(self, features_k_nearest_neighbors, nonzero_indices = None, all_save_load = False, regenerate_neightborhood_indices = False):\n #print np.shape(self.processor.pts3d_bound), 'shape pts3d_bound'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L54_C4", "label": "expression", "type": "expression", "loc": [54, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [8, 1, 0.1225, 0.0067, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "label": "prepare", "type": "function", "loc": [59, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.2305, 0.2004, 1, 0.37, 0.1, 556, 0, 5, 0, 0, 0, 0, 41], "semantic": {"name": "prepare", "arg_names": ["self", "features_k_nearest_neighbors", "nonzero_indices", "all_save_load", "regenerate_neightborhood_indices"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prepare(self, features_k_nearest_neighbors, nonzero_indices = None, all_save_load = False, regenerate_neightborhood_indices = False):\n #print np.shape(self.processor.pts3d_bound), 'shape pts3d_bound'\n\n imgTmp = cv.cvCloneImage(self.processor.img)\n self.imNP = ut.cv2np(imgTmp,format='BGR')\n ###self.processor.map2d = np.asarray(self.processor.camPts_bound) #copied from laser to image mapping\n \n if features_k_nearest_neighbors == None or features_k_nearest_neighbors == False: #use range"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L62_C8", "label": "imgTmp = cvCloneImage()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.1381, 0.0022, 2, 0.66, 0.0, 110, 3, 1, 0, 0, 483, 10, 1], "semantic": {"name": "imgTmp", "arg_names": [], "import_names": [], "rhs_call_name": "cvCloneImage", "annotation": ""}, "snippet": " imgTmp = cv.cvCloneImage(self.processor.img)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L63_C8", "label": "self.imNP = cv2np()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.1403, 0.0022, 2, 0.66, 0.0588, 579, 3, 2, 0, 0, 366, 10, 1], "semantic": {"name": "self.imNP", "arg_names": [], "import_names": [], "rhs_call_name": "cv2np", "annotation": ""}, "snippet": " self.imNP = ut.cv2np(imgTmp,format='BGR')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "label": "if", "type": "if", "loc": [66, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [4, 2, 0.1982, 0.1047, 2, 0.66, 0.1176, 0, 0, 0, 0, 0, 0, 0, 27], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if features_k_nearest_neighbors == None or features_k_nearest_neighbors == False: #use range\n self.kdtree2d = kdtree.KDTree(self.processor.pts3d_bound.T)\n \n #print len(nonzero_indices)\n #print np.shape(np.asarray((self.processor.pts3d_bound.T)[nonzero_indices]))\n \n if nonzero_indices != None:\n print(ut.getTime(), 'query ball tree for ', len(nonzero_indices), 'points')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L67_C12", "label": "self.kdtree2d = KDTree()", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [14, 3, 0.1492, 0.0022, 3, 0.38, 0.0, 412, 3, 1, 0, 0, 940, 10, 1], "semantic": {"name": "self.kdtree2d", "arg_names": [], "import_names": [], "rhs_call_name": "KDTree", "annotation": ""}, "snippet": " self.kdtree2d = kdtree.KDTree(self.processor.pts3d_bound.T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "label": "if", "type": "if", "loc": [72, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [4, 3, 0.1659, 0.0134, 3, 0.38, 0.1, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nonzero_indices != None:\n print(ut.getTime(), 'query ball tree for ', len(nonzero_indices), 'points')\n kdtree_query = kdtree.KDTree((self.processor.pts3d_bound.T)[nonzero_indices])\n else:\n print(ut.getTime(), 'query ball tree')\n kdtree_query = kdtree.KDTree(self.processor.pts3d_bound.T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L73_C16", "label": "print()", "type": "expression", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "vector": [8, 4, 0.1626, 0.0022, 4, 0.73, 0.0, 535, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'query ball tree for ', len(nonzero_indices), 'points')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L74_C16", "label": "kdtree_query = KDTree()", "type": "assigned_variable", "loc": [74, 74], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "vector": [14, 4, 0.1648, 0.0022, 4, 0.73, 0.3333, 742, 3, 1, 0, 0, 940, 10, 1], "semantic": {"name": "kdtree_query", "arg_names": [], "import_names": [], "rhs_call_name": "KDTree", "annotation": ""}, "snippet": " kdtree_query = kdtree.KDTree((self.processor.pts3d_bound.T)[nonzero_indices])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L76_C16", "label": "print()", "type": "expression", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "vector": [8, 4, 0.1693, 0.0022, 4, 0.73, 0.6667, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'query ball tree')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L77_C16", "label": "kdtree_query = KDTree()", "type": "assigned_variable", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "vector": [14, 4, 0.1715, 0.0022, 4, 0.73, 1.0, 742, 3, 1, 0, 0, 940, 10, 1], "semantic": {"name": "kdtree_query", "arg_names": [], "import_names": [], "rhs_call_name": "KDTree", "annotation": ""}, "snippet": " kdtree_query = kdtree.KDTree(self.processor.pts3d_bound.T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L79_C12", "label": "filename =", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [14, 3, 0.1759, 0.0022, 3, 0.38, 0.2, 275, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = self.processor.config.path+'/data/'+self.processor.scan_dataset.id+'_sphere_neighborhood_indices_'+str(self.processor.feature_radius)+'.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "label": "if", "type": "if", "loc": [80, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [4, 3, 0.1871, 0.02, 3, 0.38, 0.3, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if all_save_load == True and os.path.exists(filename) and regenerate_neightborhood_indices == False:\n #if its already there, load it:\n print(ut.getTime(), 'loading',filename)\n self.kdtree_queried_indices = ut.load_pickle(filename) \n else:\n self.kdtree_queried_indices = kdtree_query.query_ball_tree(self.kdtree2d, self.processor.feature_radius, 2.0, 0.2) #approximate\n print(ut.getTime(), 'queried kdtree: ',len(self.kdtree_queried_indices),'points, radius:',self.processor.feature_radius)\n if all_save_load == True:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L82_C16", "label": "print()", "type": "expression", "loc": [82, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "vector": [8, 4, 0.1826, 0.0022, 4, 0.8, 0.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'loading',filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L83_C16", "label": "self.kdtree_queried_indices = load_pickle()", "type": "assigned_variable", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "vector": [14, 4, 0.1849, 0.0022, 4, 0.8, 0.25, 876, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "self.kdtree_queried_indices", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " self.kdtree_queried_indices = ut.load_pickle(filename) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L85_C16", "label": "self.kdtree_queried_indices = query_ball_tree()", "type": "assigned_variable", "loc": [85, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "vector": [14, 4, 0.1893, 0.0022, 4, 0.8, 0.5, 876, 3, 4, 0, 0, 830, 10, 1], "semantic": {"name": "self.kdtree_queried_indices", "arg_names": [], "import_names": [], "rhs_call_name": "query_ball_tree", "annotation": ""}, "snippet": " self.kdtree_queried_indices = kdtree_query.query_ball_tree(self.kdtree2d, self.processor.feature_radius, 2.0, 0.2) #approximate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L86_C16", "label": "print()", "type": "expression", "loc": [86, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "vector": [8, 4, 0.1915, 0.0022, 4, 0.8, 0.75, 535, 3, 5, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'queried kdtree: ',len(self.kdtree_queried_indices),'points, radius:',self.processor.feature_radius)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L87_C16", "label": "if", "type": "if", "loc": [87, 88], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "vector": [4, 4, 0.1949, 0.0045, 4, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if all_save_load == True:\n ut.save_pickle(self.kdtree_queried_indices, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L88_C20", "label": "save_pickle()", "type": "expression", "loc": [88, 88], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L87_C16", "vector": [8, 5, 0.196, 0.0022, 5, 0.98, 0.0, 390, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save_pickle", "arg_names": [], "import_names": [], "rhs_call_name": "save_pickle", "annotation": ""}, "snippet": " ut.save_pickle(self.kdtree_queried_indices, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L96_C12", "label": "self.kdtree2d = KDTree()", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [14, 3, 0.2138, 0.0022, 3, 0.38, 0.4, 412, 3, 1, 0, 0, 940, 10, 1], "semantic": {"name": "self.kdtree2d", "arg_names": [], "import_names": [], "rhs_call_name": "KDTree", "annotation": ""}, "snippet": " self.kdtree2d = kdtree.KDTree(self.processor.pts3d_bound.T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L97_C12", "label": "self.kdtree_queried_indices =", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [14, 3, 0.216, 0.0022, 3, 0.38, 0.5, 876, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.kdtree_queried_indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.kdtree_queried_indices = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L98_C12", "label": "print()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [8, 3, 0.2183, 0.0022, 3, 0.38, 0.6, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'kdtree single queries for kNN start, k=', features_k_nearest_neighbors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L99_C12", "label": "count =", "type": "assigned_variable", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [14, 3, 0.2205, 0.0022, 3, 0.38, 0.7, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L100_C12", "label": "for point", "type": "for", "loc": [100, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [6, 3, 0.2316, 0.02, 3, 0.38, 0.8, 16, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for point in ((self.processor.pts3d_bound.T)[nonzero_indices]):\n count = count + 1\n result = self.kdtree2d.query(point, features_k_nearest_neighbors,0.2,2,self.processor.feature_radius)\n #existing = result[0][0] != np.Inf\n #print existing\n #print result[1]\n self.kdtree_queried_indices += [result[1]] #[existing]\n if count % 4096 == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L101_C16", "label": "count =", "type": "assigned_variable", "loc": [101, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L100_C12", "vector": [14, 4, 0.2249, 0.0022, 4, 0.39, 0.0, 778, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = count + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L102_C16", "label": "result = query()", "type": "assigned_variable", "loc": [102, 102], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L100_C12", "vector": [14, 4, 0.2272, 0.0022, 4, 0.39, 0.5, 51, 3, 5, 0, 0, 546, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "query", "annotation": ""}, "snippet": " result = self.kdtree2d.query(point, features_k_nearest_neighbors,0.2,2,self.processor.feature_radius)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L107_C16", "label": "if", "type": "if", "loc": [107, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L100_C12", "vector": [4, 4, 0.2394, 0.0045, 4, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count % 4096 == 0:\n print(ut.getTime(),count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L108_C20", "label": "print()", "type": "expression", "loc": [108, 108], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L107_C16", "vector": [8, 5, 0.2405, 0.0022, 5, 0.74, 0.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(),count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L109_C12", "label": "print()", "type": "expression", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [8, 3, 0.2428, 0.0022, 3, 0.38, 0.9, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'kdtree singe queries end')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L112_C12", "label": "self.kdtree_queried_indices = asarray()", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "vector": [14, 3, 0.2494, 0.0022, 3, 0.38, 1.0, 876, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "self.kdtree_queried_indices", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " self.kdtree_queried_indices = np.asarray(self.kdtree_queried_indices)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L129_C8", "label": "image_size = cvGetSize()", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.2873, 0.0022, 2, 0.66, 0.1765, 701, 3, 1, 0, 0, 261, 10, 1], "semantic": {"name": "image_size", "arg_names": [], "import_names": [], "rhs_call_name": "cvGetSize", "annotation": ""}, "snippet": " image_size = cv.cvGetSize(self.processor.img)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L130_C8", "label": "img_h = cvCreateImage()", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.2895, 0.0022, 2, 0.66, 0.2353, 900, 3, 3, 0, 0, 953, 10, 1], "semantic": {"name": "img_h", "arg_names": [], "import_names": [], "rhs_call_name": "cvCreateImage", "annotation": ""}, "snippet": " img_h = cv.cvCreateImage (image_size, 8, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L131_C8", "label": "img_s = cvCreateImage()", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.2918, 0.0022, 2, 0.66, 0.2941, 594, 3, 3, 0, 0, 953, 10, 1], "semantic": {"name": "img_s", "arg_names": [], "import_names": [], "rhs_call_name": "cvCreateImage", "annotation": ""}, "snippet": " img_s = cv.cvCreateImage (image_size, 8, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L132_C8", "label": "img_v = cvCreateImage()", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.294, 0.0022, 2, 0.66, 0.3529, 373, 3, 3, 0, 0, 953, 10, 1], "semantic": {"name": "img_v", "arg_names": [], "import_names": [], "rhs_call_name": "cvCreateImage", "annotation": ""}, "snippet": " img_v = cv.cvCreateImage (image_size, 8, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L133_C8", "label": "img_hsv = cvCreateImage()", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.2962, 0.0022, 2, 0.66, 0.4118, 486, 3, 3, 0, 0, 953, 10, 1], "semantic": {"name": "img_hsv", "arg_names": [], "import_names": [], "rhs_call_name": "cvCreateImage", "annotation": ""}, "snippet": " img_hsv = cv.cvCreateImage (image_size, 8, 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L135_C8", "label": "cvCvtColor()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [8, 2, 0.3007, 0.0022, 2, 0.66, 0.4706, 709, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "cvCvtColor", "arg_names": [], "import_names": [], "rhs_call_name": "cvCvtColor", "annotation": ""}, "snippet": " cv.cvCvtColor (self.processor.img, img_hsv, cv.CV_BGR2HSV)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L137_C8", "label": "cvSplit()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [8, 2, 0.3051, 0.0022, 2, 0.66, 0.5294, 389, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "cvSplit", "arg_names": [], "import_names": [], "rhs_call_name": "cvSplit", "annotation": ""}, "snippet": " cv.cvSplit (img_hsv, img_h, img_s, img_v, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L138_C8", "label": "self.imNP_h = cv2np()", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.3073, 0.0022, 2, 0.66, 0.5882, 331, 3, 1, 0, 0, 366, 10, 1], "semantic": {"name": "self.imNP_h", "arg_names": [], "import_names": [], "rhs_call_name": "cv2np", "annotation": ""}, "snippet": " self.imNP_h = ut.cv2np(img_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L139_C8", "label": "self.imNP_s = cv2np()", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.3096, 0.0022, 2, 0.66, 0.6471, 538, 3, 1, 0, 0, 366, 10, 1], "semantic": {"name": "self.imNP_s", "arg_names": [], "import_names": [], "rhs_call_name": "cv2np", "annotation": ""}, "snippet": " self.imNP_s = ut.cv2np(img_s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L140_C8", "label": "self.imNP_v = cv2np()", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.3118, 0.0022, 2, 0.66, 0.7059, 223, 3, 1, 0, 0, 366, 10, 1], "semantic": {"name": "self.imNP_v", "arg_names": [], "import_names": [], "rhs_call_name": "cv2np", "annotation": ""}, "snippet": " self.imNP_v = ut.cv2np(img_v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L142_C8", "label": "textures = eigen_texture()", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.3163, 0.0022, 2, 0.66, 0.7647, 215, 3, 1, 0, 0, 5, 10, 1], "semantic": {"name": "textures", "arg_names": [], "import_names": [], "rhs_call_name": "eigen_texture", "annotation": ""}, "snippet": " textures = texture_features.eigen_texture(self.processor.img)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L143_C8", "label": "self.imNP_tex1 =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.3185, 0.0022, 2, 0.66, 0.8235, 409, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.imNP_tex1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.imNP_tex1 = textures[:,:,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L144_C8", "label": "self.imNP_tex2 =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.3207, 0.0022, 2, 0.66, 0.8824, 209, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.imNP_tex2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.imNP_tex2 = textures[:,:,1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L146_C8", "label": "self.debug_before_first_featurevector =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [14, 2, 0.3252, 0.0022, 2, 0.66, 0.9412, 355, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.debug_before_first_featurevector", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.debug_before_first_featurevector = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L148_C8", "label": "generate_voi_histogram()", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "vector": [8, 2, 0.3296, 0.0022, 2, 0.66, 1.0, 609, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "generate_voi_histogram", "arg_names": [], "import_names": [], "rhs_call_name": "generate_voi_histogram", "annotation": ""}, "snippet": " self.generate_voi_histogram(self.processor.point_of_interest,self.processor.voi_width)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "label": "get_indexvector", "type": "function", "loc": [153, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.3653, 0.0512, 1, 0.37, 0.2, 770, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "get_indexvector", "arg_names": ["self", "type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_indexvector(self, type):\n \n var_idx = []\n #start indices\n rh1 = 0 #zhist, normal, eigenvalue1, ev2\n ch1 = rh1 + 6 #hsi zhist, maxheight-diff, tex1, tex2\n ci = ch1 + 25\n end = ci + 4 #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L155_C8", "label": "var_idx =", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "vector": [14, 2, 0.3452, 0.0022, 2, 0.22, 0.0, 719, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "var_idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " var_idx = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L157_C8", "label": "rh1 =", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "vector": [14, 2, 0.3497, 0.0022, 2, 0.22, 0.1667, 987, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "rh1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rh1 = 0 #zhist, normal, eigenvalue1, ev2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L158_C8", "label": "ch1 =", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "vector": [14, 2, 0.3519, 0.0022, 2, 0.22, 0.3333, 472, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ch1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ch1 = rh1 + 6 #hsi zhist, maxheight-diff, tex1, tex2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L159_C8", "label": "ci =", "type": "assigned_variable", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "vector": [14, 2, 0.3541, 0.0022, 2, 0.22, 0.5, 916, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ci", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ci = ch1 + 25"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L160_C8", "label": "end =", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "vector": [14, 2, 0.3563, 0.0022, 2, 0.22, 0.6667, 128, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = ci + 4 #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L161_C8", "label": "if", "type": "if", "loc": [161, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "vector": [4, 2, 0.3719, 0.029, 2, 0.22, 0.8333, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type=='range':\n for i in range(rh1, ch1):\n var_idx.append(i) \n elif type=='color':\n for i in range(ch1, end):\n var_idx.append(i) \n #for plotting:\n elif type=='hsvi':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L162_C12", "label": "for i", "type": "for", "loc": [162, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L161_C8", "vector": [6, 3, 0.3619, 0.0045, 3, 0.31, 0.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(rh1, ch1):\n var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L163_C16", "label": "append()", "type": "expression", "loc": [163, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L162_C12", "vector": [8, 4, 0.363, 0.0022, 4, 0.83, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L164_C8", "label": "if", "type": "if", "loc": [164, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L161_C8", "vector": [4, 3, 0.3753, 0.0223, 3, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif type=='color':\n for i in range(ch1, end):\n var_idx.append(i) \n #for plotting:\n elif type=='hsvi':\n for i in range(ci,end):\n var_idx.append(i) \n else: #all"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L165_C12", "label": "for i", "type": "for", "loc": [165, 166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L164_C8", "vector": [6, 4, 0.3686, 0.0045, 4, 0.79, 0.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(ch1, end):\n var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L166_C16", "label": "append()", "type": "expression", "loc": [166, 166], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L165_C12", "vector": [8, 5, 0.3697, 0.0022, 5, 0.07, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L168_C8", "label": "if", "type": "if", "loc": [168, 173], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L164_C8", "vector": [4, 4, 0.3797, 0.0134, 4, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif type=='hsvi':\n for i in range(ci,end):\n var_idx.append(i) \n else: #all\n for i in range(rh1, end):\n var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L169_C12", "label": "for i", "type": "for", "loc": [169, 170], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L168_C8", "vector": [6, 5, 0.3775, 0.0045, 5, 0.04, 0.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(ci,end):\n var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L170_C16", "label": "append()", "type": "expression", "loc": [170, 170], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L169_C12", "vector": [8, 6, 0.3786, 0.0022, 6, 0.12, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L172_C12", "label": "for i", "type": "for", "loc": [172, 173], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L168_C8", "vector": [6, 5, 0.3842, 0.0045, 5, 0.04, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(rh1, end):\n var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L173_C16", "label": "append()", "type": "expression", "loc": [173, 173], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L172_C12", "vector": [8, 6, 0.3853, 0.0022, 6, 0.57, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " var_idx.append(i) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L175_C8", "label": "return", "type": "return", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "vector": [13, 2, 0.3898, 0.0022, 2, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.array(var_idx) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "label": "get_featurevector", "type": "function", "loc": [180, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.5045, 0.2094, 1, 0.37, 0.3, 16, 0, 4, 1, 0, 0, 0, 39], "semantic": {"name": "get_featurevector", "arg_names": ["self", "index", "count", "pts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_featurevector(self, index, count, pts = None):\n if pts == None:\n pts = self.processor.pts3d_bound\n\n #print 'i',index,'c', count\n fv = [] \n \n indices = np.asarray(self.kdtree_queried_indices[count])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L181_C8", "label": "if", "type": "if", "loc": [181, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [4, 2, 0.4042, 0.0045, 2, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pts == None:\n pts = self.processor.pts3d_bound"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L182_C12", "label": "pts =", "type": "assigned_variable", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L181_C8", "vector": [14, 3, 0.4053, 0.0022, 3, 0.36, 0.0, 195, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts = self.processor.pts3d_bound"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L185_C8", "label": "fv =", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.412, 0.0022, 2, 0.86, 0.0256, 914, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "fv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fv = [] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L187_C8", "label": "indices = asarray()", "type": "assigned_variable", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4165, 0.0022, 2, 0.86, 0.0513, 478, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " indices = np.asarray(self.kdtree_queried_indices[count])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L188_C8", "label": "invalid_value =", "type": "assigned_variable", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4187, 0.0022, 2, 0.86, 0.0769, 952, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "invalid_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " invalid_value = np.shape(pts)[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L191_C8", "label": "indices =", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4254, 0.0022, 2, 0.86, 0.1026, 478, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " indices = indices[indices != invalid_value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L195_C8", "label": "a =", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4343, 0.0022, 2, 0.86, 0.1282, 475, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = pts[:,indices]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L196_C8", "label": "view = rotate_to_plane()", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4365, 0.0022, 2, 0.86, 0.1538, 781, 3, 2, 0, 0, 639, 10, 2], "semantic": {"name": "view", "arg_names": [], "import_names": [], "rhs_call_name": "rotate_to_plane", "annotation": ""}, "snippet": " view = processor.rotate_to_plane(self.processor.scan_dataset.ground_plane_normal, np.matrix([-1,0,0.]).T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L197_C8", "label": "normal, eigenvalues = gaussian_curvature()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4388, 0.0022, 2, 0.86, 0.1795, 21, 3, 2, 0, 0, 973, 10, 1], "semantic": {"name": "normal, eigenvalues", "arg_names": [], "import_names": [], "rhs_call_name": "gaussian_curvature", "annotation": ""}, "snippet": " normal, eigenvalues = gaussian_curvature.gaussian_curvature(a,view)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L204_C8", "label": "point =", "type": "assigned_variable", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4543, 0.0022, 2, 0.86, 0.2051, 16, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " point = pts[:,index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L206_C8", "label": "ev1, ev2 = get_voi_histogram_spread()", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4588, 0.0022, 2, 0.86, 0.2308, 234, 3, 1, 0, 0, 369, 10, 1], "semantic": {"name": "ev1, ev2", "arg_names": [], "import_names": [], "rhs_call_name": "get_voi_histogram_spread", "annotation": ""}, "snippet": " ev1, ev2 = self.get_voi_histogram_spread(point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L211_C8", "label": "h =", "type": "assigned_variable", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4699, 0.0022, 2, 0.86, 0.2564, 686, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h = self.imNP_h[self.processor.map2d[1,index],self.processor.map2d[0,index]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L212_C8", "label": "s =", "type": "assigned_variable", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4722, 0.0022, 2, 0.86, 0.2821, 553, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = self.imNP_s[self.processor.map2d[1,index],self.processor.map2d[0,index]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L213_C8", "label": "i =", "type": "assigned_variable", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4744, 0.0022, 2, 0.86, 0.3077, 826, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = self.processor.intensities_bound[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L214_C8", "label": "hsi = get_voi_hsi_histogram_values()", "type": "assigned_variable", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4766, 0.0022, 2, 0.86, 0.3333, 146, 3, 4, 0, 0, 393, 10, 1], "semantic": {"name": "hsi", "arg_names": [], "import_names": [], "rhs_call_name": "get_voi_hsi_histogram_values", "annotation": ""}, "snippet": " hsi = self.get_voi_hsi_histogram_values(point,h,s,i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L218_C8", "label": "tex1 =", "type": "assigned_variable", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4855, 0.0022, 2, 0.86, 0.359, 476, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tex1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tex1 = self.imNP_tex1[self.processor.map2d[1,index],self.processor.map2d[0,index]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L219_C8", "label": "tex2 =", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.4878, 0.0022, 2, 0.86, 0.3846, 839, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tex2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tex2 = self.imNP_tex2[self.processor.map2d[1,index],self.processor.map2d[0,index]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L225_C8", "label": "colors_h =", "type": "assigned_variable", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5011, 0.0022, 2, 0.86, 0.4103, 333, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "colors_h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colors_h = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L226_C8", "label": "colors_s =", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5033, 0.0022, 2, 0.86, 0.4359, 786, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "colors_s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colors_s = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L227_C8", "label": "colors_v =", "type": "assigned_variable", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5056, 0.0022, 2, 0.86, 0.4615, 442, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "colors_v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colors_v = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L228_C8", "label": "for idx", "type": "for", "loc": [228, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [6, 2, 0.5111, 0.0089, 2, 0.86, 0.4872, 187, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx in indices:\n colors_h.append(float(self.imNP_h[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))\n colors_s.append(float(self.imNP_s[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))\n colors_v.append(float(self.imNP_v[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L229_C12", "label": "append()", "type": "expression", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L228_C8", "vector": [8, 3, 0.51, 0.0022, 3, 0.29, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " colors_h.append(float(self.imNP_h[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L230_C12", "label": "append()", "type": "expression", "loc": [230, 230], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L228_C8", "vector": [8, 3, 0.5122, 0.0022, 3, 0.29, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " colors_s.append(float(self.imNP_s[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L231_C12", "label": "append()", "type": "expression", "loc": [231, 231], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L228_C8", "vector": [8, 3, 0.5145, 0.0022, 3, 0.29, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " colors_v.append(float(self.imNP_v[self.processor.map2d[1,idx],self.processor.map2d[0,idx]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L233_C8", "label": "color_hist = histogram2()", "type": "assigned_variable", "loc": [233, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5189, 0.0022, 2, 0.86, 0.5128, 750, 3, 2, 0, 0, 671, 10, 2], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2", "annotation": ""}, "snippet": " color_hist = stats.histogram2(np.array(colors_h), [0,51,102,153,204])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L234_C8", "label": "color_hist =", "type": "assigned_variable", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5212, 0.0022, 2, 0.86, 0.5385, 750, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " color_hist = color_hist / float(np.sum(color_hist))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L235_C8", "label": "color_hist = list()", "type": "assigned_variable", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5234, 0.0022, 2, 0.86, 0.5641, 750, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " color_hist = list(color_hist)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L237_C8", "label": "color_hist = histogram2()", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5278, 0.0022, 2, 0.86, 0.5897, 750, 3, 2, 0, 0, 671, 10, 2], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2", "annotation": ""}, "snippet": " color_hist = stats.histogram2(np.array(colors_s), [0,51,102,153,204])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L238_C8", "label": "color_hist =", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5301, 0.0022, 2, 0.86, 0.6154, 750, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " color_hist = color_hist / float(np.sum(color_hist))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L239_C8", "label": "color_hist = list()", "type": "assigned_variable", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5323, 0.0022, 2, 0.86, 0.641, 750, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " color_hist = list(color_hist)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L241_C8", "label": "color_hist = histogram2()", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5367, 0.0022, 2, 0.86, 0.6667, 750, 3, 2, 0, 0, 671, 10, 2], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2", "annotation": ""}, "snippet": " color_hist = stats.histogram2(np.array(colors_v), [0,51,102,153,204])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L242_C8", "label": "color_hist =", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.539, 0.0022, 2, 0.86, 0.6923, 750, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " color_hist = color_hist / float(np.sum(color_hist))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L243_C8", "label": "color_hist = list()", "type": "assigned_variable", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5412, 0.0022, 2, 0.86, 0.7179, 750, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "color_hist", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " color_hist = list(color_hist)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L247_C8", "label": "intensities =", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5501, 0.0022, 2, 0.86, 0.7436, 725, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "intensities", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " intensities = self.processor.intensities_bound[indices]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L248_C8", "label": "intensities = asarray()", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5523, 0.0022, 2, 0.86, 0.7692, 725, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "intensities", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " intensities = np.asarray(intensities)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L250_C8", "label": "intensities =", "type": "assigned_variable", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5568, 0.0022, 2, 0.86, 0.7949, 725, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "intensities", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " intensities = intensities / 10000 * 255"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L251_C8", "label": "intensity_hist = histogram2()", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.559, 0.0022, 2, 0.86, 0.8205, 310, 3, 2, 0, 0, 671, 10, 1], "semantic": {"name": "intensity_hist", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2", "annotation": ""}, "snippet": " intensity_hist = stats.histogram2(intensities, [0,51,102,153,204])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L252_C8", "label": "intensity_hist =", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5612, 0.0022, 2, 0.86, 0.8462, 310, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "intensity_hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " intensity_hist = intensity_hist / float(np.sum(intensity_hist))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L253_C8", "label": "intensity_hist = list()", "type": "assigned_variable", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5635, 0.0022, 2, 0.86, 0.8718, 310, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "intensity_hist", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " intensity_hist = list(intensity_hist)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L262_C8", "label": "intensity =", "type": "assigned_variable", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5835, 0.0022, 2, 0.86, 0.8974, 845, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "intensity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " intensity = self.processor.intensities_bound[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L264_C8", "label": "intensity =", "type": "assigned_variable", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.588, 0.0022, 2, 0.86, 0.9231, 845, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "intensity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " intensity = intensity / 15000.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L265_C8", "label": "intensity =", "type": "assigned_variable", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [14, 2, 0.5902, 0.0022, 2, 0.86, 0.9487, 845, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "intensity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " intensity = [intensity]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L269_C8", "label": "if", "type": "if", "loc": [269, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [4, 2, 0.6013, 0.0067, 2, 0.86, 0.9744, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.debug_before_first_featurevector == True:\n self.debug_before_first_featurevector = False\n print(ut.getTime(), 'get_featurevector: Choosing not to print Feature Vector Sample')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L270_C12", "label": "self.debug_before_first_featurevector =", "type": "assigned_variable", "loc": [270, 270], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L269_C8", "vector": [14, 3, 0.6013, 0.0022, 3, 0.52, 0.0, 355, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.debug_before_first_featurevector", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.debug_before_first_featurevector = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L271_C12", "label": "print()", "type": "expression", "loc": [271, 271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L269_C8", "vector": [8, 3, 0.6036, 0.0022, 3, 0.52, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ut.getTime(), 'get_featurevector: Choosing not to print Feature Vector Sample')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L273_C8", "label": "return", "type": "return", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "vector": [13, 2, 0.608, 0.0022, 2, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "label": "generate_voi_histogram", "type": "function", "loc": [279, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.7238, 0.2071, 1, 0.37, 0.4, 609, 0, 3, 0, 0, 0, 0, 40], "semantic": {"name": "generate_voi_histogram", "arg_names": ["self", "poi", "width"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def generate_voi_histogram(self, poi, width):\n print('poi',poi,'width',width)\n \n # indices of points in volume of interest (poi)\n pts_indices = self.get_voi_pts_indices(poi, width)\n self.voi_pts_indices = pts_indices\n pts = np.asarray(self.processor.pts3d_bound)\n pts = pts[:,pts_indices] #truncate points to volume of interest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L280_C8", "label": "print()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [8, 2, 0.6236, 0.0022, 2, 0.81, 0.0, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('poi',poi,'width',width)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L283_C8", "label": "pts_indices = get_voi_pts_indices()", "type": "assigned_variable", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6303, 0.0022, 2, 0.81, 0.0286, 685, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "pts_indices", "arg_names": [], "import_names": [], "rhs_call_name": "get_voi_pts_indices", "annotation": ""}, "snippet": " pts_indices = self.get_voi_pts_indices(poi, width)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L284_C8", "label": "self.voi_pts_indices =", "type": "assigned_variable", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6325, 0.0022, 2, 0.81, 0.0571, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.voi_pts_indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.voi_pts_indices = pts_indices"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L285_C8", "label": "pts = asarray()", "type": "assigned_variable", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6347, 0.0022, 2, 0.81, 0.0857, 195, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " pts = np.asarray(self.processor.pts3d_bound)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L286_C8", "label": "pts =", "type": "assigned_variable", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.637, 0.0022, 2, 0.81, 0.1143, 195, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts = pts[:,pts_indices] #truncate points to volume of interest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L287_C8", "label": "self.voi_pts =", "type": "assigned_variable", "loc": [287, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6392, 0.0022, 2, 0.81, 0.1429, 848, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.voi_pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.voi_pts = pts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L292_C8", "label": "min =", "type": "assigned_variable", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6503, 0.0022, 2, 0.81, 0.1714, 867, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "min", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " min = 0."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L293_C8", "label": "max =", "type": "assigned_variable", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6526, 0.0022, 2, 0.81, 0.2, 442, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "max", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max = 2."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L294_C8", "label": "self.voi_bincount =", "type": "assigned_variable", "loc": [294, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6548, 0.0022, 2, 0.81, 0.2286, 576, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.voi_bincount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.voi_bincount = 80"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L295_C8", "label": "self.voi_interval_size =", "type": "assigned_variable", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.657, 0.0022, 2, 0.81, 0.2571, 497, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.voi_interval_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.voi_interval_size = max - min"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L296_C8", "label": "bins =", "type": "assigned_variable", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6592, 0.0022, 2, 0.81, 0.2857, 792, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "bins", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bins = np.asarray(range(self.voi_bincount)) * self.voi_interval_size/float(self.voi_bincount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L298_C8", "label": "hist =", "type": "assigned_variable", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6637, 0.0022, 2, 0.81, 0.3143, 353, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hist = stats.histogram2(pts[2],bins) / float(len(pts[2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L301_C8", "label": "self.z_hist =", "type": "assigned_variable", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6704, 0.0022, 2, 0.81, 0.3429, 518, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.z_hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.z_hist = hist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L302_C8", "label": "self.z_hist_bins =", "type": "assigned_variable", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6726, 0.0022, 2, 0.81, 0.3714, 481, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.z_hist_bins", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.z_hist_bins = bins"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L304_C8", "label": "slices = get_voi_slice_indices()", "type": "assigned_variable", "loc": [304, 304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6771, 0.0022, 2, 0.81, 0.4, 711, 3, 0, 0, 0, 992, 10, 1], "semantic": {"name": "slices", "arg_names": [], "import_names": [], "rhs_call_name": "get_voi_slice_indices", "annotation": ""}, "snippet": " slices = self.get_voi_slice_indices()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L305_C8", "label": "self.z_hist_slices_indices =", "type": "assigned_variable", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.6793, 0.0022, 2, 0.81, 0.4286, 354, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.z_hist_slices_indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.z_hist_slices_indices = slices"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L308_C8", "label": "self.z_hist_spread =", "type": "assigned_variable", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.686, 0.0022, 2, 0.81, 0.4571, 260, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.z_hist_spread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.z_hist_spread = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L309_C8", "label": "for indices", "type": "for", "loc": [309, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [6, 2, 0.6927, 0.0111, 2, 0.81, 0.4857, 478, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for indices in self.z_hist_slices_indices:\n a = self.processor.pts3d_bound[:,indices]\n # ev12 gives an indication about how far points are spread out in a specific height-slice\n u, ev12 = gaussian_curvature.spread(a)\n self.z_hist_spread += [(ev12[0], ev12[1])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L310_C12", "label": "a =", "type": "assigned_variable", "loc": [310, 310], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L309_C8", "vector": [14, 3, 0.6904, 0.0022, 3, 0.01, 0.0, 475, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = self.processor.pts3d_bound[:,indices]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L312_C12", "label": "u, ev12 = spread()", "type": "assigned_variable", "loc": [312, 312], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L309_C8", "vector": [14, 3, 0.6949, 0.0022, 3, 0.01, 1.0, 745, 3, 1, 0, 0, 301, 10, 1], "semantic": {"name": "u, ev12", "arg_names": [], "import_names": [], "rhs_call_name": "spread", "annotation": ""}, "snippet": " u, ev12 = gaussian_curvature.spread(a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L316_C8", "label": "pts_h =", "type": "assigned_variable", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7038, 0.0022, 2, 0.81, 0.5143, 243, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pts_h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_h = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L317_C8", "label": "pts_s =", "type": "assigned_variable", "loc": [317, 317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.706, 0.0022, 2, 0.81, 0.5429, 452, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pts_s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_s = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L320_C8", "label": "n, m = shape()", "type": "assigned_variable", "loc": [320, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7127, 0.0022, 2, 0.81, 0.5714, 51, 3, 1, 0, 0, 381, 10, 2], "semantic": {"name": "n, m", "arg_names": [], "import_names": [], "rhs_call_name": "shape", "annotation": ""}, "snippet": " n,m = np.shape(np.asarray(self.processor.pts3d_bound))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L322_C8", "label": "for index", "type": "for", "loc": [322, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [6, 2, 0.7183, 0.0045, 2, 0.81, 0.6, 780, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index in range(m):\n pts_h.append(float(self.imNP_h[self.processor.map2d[1,index],self.processor.map2d[0,index]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L323_C12", "label": "append()", "type": "expression", "loc": [323, 323], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L322_C8", "vector": [8, 3, 0.7194, 0.0022, 3, 0.16, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " pts_h.append(float(self.imNP_h[self.processor.map2d[1,index],self.processor.map2d[0,index]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L324_C8", "label": "for index", "type": "for", "loc": [324, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [6, 2, 0.7227, 0.0045, 2, 0.81, 0.6286, 780, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index in range(m):\n pts_s.append(float(self.imNP_s[self.processor.map2d[1,index],self.processor.map2d[0,index]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L325_C12", "label": "append()", "type": "expression", "loc": [325, 325], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L324_C8", "vector": [8, 3, 0.7238, 0.0022, 3, 0.76, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " pts_s.append(float(self.imNP_s[self.processor.map2d[1,index],self.processor.map2d[0,index]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L326_C8", "label": "pts_i = asarray()", "type": "assigned_variable", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7261, 0.0022, 2, 0.81, 0.6571, 72, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "pts_i", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " pts_i = np.asarray(self.processor.intensities_bound)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L328_C8", "label": "if", "type": "if", "loc": [328, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [4, 2, 0.7339, 0.0089, 2, 0.81, 0.6857, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if np.max(pts_i) > 0:\n self.intensity_normalization_factor = 1.0 / float(np.max(pts_i)) * 255\n else:\n self.intensity_normalization_factor = 1."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L329_C12", "label": "self.intensity_normalization_factor =", "type": "assigned_variable", "loc": [329, 329], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L328_C8", "vector": [14, 3, 0.7327, 0.0022, 3, 0.22, 0.0, 859, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "self.intensity_normalization_factor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.intensity_normalization_factor = 1.0 / float(np.max(pts_i)) * 255"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L331_C12", "label": "self.intensity_normalization_factor =", "type": "assigned_variable", "loc": [331, 331], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L328_C8", "vector": [14, 3, 0.7372, 0.0022, 3, 0.22, 1.0, 859, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "self.intensity_normalization_factor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.intensity_normalization_factor = 1."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L335_C8", "label": "pts_h = asarray()", "type": "assigned_variable", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7461, 0.0022, 2, 0.81, 0.7143, 243, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "pts_h", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " pts_h = np.asarray(pts_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L336_C8", "label": "pts_s = asarray()", "type": "assigned_variable", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7483, 0.0022, 2, 0.81, 0.7429, 452, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "pts_s", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " pts_s = np.asarray(pts_s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L337_C8", "label": "self.z_hist_h_hists =", "type": "assigned_variable", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7506, 0.0022, 2, 0.81, 0.7714, 383, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.z_hist_h_hists", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.z_hist_h_hists = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L338_C8", "label": "self.z_hist_s_hists =", "type": "assigned_variable", "loc": [338, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7528, 0.0022, 2, 0.81, 0.8, 362, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.z_hist_s_hists", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.z_hist_s_hists = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L339_C8", "label": "self.z_hist_i_hists =", "type": "assigned_variable", "loc": [339, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.755, 0.0022, 2, 0.81, 0.8286, 73, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.z_hist_i_hists", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.z_hist_i_hists = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L342_C8", "label": "max_count =", "type": "assigned_variable", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7617, 0.0022, 2, 0.81, 0.8571, 632, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "max_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L343_C8", "label": "max_count_index =", "type": "assigned_variable", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7639, 0.0022, 2, 0.81, 0.8857, 606, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "max_count_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_count_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L344_C8", "label": "for count_idx, indices", "type": "for", "loc": [344, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [6, 2, 0.7706, 0.0111, 2, 0.81, 0.9143, 719, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "count_idx, indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for count_idx, indices in enumerate(slices):\n n = np.shape(indices)\n if n[0] > max_count:\n max_count = n[0]\n max_count_index = count_idx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L345_C12", "label": "n = shape()", "type": "assigned_variable", "loc": [345, 345], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L344_C8", "vector": [14, 3, 0.7684, 0.0022, 3, 0.95, 0.0, 773, 3, 1, 0, 0, 381, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "shape", "annotation": ""}, "snippet": " n = np.shape(indices)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L346_C12", "label": "if", "type": "if", "loc": [346, 348], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L344_C8", "vector": [4, 3, 0.7728, 0.0067, 3, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n[0] > max_count:\n max_count = n[0]\n max_count_index = count_idx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L347_C16", "label": "max_count =", "type": "assigned_variable", "loc": [347, 347], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L346_C12", "vector": [14, 4, 0.7728, 0.0022, 4, 0.79, 0.0, 632, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_count = n[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L348_C16", "label": "max_count_index =", "type": "assigned_variable", "loc": [348, 348], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L346_C12", "vector": [14, 4, 0.7751, 0.0022, 4, 0.79, 1.0, 606, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_count_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_count_index = count_idx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L349_C8", "label": "slize_height =", "type": "assigned_variable", "loc": [349, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7773, 0.0022, 2, 0.81, 0.9429, 120, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "slize_height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " slize_height = (self.voi_interval_size / float(self.voi_bincount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L350_C8", "label": "self.z_hist_height_max =", "type": "assigned_variable", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [14, 2, 0.7795, 0.0022, 2, 0.81, 0.9714, 568, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.z_hist_height_max", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.z_hist_height_max = slize_height * (max_count_index + 0.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "label": "for indices", "type": "for", "loc": [354, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "vector": [6, 2, 0.8073, 0.0401, 2, 0.81, 1.0, 478, 2, 0, 0, 0, 0, 0, 12], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for indices in slices:\n pts_h_slice = pts_h[indices]\n pts_s_slice = pts_s[indices]\n pts_i_slice = pts_i[indices]\n self.hsi_hist_bincount = 5\n bins = np.asarray(range(0,self.hsi_hist_bincount))*float(255.0/float(self.hsi_hist_bincount))\n #print bins\n #todo: smooth with kernel fct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L355_C12", "label": "pts_h_slice =", "type": "assigned_variable", "loc": [355, 355], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.7906, 0.0022, 3, 0.43, 0.0, 567, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts_h_slice", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_h_slice = pts_h[indices]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L356_C12", "label": "pts_s_slice =", "type": "assigned_variable", "loc": [356, 356], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.7929, 0.0022, 3, 0.43, 0.0833, 64, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts_s_slice", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_s_slice = pts_s[indices]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L357_C12", "label": "pts_i_slice =", "type": "assigned_variable", "loc": [357, 357], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.7951, 0.0022, 3, 0.43, 0.1667, 976, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts_i_slice", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_i_slice = pts_i[indices]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L358_C12", "label": "self.hsi_hist_bincount =", "type": "assigned_variable", "loc": [358, 358], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.7973, 0.0022, 3, 0.43, 0.25, 540, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.hsi_hist_bincount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.hsi_hist_bincount = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L359_C12", "label": "bins =", "type": "assigned_variable", "loc": [359, 359], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.7996, 0.0022, 3, 0.43, 0.3333, 792, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "bins", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bins = np.asarray(range(0,self.hsi_hist_bincount))*float(255.0/float(self.hsi_hist_bincount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L362_C12", "label": "count = float()", "type": "assigned_variable", "loc": [362, 362], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.8062, 0.0022, 3, 0.43, 0.4167, 778, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " count = float(len(pts_h_slice))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L363_C12", "label": "if", "type": "if", "loc": [363, 364], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [4, 3, 0.8096, 0.0045, 3, 0.43, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count == 0: \n count = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L364_C16", "label": "count =", "type": "assigned_variable", "loc": [364, 364], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L363_C12", "vector": [14, 4, 0.8107, 0.0022, 4, 0.31, 0.0, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L365_C12", "label": "hist_h =", "type": "assigned_variable", "loc": [365, 365], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.8129, 0.0022, 3, 0.43, 0.5833, 680, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "hist_h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hist_h = stats.histogram2(pts_h_slice,bins) / count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L366_C12", "label": "append()", "type": "expression", "loc": [366, 366], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [8, 3, 0.8151, 0.0022, 3, 0.43, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.z_hist_h_hists.append(hist_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L367_C12", "label": "hist_s =", "type": "assigned_variable", "loc": [367, 367], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.8174, 0.0022, 3, 0.43, 0.75, 889, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "hist_s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hist_s = stats.histogram2(pts_s_slice,bins) / count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L368_C12", "label": "append()", "type": "expression", "loc": [368, 368], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [8, 3, 0.8196, 0.0022, 3, 0.43, 0.8333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.z_hist_s_hists.append(hist_s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L369_C12", "label": "hist_i =", "type": "assigned_variable", "loc": [369, 369], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [14, 3, 0.8218, 0.0022, 3, 0.43, 0.9167, 464, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "hist_i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hist_i = stats.histogram2(pts_i_slice,bins) / count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L371_C12", "label": "append()", "type": "expression", "loc": [371, 371], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "vector": [8, 3, 0.8263, 0.0022, 3, 0.43, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.z_hist_i_hists.append(hist_i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "label": "get_voi_pts_indices", "type": "function", "loc": [377, 385], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.8486, 0.02, 1, 0.37, 0.5, 893, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "get_voi_pts_indices", "arg_names": ["self", "poi", "width"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_voi_pts_indices(self, poi, width):\n pts = np.asarray(self.processor.pts3d_bound)\n #region of interest:\n conditions = np.multiply(np.multiply(np.multiply(np.multiply(np.multiply(pts[0] < poi[0]+width/2.0, pts[0] > poi[0]-width/2.0), \n pts[1] < poi[1]+width/2.0), pts[1] > poi[1]-width/2.0),\n pts[2] < poi[2]+width/2.0), pts[2] > poi[2]-width/2.0)\n \n indices = np.where(conditions)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L378_C8", "label": "pts = asarray()", "type": "assigned_variable", "loc": [378, 378], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "vector": [14, 2, 0.8419, 0.0022, 2, 0.51, 0.0, 195, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "asarray", "annotation": ""}, "snippet": " pts = np.asarray(self.processor.pts3d_bound)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L380_C8", "label": "conditions = multiply()", "type": "assigned_variable", "loc": [380, 382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "vector": [14, 2, 0.8486, 0.0067, 2, 0.51, 0.3333, 876, 3, 2, 0, 0, 960, 10, 5], "semantic": {"name": "conditions", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " conditions = np.multiply(np.multiply(np.multiply(np.multiply(np.multiply(pts[0] < poi[0]+width/2.0, pts[0] > poi[0]-width/2.0), \n pts[1] < poi[1]+width/2.0), pts[1] > poi[1]-width/2.0),\n pts[2] < poi[2]+width/2.0), pts[2] > poi[2]-width/2.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L384_C8", "label": "indices =", "type": "assigned_variable", "loc": [384, 384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "vector": [14, 2, 0.8552, 0.0022, 2, 0.51, 0.6667, 478, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " indices = np.where(conditions)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L385_C8", "label": "return", "type": "return", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "vector": [13, 2, 0.8575, 0.0022, 2, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return indices"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "label": "get_voi_slice_indices", "type": "function", "loc": [387, 399], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.8753, 0.029, 1, 0.37, 0.6, 992, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_voi_slice_indices", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_voi_slice_indices(self):\n \n slices = []\n last_z = -999999\n \n for z in self.z_hist_bins:\n indices = copy.copy(self.voi_pts_indices)\n pts = self.voi_pts "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L389_C8", "label": "slices =", "type": "assigned_variable", "loc": [389, 389], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "vector": [14, 2, 0.8664, 0.0022, 2, 0.26, 0.0, 711, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "slices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " slices = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L390_C8", "label": "last_z =", "type": "assigned_variable", "loc": [390, 390], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "vector": [14, 2, 0.8686, 0.0022, 2, 0.26, 0.3333, 590, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_z = -999999"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "label": "for z", "type": "for", "loc": [392, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "vector": [6, 2, 0.8797, 0.0156, 2, 0.26, 0.6667, 859, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for z in self.z_hist_bins:\n indices = copy.copy(self.voi_pts_indices)\n pts = self.voi_pts \n conditions = np.multiply(pts[2] < z, pts[2] > last_z)\n indices = indices[np.where(conditions)[0]] \n slices += [indices]\n last_z = z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L393_C12", "label": "indices = copy()", "type": "assigned_variable", "loc": [393, 393], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "vector": [14, 3, 0.8753, 0.0022, 3, 0.07, 0.0, 478, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " indices = copy.copy(self.voi_pts_indices)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L394_C12", "label": "pts =", "type": "assigned_variable", "loc": [394, 394], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "vector": [14, 3, 0.8775, 0.0022, 3, 0.07, 0.25, 195, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts = self.voi_pts "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L395_C12", "label": "conditions = multiply()", "type": "assigned_variable", "loc": [395, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "vector": [14, 3, 0.8797, 0.0022, 3, 0.07, 0.5, 876, 3, 2, 0, 0, 960, 10, 1], "semantic": {"name": "conditions", "arg_names": [], "import_names": [], "rhs_call_name": "multiply", "annotation": ""}, "snippet": " conditions = np.multiply(pts[2] < z, pts[2] > last_z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L396_C12", "label": "indices =", "type": "assigned_variable", "loc": [396, 396], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "vector": [14, 3, 0.882, 0.0022, 3, 0.07, 0.75, 478, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " indices = indices[np.where(conditions)[0]] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L398_C12", "label": "last_z =", "type": "assigned_variable", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "vector": [14, 3, 0.8864, 0.0022, 3, 0.07, 1.0, 590, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_z = z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L399_C8", "label": "return", "type": "return", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "vector": [13, 2, 0.8886, 0.0022, 2, 0.26, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return slices"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L401_C4", "label": "get_voi_histogram_value", "type": "function", "loc": [401, 409], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.902, 0.02, 1, 0.37, 0.7, 987, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_voi_histogram_value", "arg_names": ["self", "point"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_voi_histogram_value(self, point):\n z = point[2]\n z = int(z*self.voi_bincount / float(self.voi_interval_size))\n if z >= 0 and z < self.voi_bincount:\n # print z, self.z_hist[z]\n return self.z_hist[z]\n else:\n #print z,0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L402_C8", "label": "z =", "type": "assigned_variable", "loc": [402, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L401_C4", "vector": [14, 2, 0.8953, 0.0022, 2, 0.88, 0.0, 859, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " z = point[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L403_C8", "label": "z = int()", "type": "assigned_variable", "loc": [403, 403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L401_C4", "vector": [14, 2, 0.8976, 0.0022, 2, 0.88, 0.5, 859, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " z = int(z*self.voi_bincount / float(self.voi_interval_size))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L404_C8", "label": "if", "type": "if", "loc": [404, 409], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L401_C4", "vector": [4, 2, 0.9053, 0.0134, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if z >= 0 and z < self.voi_bincount:\n # print z, self.z_hist[z]\n return self.z_hist[z]\n else:\n #print z,0\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L406_C12", "label": "return", "type": "return", "loc": [406, 406], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L404_C8", "vector": [13, 3, 0.9042, 0.0022, 3, 0.1, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.z_hist[z]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L409_C12", "label": "return", "type": "return", "loc": [409, 409], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L404_C8", "vector": [13, 3, 0.9109, 0.0022, 3, 0.1, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L411_C4", "label": "get_voi_histogram_spread", "type": "function", "loc": [411, 424], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.9298, 0.0312, 1, 0.37, 0.8, 369, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_voi_histogram_spread", "arg_names": ["self", "point"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_voi_histogram_spread(self, point):\n z = point[2]\n z = int(z*self.voi_bincount / float(self.voi_interval_size))\n if z >= 0 and z < self.voi_bincount:\n# indices = self.z_hist_slices_indices[z]\n# a = self.processor.pts3d_bound[:,indices]\n# u, ev12 = gaussian_curvature.spread(a)\n# if abs(self.z_hist_spread[z][0] - ev12[0]) > 0.0000000001 or abs(self.z_hist_spread[z][1] - ev12[1]) > 0.0000000001:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L412_C8", "label": "z =", "type": "assigned_variable", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L411_C4", "vector": [14, 2, 0.9176, 0.0022, 2, 0.83, 0.0, 859, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " z = point[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L413_C8", "label": "z = int()", "type": "assigned_variable", "loc": [413, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L411_C4", "vector": [14, 2, 0.9198, 0.0022, 2, 0.83, 0.5, 859, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " z = int(z*self.voi_bincount / float(self.voi_interval_size))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L414_C8", "label": "if", "type": "if", "loc": [414, 424], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L411_C4", "vector": [4, 2, 0.9332, 0.0245, 2, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if z >= 0 and z < self.voi_bincount:\n# indices = self.z_hist_slices_indices[z]\n# a = self.processor.pts3d_bound[:,indices]\n# u, ev12 = gaussian_curvature.spread(a)\n# if abs(self.z_hist_spread[z][0] - ev12[0]) > 0.0000000001 or abs(self.z_hist_spread[z][1] - ev12[1]) > 0.0000000001:\n# print 'ERROR', self.z_hist_spread[z], '!=', (ev12[0], ev12[1])\n# return ev12[0], ev12[1]\n return self.z_hist_spread[z]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L421_C12", "label": "return", "type": "return", "loc": [421, 421], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L414_C8", "vector": [13, 3, 0.9376, 0.0022, 3, 0.42, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.z_hist_spread[z]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L424_C12", "label": "return", "type": "return", "loc": [424, 424], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L414_C8", "vector": [13, 3, 0.9443, 0.0022, 3, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0, 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L427_C4", "label": "get_voi_hsi_histogram_values", "type": "function", "loc": [427, 444], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.9699, 0.0401, 1, 0.37, 0.9, 393, 0, 5, 1, 0, 0, 0, 5], "semantic": {"name": "get_voi_hsi_histogram_values", "arg_names": ["self", "point", "h", "s", "i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_voi_hsi_histogram_values(self, point,h ,s, i):\n z = point[2]\n z = int(z*self.voi_bincount / float(self.voi_interval_size))\n if z >= 0 and z < self.voi_bincount:\n h_index = int(h * self.hsi_hist_bincount / 255.0)\n s_index = int(s * self.hsi_hist_bincount / 255.0)\n i *= self.intensity_normalization_factor\n i_index = int(i * self.hsi_hist_bincount / 255.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L428_C8", "label": "z =", "type": "assigned_variable", "loc": [428, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L427_C4", "vector": [14, 2, 0.9532, 0.0022, 2, 0.64, 0.0, 859, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " z = point[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L429_C8", "label": "z = int()", "type": "assigned_variable", "loc": [429, 429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L427_C4", "vector": [14, 2, 0.9555, 0.0022, 2, 0.64, 0.5, 859, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " z = int(z*self.voi_bincount / float(self.voi_interval_size))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "label": "if", "type": "if", "loc": [430, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L427_C4", "vector": [4, 2, 0.9733, 0.0334, 2, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if z >= 0 and z < self.voi_bincount:\n h_index = int(h * self.hsi_hist_bincount / 255.0)\n s_index = int(s * self.hsi_hist_bincount / 255.0)\n i *= self.intensity_normalization_factor\n i_index = int(i * self.hsi_hist_bincount / 255.0)\n \n h_hist = self.z_hist_h_hists[z][h_index]\n s_hist = self.z_hist_s_hists[z][s_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L431_C12", "label": "h_index = int()", "type": "assigned_variable", "loc": [431, 431], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "vector": [14, 3, 0.9599, 0.0022, 3, 0.04, 0.0, 401, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "h_index", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " h_index = int(h * self.hsi_hist_bincount / 255.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L432_C12", "label": "s_index = int()", "type": "assigned_variable", "loc": [432, 432], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "vector": [14, 3, 0.9621, 0.0022, 3, 0.04, 0.1429, 875, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "s_index", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " s_index = int(s * self.hsi_hist_bincount / 255.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L434_C12", "label": "i_index = int()", "type": "assigned_variable", "loc": [434, 434], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "vector": [14, 3, 0.9666, 0.0022, 3, 0.04, 0.2857, 452, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "i_index", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " i_index = int(i * self.hsi_hist_bincount / 255.0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L436_C12", "label": "h_hist =", "type": "assigned_variable", "loc": [436, 436], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "vector": [14, 3, 0.971, 0.0022, 3, 0.04, 0.4286, 148, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h_hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_hist = self.z_hist_h_hists[z][h_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L437_C12", "label": "s_hist =", "type": "assigned_variable", "loc": [437, 437], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "vector": [14, 3, 0.9733, 0.0022, 3, 0.04, 0.5714, 800, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s_hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s_hist = self.z_hist_s_hists[z][s_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L440_C12", "label": "i_hist =", "type": "assigned_variable", "loc": [440, 440], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "vector": [14, 3, 0.98, 0.0022, 3, 0.04, 0.7143, 663, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i_hist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i_hist = self.z_hist_i_hists[z][i_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L441_C12", "label": "return", "type": "return", "loc": [441, 441], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "vector": [13, 3, 0.9822, 0.0022, 3, 0.04, 0.8571, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return h_hist, s_hist, i_hist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L444_C12", "label": "return", "type": "return", "loc": [444, 444], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "vector": [13, 3, 0.9889, 0.0022, 3, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0, 0, 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L446_C4", "label": "get_voi_maxcount_height", "type": "function", "loc": [446, 447], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "vector": [2, 1, 0.9944, 0.0045, 1, 0.37, 1.0, 837, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_voi_maxcount_height", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_voi_maxcount_height(self):\n return self.z_hist_height_max"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L447_C8", "label": "return", "type": "return", "loc": [447, 447], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L446_C4", "vector": [13, 2, 0.9955, 0.0022, 2, 0.5, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.z_hist_height_max"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L74_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L76_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L77_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L82_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L85_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L86_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L80_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L87_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L87_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L88_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L101_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L107_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L107_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L108_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L162_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L163_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L165_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L166_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L169_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L170_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L172_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L173_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L181_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L229_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L231_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L269_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L270_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L269_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L294_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L304_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L309_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L310_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L309_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L312_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L322_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L324_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L324_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L325_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L328_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L329_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L328_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L344_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L345_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L344_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L346_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L346_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L347_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L346_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L348_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L356_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L357_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L358_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L359_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L362_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L364_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L366_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L367_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L368_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L369_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L354_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Expr_L371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L378_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L380_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L384_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L377_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L389_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L390_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L393_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L394_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L395_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L396_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:For_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L387_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L401_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L406_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L409_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L411_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L421_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L424_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L427_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L427_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L428_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L427_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L429_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L427_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L431_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L432_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L434_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L436_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L437_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Assign_L440_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L441_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L444_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L446_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99495:FunctionDef_L446_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99495:Return_L447_C8"}] |
from _direction import *
| ajibawa-2023/Python-Code-Large/train/row_99500 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99500:ImportFrom_L1_C0", "label": "from _direction import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 390, 0, 1, 0, 0, 390, 0, 0], "semantic": {"name": "_direction", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from _direction import *"}] | [] |
#! /usr/bin/python
#
# Copyright (c) 2009, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Travis Deyle and Kelsey Hawkins (Healthcare Robotics Lab, Georgia Tech.)
GRASP_LOCATION = [ 0.50, -0.30, 0.00]
PLACE_LOCATIONS = [[ 0.58, 0.13, 0.00],
[ 0.58, 0.21, 0.00],
[ 0.58, 0.29, 0.00]]
import sys
import roslib
roslib.load_manifest('hrl_pr2_experiments')
import rospy
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
import tf.transformations as tft
from pr2_grasp_behaviors.msg import OverheadGraspAction, OverheadGraspSetupAction
from pr2_grasp_behaviors.msg import OverheadGraspGoal, OverheadGraspSetupGoal
from pr2_controllers_msgs.msg import SingleJointPositionAction, SingleJointPositionGoal
from hrl_trajectory_playback.srv import TrajPlaybackSrv, TrajPlaybackSrvRequest
# Overhead grasping requres:
# run: hrl_pr2_gains/change_gains_grasp.sh
# roslaunch pr2_grasping_behaviors overhead_grasping_server_trained.launch
class NTries(smach.State):
def __init__(self, n):
smach.State.__init__(self, outcomes=['succeeded', 'aborted'],
output_keys=['ntries_counter'])
self.counter = 0
self.n = n
def execute(self, userdata):
self.counter += 1
userdata.ntries_counter = self.counter
if self.counter <= self.n:
rospy.logout( 'Executing NTries: On #%d of %d' % (self.counter, self.n))
return 'succeeded'
else:
return 'aborted'
def sm_grasp():
if len(sys.argv) < 2 or sys.argv[1] not in ['r', 'l']:
print "First arg should be 'r' or 'l'"
return None
arm = sys.argv[1]
if arm == 'r':
arm_mult = 1
else:
arm_mult = -1
# Create a SMACH state machine
sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'])
with sm:
# Setup arm pose (out of way for perception)
tgoal = SingleJointPositionGoal()
#tgoal.position = 0.190 # all the way up is 0.200
tgoal.position = 0.210 # all the way up is 0.200
tgoal.min_duration = rospy.Duration( 2.0 )
tgoal.max_velocity = 1.0
smach.StateMachine.add(
'TORSO_SETUP',
SimpleActionState( 'torso_controller/position_joint_action',
SingleJointPositionAction,
goal = tgoal),
transitions = { 'succeeded': 'ARM_UNTUCK' })
smach.StateMachine.add(
'ARM_UNTUCK',
ServiceState('traj_playback/' + arm + '_arm_untuck', TrajPlaybackSrv),
transitions = { 'succeeded': 'GRASP_BEGIN_SETUP' })
# Setup arm pose (out of way for perception)
smach.StateMachine.add(
'GRASP_BEGIN_SETUP',
SimpleActionState( arm + '_overhead_grasp_setup',
OverheadGraspSetupAction,
goal = OverheadGraspSetupGoal()),
transitions = { 'succeeded': 'DEMO_START' })
@smach.cb_interface(outcomes=['succeeded'])
def wait_for_enter(ud):
raw_input("Press enter to begin cleanup demo.")
return 'succeeded'
smach.StateMachine.add(
'DEMO_START',
smach.CBState(wait_for_enter),
transitions = {'succeeded': 'THREE_OBJECTS'})
# We will pick up 3 objects.
smach.StateMachine.add(
'THREE_OBJECTS',
NTries( 3 ),
transitions = {'succeeded':'THREE_TRIES',
'aborted':'RESET_ARMS'},
remapping={'ntries_counter':'object_number'})
# We will run the grasper at most 3 times.
grasp_tries = NTries( 3 )
smach.StateMachine.add(
'THREE_TRIES',
grasp_tries,
transitions = {'succeeded':'GRASP_SETUP',
'aborted':'aborted'})
# Setup arm pose (out of way for perception)
smach.StateMachine.add(
'GRASP_SETUP',
SimpleActionState( arm + '_overhead_grasp_setup',
OverheadGraspSetupAction,
goal = OverheadGraspSetupGoal()),
transitions = { 'succeeded': 'GRASP' })
def grasp_goal_cb(userdata, goal):
############################################################
# Creating grasp goal
grasp_goal = OverheadGraspGoal()
grasp_goal.is_grasp = True
grasp_goal.disable_head = False
grasp_goal.disable_coll = False
grasp_goal.grasp_type = OverheadGraspGoal.VISION_GRASP
grasp_goal.x = GRASP_LOCATION[0]
grasp_goal.y = arm_mult * GRASP_LOCATION[1]
grasp_goal.behavior_name = "overhead_grasp"
grasp_goal.sig_level = 0.999
############################################################
return grasp_goal
smach.StateMachine.add(
'GRASP',
SimpleActionState( arm + '_overhead_grasp',
OverheadGraspAction,
goal_cb = grasp_goal_cb),
transitions = { 'succeeded': 'PLACE',
'aborted':'THREE_TRIES' })
def place_goal_cb(userdata, goal):
print "object Number", userdata.object_number
############################################################
# Creating place place_goal
place_goal = OverheadGraspGoal()
place_goal.is_grasp = False
place_goal.disable_head = False
place_goal.disable_coll = False
place_goal.grasp_type = OverheadGraspGoal.MANUAL_GRASP
place_goal.x = PLACE_LOCATIONS[userdata.object_number-1][0]
place_goal.y = arm_mult * PLACE_LOCATIONS[userdata.object_number-1][1]
place_goal.roll = PLACE_LOCATIONS[userdata.object_number-1][2]
place_goal.behavior_name = "overhead_grasp"
place_goal.sig_level = 0.999
############################################################
return place_goal
def clear_grasp_tries(userdata, status, result):
grasp_tries.counter = 0
smach.StateMachine.add(
'PLACE',
SimpleActionState( arm + '_overhead_grasp',
OverheadGraspAction,
goal_cb = place_goal_cb,
result_cb = clear_grasp_tries,
input_keys = ['object_number']),
transitions = { 'succeeded': 'THREE_OBJECTS',
'aborted':'THREE_OBJECTS' })
# Setup arm pose (out of way for perception)
smach.StateMachine.add(
'RESET_ARMS',
SimpleActionState( arm + '_overhead_grasp_setup',
OverheadGraspSetupAction,
goal = OverheadGraspSetupGoal()),
transitions = { 'succeeded': 'ARM_TUCK' })
smach.StateMachine.add(
'ARM_TUCK',
ServiceState('traj_playback/' + arm + '_arm_untuck', TrajPlaybackSrv,
request=TrajPlaybackSrvRequest(True)),
transitions = { 'succeeded': 'succeeded' })
return sm
if __name__ == '__main__':
rospy.init_node('smach_sm_grasp')
sm = sm_grasp()
sis = IntrospectionServer('Grasp Cleanup', sm, '/SM_GRASP_CLEANUP')
sis.start()
outcome = sm.execute()
sis.stop()
| ajibawa-2023/Python-Code-Large/train/row_99501 | 87 | 230 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L31_C0", "label": "GRASP_LOCATION =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.1348, 0.0043, 0, 0.66, 0.0, 861, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "GRASP_LOCATION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GRASP_LOCATION = [ 0.50, -0.30, 0.00]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L32_C0", "label": "PLACE_LOCATIONS =", "type": "assigned_variable", "loc": [32, 34], "level": 0, "parent": null, "vector": [14, 0, 0.1435, 0.013, 0, 0.66, 0.0625, 458, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "PLACE_LOCATIONS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PLACE_LOCATIONS = [[ 0.58, 0.13, 0.00],\n [ 0.58, 0.21, 0.00],\n [ 0.58, 0.29, 0.00]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Import_L36_C0", "label": "sys import sys", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.1565, 0.0043, 0, 0.66, 0.125, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Import_L38_C0", "label": "roslib import roslib", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.1652, 0.0043, 0, 0.66, 0.1875, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L39_C0", "label": "load_manifest()", "type": "expression", "loc": [39, 39], "level": 0, "parent": null, "vector": [8, 0, 0.1696, 0.0043, 0, 0.66, 0.25, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_pr2_experiments')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Import_L40_C0", "label": "rospy import rospy", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.1739, 0.0043, 0, 0.66, 0.3125, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Import_L42_C0", "label": "smach import smach", "type": "import", "loc": [42, 42], "level": 0, "parent": null, "vector": [1, 0, 0.1826, 0.0043, 0, 0.66, 0.375, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:ImportFrom_L43_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [43, 43], "level": 0, "parent": null, "vector": [1, 0, 0.187, 0.0043, 0, 0.66, 0.4375, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Import_L44_C0", "label": "actionlib import actionlib", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.1913, 0.0043, 0, 0.66, 0.5, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Import_L45_C0", "label": "tf.transformations import tft", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.1957, 0.0043, 0, 0.66, 0.5625, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tft"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tft"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:ImportFrom_L47_C0", "label": "from pr2_grasp_behaviors.msg import OverheadGraspAction, OverheadGraspSetupAction", "type": "import", "loc": [47, 47], "level": 0, "parent": null, "vector": [1, 0, 0.2043, 0.0043, 0, 0.66, 0.625, 212, 0, 2, 0, 0, 212, 0, 0], "semantic": {"name": "pr2_grasp_behaviors.msg", "arg_names": [], "import_names": ["OverheadGraspAction", "OverheadGraspSetupAction"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pr2_grasp_behaviors.msg import OverheadGraspAction, OverheadGraspSetupAction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:ImportFrom_L48_C0", "label": "from pr2_grasp_behaviors.msg import OverheadGraspGoal, OverheadGraspSetupGoal", "type": "import", "loc": [48, 48], "level": 0, "parent": null, "vector": [1, 0, 0.2087, 0.0043, 0, 0.66, 0.6875, 212, 0, 2, 0, 0, 212, 0, 0], "semantic": {"name": "pr2_grasp_behaviors.msg", "arg_names": [], "import_names": ["OverheadGraspGoal", "OverheadGraspSetupGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pr2_grasp_behaviors.msg import OverheadGraspGoal, OverheadGraspSetupGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:ImportFrom_L49_C0", "label": "from pr2_controllers_msgs.msg import SingleJointPositionAction, SingleJointPositionGoal", "type": "import", "loc": [49, 49], "level": 0, "parent": null, "vector": [1, 0, 0.213, 0.0043, 0, 0.66, 0.75, 457, 0, 2, 0, 0, 457, 0, 0], "semantic": {"name": "pr2_controllers_msgs.msg", "arg_names": [], "import_names": ["SingleJointPositionAction", "SingleJointPositionGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pr2_controllers_msgs.msg import SingleJointPositionAction, SingleJointPositionGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:ImportFrom_L50_C0", "label": "from hrl_trajectory_playback.srv import TrajPlaybackSrv, TrajPlaybackSrvRequest", "type": "import", "loc": [50, 50], "level": 0, "parent": null, "vector": [1, 0, 0.2174, 0.0043, 0, 0.66, 0.8125, 12, 0, 2, 0, 0, 12, 0, 0], "semantic": {"name": "hrl_trajectory_playback.srv", "arg_names": [], "import_names": ["TrajPlaybackSrv", "TrajPlaybackSrvRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_trajectory_playback.srv import TrajPlaybackSrv, TrajPlaybackSrvRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:ClassDef_L56_C0", "label": "NTries", "type": "class", "loc": [56, 71], "level": 0, "parent": null, "vector": [3, 0, 0.2761, 0.0696, 0, 0.66, 0.875, 738, 0, 2, 0, 0, 892, 0, 2], "semantic": {"name": "NTries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NTries(smach.State):\n def __init__(self, n):\n smach.State.__init__(self, outcomes=['succeeded', 'aborted'],\n output_keys=['ntries_counter'])\n self.counter = 0\n self.n = n\n\n def execute(self, userdata):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L57_C4", "label": "__init__", "type": "function", "loc": [57, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:ClassDef_L56_C0", "vector": [2, 1, 0.2565, 0.0217, 1, 0.32, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "n"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, n):\n smach.State.__init__(self, outcomes=['succeeded', 'aborted'],\n output_keys=['ntries_counter'])\n self.counter = 0\n self.n = n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L58_C8", "label": "__init__()", "type": "expression", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L57_C4", "vector": [8, 2, 0.2543, 0.0087, 2, 0.42, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self, outcomes=['succeeded', 'aborted'],\n output_keys=['ntries_counter'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L60_C8", "label": "self.counter =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L57_C4", "vector": [14, 2, 0.2609, 0.0043, 2, 0.42, 0.5, 785, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L61_C8", "label": "self.n =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L57_C4", "vector": [14, 2, 0.2652, 0.0043, 2, 0.42, 1.0, 172, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.n", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.n = n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L63_C4", "label": "execute", "type": "function", "loc": [63, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:ClassDef_L56_C0", "vector": [2, 1, 0.2913, 0.0391, 1, 0.32, 1.0, 569, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n self.counter += 1\n userdata.ntries_counter = self.counter\n\n if self.counter <= self.n:\n rospy.logout( 'Executing NTries: On #%d of %d' % (self.counter, self.n))\n return 'succeeded'\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L65_C8", "label": "userdata.ntries_counter =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L63_C4", "vector": [14, 2, 0.2826, 0.0043, 2, 0.35, 0.0, 728, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.ntries_counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.ntries_counter = self.counter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L67_C8", "label": "if", "type": "if", "loc": [67, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L63_C4", "vector": [4, 2, 0.3, 0.0217, 2, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.counter <= self.n:\n rospy.logout( 'Executing NTries: On #%d of %d' % (self.counter, self.n))\n return 'succeeded'\n else:\n return 'aborted'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L68_C12", "label": "logout()", "type": "expression", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L67_C8", "vector": [8, 3, 0.2957, 0.0043, 3, 0.59, 0.0, 525, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "logout", "annotation": ""}, "snippet": " rospy.logout( 'Executing NTries: On #%d of %d' % (self.counter, self.n))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L69_C12", "label": "return", "type": "return", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L67_C8", "vector": [13, 3, 0.3, 0.0043, 3, 0.59, 0.5, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L71_C12", "label": "return", "type": "return", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L67_C8", "vector": [13, 3, 0.3087, 0.0043, 3, 0.59, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'aborted'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "label": "sm_grasp", "type": "function", "loc": [73, 213], "level": 0, "parent": null, "vector": [2, 0, 0.6217, 0.613, 0, 0.66, 0.9375, 619, 0, 0, 1, 0, 0, 0, 36], "semantic": {"name": "sm_grasp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sm_grasp():\n if len(sys.argv) < 2 or sys.argv[1] not in ['r', 'l']:\n print(\"First arg should be 'r' or 'l'\")\n return None\n arm = sys.argv[1]\n if arm == 'r':\n arm_mult = 1\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L74_C4", "label": "if", "type": "if", "loc": [74, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [4, 1, 0.3261, 0.013, 1, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) < 2 or sys.argv[1] not in ['r', 'l']:\n print(\"First arg should be 'r' or 'l'\")\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L75_C8", "label": "print()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L74_C4", "vector": [8, 2, 0.3261, 0.0043, 2, 0.45, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"First arg should be 'r' or 'l'\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L76_C8", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L74_C4", "vector": [13, 2, 0.3304, 0.0043, 2, 0.45, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L77_C4", "label": "arm =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [14, 1, 0.3348, 0.0043, 1, 0.53, 0.25, 413, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "arm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arm = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L78_C4", "label": "if", "type": "if", "loc": [78, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [4, 1, 0.3457, 0.0174, 1, 0.53, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if arm == 'r':\n arm_mult = 1\n else:\n arm_mult = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L79_C8", "label": "arm_mult =", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L78_C4", "vector": [14, 2, 0.3435, 0.0043, 2, 0.7, 0.0, 988, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "arm_mult", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arm_mult = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L81_C8", "label": "arm_mult =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L78_C4", "vector": [14, 2, 0.3522, 0.0043, 2, 0.7, 1.0, 988, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "arm_mult", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arm_mult = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L84_C4", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [14, 1, 0.3652, 0.0043, 1, 0.53, 0.75, 21, 3, 1, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine(outcomes=['succeeded','aborted','preempted'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L88_C8", "label": "tgoal = SingleJointPositionGoal()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [14, 1, 0.3826, 0.0043, 1, 0.53, 0.0, 454, 3, 0, 0, 0, 974, 10, 1], "semantic": {"name": "tgoal", "arg_names": [], "import_names": [], "rhs_call_name": "SingleJointPositionGoal", "annotation": ""}, "snippet": " tgoal = SingleJointPositionGoal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L90_C8", "label": "tgoal.position =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [14, 1, 0.3913, 0.0043, 1, 0.53, 0.0526, 731, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "tgoal.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tgoal.position = 0.210 # all the way up is 0.200"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L91_C8", "label": "tgoal.min_duration = Duration()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [14, 1, 0.3957, 0.0043, 1, 0.53, 0.1053, 779, 3, 1, 0, 0, 972, 10, 1], "semantic": {"name": "tgoal.min_duration", "arg_names": [], "import_names": [], "rhs_call_name": "Duration", "annotation": ""}, "snippet": " tgoal.min_duration = rospy.Duration( 2.0 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L92_C8", "label": "tgoal.max_velocity =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [14, 1, 0.4, 0.0043, 1, 0.53, 0.1579, 590, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "tgoal.max_velocity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tgoal.max_velocity = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L93_C8", "label": "add()", "type": "expression", "loc": [93, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.4152, 0.0261, 1, 0.53, 0.2105, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'TORSO_SETUP',\n SimpleActionState( 'torso_controller/position_joint_action',\n SingleJointPositionAction,\n goal = tgoal),\n transitions = { 'succeeded': 'ARM_UNTUCK' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L100_C8", "label": "add()", "type": "expression", "loc": [100, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.4413, 0.0174, 1, 0.53, 0.2632, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'ARM_UNTUCK',\n ServiceState('traj_playback/' + arm + '_arm_untuck', TrajPlaybackSrv),\n transitions = { 'succeeded': 'GRASP_BEGIN_SETUP' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L106_C8", "label": "add()", "type": "expression", "loc": [106, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.4717, 0.0261, 1, 0.53, 0.3158, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'GRASP_BEGIN_SETUP',\n SimpleActionState( arm + '_overhead_grasp_setup',\n OverheadGraspSetupAction,\n goal = OverheadGraspSetupGoal()), \n transitions = { 'succeeded': 'DEMO_START' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L114_C8", "label": "wait_for_enter", "type": "function", "loc": [114, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [2, 1, 0.5, 0.013, 1, 0.53, 0.3684, 262, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "wait_for_enter", "arg_names": ["ud"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wait_for_enter(ud):\n raw_input(\"Press enter to begin cleanup demo.\")\n return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L115_C12", "label": "raw_input()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L114_C8", "vector": [8, 2, 0.5, 0.0043, 2, 0.45, 0.0, 821, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "raw_input", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " raw_input(\"Press enter to begin cleanup demo.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L116_C12", "label": "return", "type": "return", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L114_C8", "vector": [13, 2, 0.5043, 0.0043, 2, 0.45, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L117_C8", "label": "add()", "type": "expression", "loc": [117, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.5152, 0.0174, 1, 0.53, 0.4211, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'DEMO_START',\n smach.CBState(wait_for_enter),\n transitions = {'succeeded': 'THREE_OBJECTS'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L123_C8", "label": "add()", "type": "expression", "loc": [123, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.5457, 0.0261, 1, 0.53, 0.4737, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'THREE_OBJECTS',\n NTries( 3 ),\n transitions = {'succeeded':'THREE_TRIES',\n 'aborted':'RESET_ARMS'},\n remapping={'ntries_counter':'object_number'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L131_C8", "label": "grasp_tries = NTries()", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [14, 1, 0.5696, 0.0043, 1, 0.53, 0.5263, 203, 3, 1, 0, 0, 738, 10, 1], "semantic": {"name": "grasp_tries", "arg_names": [], "import_names": [], "rhs_call_name": "NTries", "annotation": ""}, "snippet": " grasp_tries = NTries( 3 )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L132_C8", "label": "add()", "type": "expression", "loc": [132, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.5826, 0.0217, 1, 0.53, 0.5789, 241, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'THREE_TRIES',\n grasp_tries,\n transitions = {'succeeded':'GRASP_SETUP',\n 'aborted':'aborted'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L139_C8", "label": "add()", "type": "expression", "loc": [139, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.6152, 0.0261, 1, 0.53, 0.6316, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'GRASP_SETUP',\n SimpleActionState( arm + '_overhead_grasp_setup',\n OverheadGraspSetupAction,\n goal = OverheadGraspSetupGoal()), \n transitions = { 'succeeded': 'GRASP' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "label": "grasp_goal_cb", "type": "function", "loc": [146, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [2, 1, 0.663, 0.0609, 1, 0.53, 0.6842, 610, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "grasp_goal_cb", "arg_names": ["userdata", "goal"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def grasp_goal_cb(userdata, goal):\n ############################################################\n # Creating grasp goal\n grasp_goal = OverheadGraspGoal()\n grasp_goal.is_grasp = True\n grasp_goal.disable_head = False\n grasp_goal.disable_coll = False\n grasp_goal.grasp_type = OverheadGraspGoal.VISION_GRASP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L149_C12", "label": "grasp_goal = OverheadGraspGoal()", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6478, 0.0043, 2, 0.48, 0.0, 379, 3, 0, 0, 0, 708, 10, 1], "semantic": {"name": "grasp_goal", "arg_names": [], "import_names": [], "rhs_call_name": "OverheadGraspGoal", "annotation": ""}, "snippet": " grasp_goal = OverheadGraspGoal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L150_C12", "label": "grasp_goal.is_grasp =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6522, 0.0043, 2, 0.48, 0.1111, 664, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "grasp_goal.is_grasp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_goal.is_grasp = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L151_C12", "label": "grasp_goal.disable_head =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6565, 0.0043, 2, 0.48, 0.2222, 201, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "grasp_goal.disable_head", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_goal.disable_head = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L152_C12", "label": "grasp_goal.disable_coll =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6609, 0.0043, 2, 0.48, 0.3333, 986, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "grasp_goal.disable_coll", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_goal.disable_coll = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L153_C12", "label": "grasp_goal.grasp_type =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6652, 0.0043, 2, 0.48, 0.4444, 872, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "grasp_goal.grasp_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_goal.grasp_type = OverheadGraspGoal.VISION_GRASP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L154_C12", "label": "grasp_goal.x =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6696, 0.0043, 2, 0.48, 0.5556, 218, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "grasp_goal.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_goal.x = GRASP_LOCATION[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L155_C12", "label": "grasp_goal.y =", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6739, 0.0043, 2, 0.48, 0.6667, 559, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "grasp_goal.y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_goal.y = arm_mult * GRASP_LOCATION[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L156_C12", "label": "grasp_goal.behavior_name =", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6783, 0.0043, 2, 0.48, 0.7778, 681, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "grasp_goal.behavior_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_goal.behavior_name = \"overhead_grasp\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L157_C12", "label": "grasp_goal.sig_level =", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [14, 2, 0.6826, 0.0043, 2, 0.48, 0.8889, 16, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "grasp_goal.sig_level", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_goal.sig_level = 0.999"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L159_C12", "label": "return", "type": "return", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "vector": [13, 2, 0.6913, 0.0043, 2, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return grasp_goal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L161_C8", "label": "add()", "type": "expression", "loc": [161, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.713, 0.0304, 1, 0.53, 0.7368, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'GRASP',\n SimpleActionState( arm + '_overhead_grasp',\n OverheadGraspAction,\n goal_cb = grasp_goal_cb),\n transitions = { 'succeeded': 'PLACE',\n 'aborted':'THREE_TRIES' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "label": "place_goal_cb", "type": "function", "loc": [169, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [2, 1, 0.7674, 0.0696, 1, 0.53, 0.7895, 85, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "place_goal_cb", "arg_names": ["userdata", "goal"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def place_goal_cb(userdata, goal):\n print(\"object Number\", userdata.object_number)\n ############################################################\n # Creating place place_goal\n place_goal = OverheadGraspGoal()\n place_goal.is_grasp = False\n place_goal.disable_head = False\n place_goal.disable_coll = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L170_C12", "label": "print()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [8, 2, 0.7391, 0.0043, 2, 0.98, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"object Number\", userdata.object_number)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L173_C12", "label": "place_goal = OverheadGraspGoal()", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7522, 0.0043, 2, 0.98, 0.0909, 450, 3, 0, 0, 0, 708, 10, 1], "semantic": {"name": "place_goal", "arg_names": [], "import_names": [], "rhs_call_name": "OverheadGraspGoal", "annotation": ""}, "snippet": " place_goal = OverheadGraspGoal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L174_C12", "label": "place_goal.is_grasp =", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7565, 0.0043, 2, 0.98, 0.1818, 331, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "place_goal.is_grasp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.is_grasp = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L175_C12", "label": "place_goal.disable_head =", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7609, 0.0043, 2, 0.98, 0.2727, 207, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "place_goal.disable_head", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.disable_head = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L176_C12", "label": "place_goal.disable_coll =", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7652, 0.0043, 2, 0.98, 0.3636, 239, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "place_goal.disable_coll", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.disable_coll = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L177_C12", "label": "place_goal.grasp_type =", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7696, 0.0043, 2, 0.98, 0.4545, 681, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "place_goal.grasp_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.grasp_type = OverheadGraspGoal.MANUAL_GRASP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L178_C12", "label": "place_goal.x =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7739, 0.0043, 2, 0.98, 0.5455, 663, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "place_goal.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.x = PLACE_LOCATIONS[userdata.object_number-1][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L179_C12", "label": "place_goal.y =", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7783, 0.0043, 2, 0.98, 0.6364, 340, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "place_goal.y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.y = arm_mult * PLACE_LOCATIONS[userdata.object_number-1][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L180_C12", "label": "place_goal.roll =", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7826, 0.0043, 2, 0.98, 0.7273, 167, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "place_goal.roll", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.roll = PLACE_LOCATIONS[userdata.object_number-1][2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L181_C12", "label": "place_goal.behavior_name =", "type": "assigned_variable", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.787, 0.0043, 2, 0.98, 0.8182, 225, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "place_goal.behavior_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.behavior_name = \"overhead_grasp\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L182_C12", "label": "place_goal.sig_level =", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [14, 2, 0.7913, 0.0043, 2, 0.98, 0.9091, 917, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "place_goal.sig_level", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " place_goal.sig_level = 0.999"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L184_C12", "label": "return", "type": "return", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "vector": [13, 2, 0.8, 0.0043, 2, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return place_goal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L186_C8", "label": "clear_grasp_tries", "type": "function", "loc": [186, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [2, 1, 0.8109, 0.0087, 1, 0.53, 0.8421, 661, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "clear_grasp_tries", "arg_names": ["userdata", "status", "result"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clear_grasp_tries(userdata, status, result):\n grasp_tries.counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L187_C12", "label": "grasp_tries.counter =", "type": "assigned_variable", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L186_C8", "vector": [14, 2, 0.813, 0.0043, 2, 0.64, 0.0, 316, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "grasp_tries.counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " grasp_tries.counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L189_C8", "label": "add()", "type": "expression", "loc": [189, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.8391, 0.0391, 1, 0.53, 0.8947, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'PLACE',\n SimpleActionState( arm + '_overhead_grasp',\n OverheadGraspAction,\n goal_cb = place_goal_cb,\n result_cb = clear_grasp_tries,\n input_keys = ['object_number']),\n transitions = { 'succeeded': 'THREE_OBJECTS',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L200_C8", "label": "add()", "type": "expression", "loc": [200, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.8804, 0.0261, 1, 0.53, 0.9474, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'RESET_ARMS',\n SimpleActionState( arm + '_overhead_grasp_setup',\n OverheadGraspSetupAction,\n goal = OverheadGraspSetupGoal()), \n transitions = { 'succeeded': 'ARM_TUCK' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L207_C8", "label": "add()", "type": "expression", "loc": [207, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [8, 1, 0.9087, 0.0217, 1, 0.53, 1.0, 241, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'ARM_TUCK',\n ServiceState('traj_playback/' + arm + '_arm_untuck', TrajPlaybackSrv,\n request=TrajPlaybackSrvRequest(True)),\n transitions = { 'succeeded': 'succeeded' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L213_C4", "label": "return", "type": "return", "loc": [213, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "vector": [13, 1, 0.9261, 0.0043, 1, 0.53, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "label": "if", "type": "if", "loc": [217, 227], "level": 0, "parent": null, "vector": [4, 0, 0.9652, 0.0478, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n rospy.init_node('smach_sm_grasp')\n\n sm = sm_grasp()\n\n sis = IntrospectionServer('Grasp Cleanup', sm, '/SM_GRASP_CLEANUP')\n sis.start()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L218_C4", "label": "init_node()", "type": "expression", "loc": [218, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "vector": [8, 1, 0.9478, 0.0043, 1, 0.87, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('smach_sm_grasp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L220_C4", "label": "sm = sm_grasp()", "type": "assigned_variable", "loc": [220, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "vector": [14, 1, 0.9565, 0.0043, 1, 0.87, 0.2, 21, 3, 0, 0, 0, 619, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "sm_grasp", "annotation": ""}, "snippet": " sm = sm_grasp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L222_C4", "label": "sis = IntrospectionServer()", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "vector": [14, 1, 0.9652, 0.0043, 1, 0.87, 0.4, 608, 3, 3, 0, 0, 702, 10, 1], "semantic": {"name": "sis", "arg_names": [], "import_names": [], "rhs_call_name": "IntrospectionServer", "annotation": ""}, "snippet": " sis = IntrospectionServer('Grasp Cleanup', sm, '/SM_GRASP_CLEANUP')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L223_C4", "label": "start()", "type": "expression", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "vector": [8, 1, 0.9696, 0.0043, 1, 0.87, 0.6, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " sis.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L225_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "vector": [14, 1, 0.9783, 0.0043, 1, 0.87, 0.8, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L227_C4", "label": "stop()", "type": "expression", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "vector": [8, 1, 0.987, 0.0043, 1, 0.87, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " sis.stop()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99501:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L178_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L180_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L184_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L186_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Return_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99501:If_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99501:Expr_L227_C4"}] |
#! /usr/bin/python
import sys
import numpy as np
import roslib
roslib.load_manifest('hrl_pr2_arms')
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
import rospy
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
import tf
import tf.transformations as tf_trans
from std_msgs.msg import Bool, Float32
from std_srvs.srv import Empty
from geometry_msgs.msg import PoseStamped, Vector3
from actionlib_msgs.msg import GoalStatus
#from hrl_trajectory_playback.srv import TrajPlaybackSrv, TrajPlaybackSrvRequest
from hrl_generic_arms.pose_converter import PoseConverter
from hrl_pr2_arms.pr2_arm import create_pr2_arm
from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce
class ClickMonitor(smach.State):
def __init__(self):
smach.State.__init__(self, outcomes=['click', 'shutdown'],
output_keys=['click_pose'])
self.cur_msg = None
rospy.Subscriber('/pixel3d', PoseStamped, self.click_cb)
def click_cb(self, msg):
self.cur_msg = msg
def execute(self, userdata):
self.cur_msg = None
while not rospy.is_shutdown():
if self.cur_msg is not None:
userdata.click_pose = self.cur_msg
return 'click'
rospy.sleep(0.01)
return 'shutdown'
class TFPubLoop(object):
def __init__(self, parent_frame_name, child_frame_name, rate=100):
self.child_frame_name = child_frame_name
self.parent_frame_name = parent_frame_name
self.tf_broad = tf.TransformBroadcaster()
self.timer = rospy.Timer(rospy.Duration(1. / rate), self.pub_tf)
self.tf_pose = None
def pub_tf(self, timer_info):
if self.tf_pose is not None:
self.tf_broad.sendTransform(self.tf_pose[0], self.tf_pose[1], rospy.Time.now(),
self.child_frame_name, self.parent_frame_name)
def update_pose(self, pose):
self.tf_pose = PoseConverter.to_pos_quat(pose)
self.pub_tf(None)
class SMTouchSimple(object):
def __init__(self):
self.tf_listener = tf.TransformListener()
self.start_frame_pub = rospy.Publisher("~start_frame", PoseStamped)
self.end_frame_pub = rospy.Publisher("~end_frame", PoseStamped)
self.arm = create_pr2_arm('l', PR2ArmHybridForce)
self.tf_pub = TFPubLoop("/torso_lift_link", "/contact_control_frame")
def get_transform(self, from_frame, to_frame, time=None):
if time is None:
time = rospy.Time.now()
try:
self.tf_listener.waitForTransform(from_frame, to_frame, time, rospy.Duration(5))
pos, quat = self.tf_listener.lookupTransform(from_frame, to_frame, time)
return util.pose_pq_to_mat(pos, quat)
except (tf.Exception, tf.LookupException, tf.ConnectivityException):
return None
def get_trajectory_generator(self):
@smach.cb_interface(input_keys=['start_click', 'end_click'],
output_keys=['start_traj_frame', 'end_traj_frame'],
outcomes=['succeeded'])
def generate_trajectory(ud):
b_B_s = PoseConverter.to_homo_mat(ud.start_click)
b_B_e = PoseConverter.to_homo_mat(ud.end_click)
s_B_e = (b_B_s ** -1) * b_B_e
b_normal = b_B_s[:3, 2] / np.linalg.norm(b_B_s[:3, 2])
s_vel = np.mat([s_B_e[0, 3], s_B_e[1, 3], 0]).T
s_vel = s_vel / np.linalg.norm(s_vel)
b_vel = b_B_s[:3, :3].T * s_vel
b_ortho = np.mat(np.cross(b_normal.T, b_vel.T)).T
b_ortho = b_ortho / np.linalg.norm(b_ortho)
b_R_traj = np.vstack([b_vel.T, b_ortho.T, b_normal.T])
b_p_start = b_B_s[:3, 3]
b_p_end = b_B_e[:3, 3]
b_p_end = 3 #TODO TODO
self.start_frame_pub.publish(PoseConverter.to_pose_stamped_msg(ud.start_click.header.frame_id,
(b_p_start, b_R_traj)))
self.end_frame_pub.publish(PoseConverter.to_pose_stamped_msg(ud.start_click.header.frame_id,
(b_p_end, b_R_traj)))
ud.start_traj_frame = (b_p_start, b_R_traj)
ud.end_traj_frame = (b_p_end, b_R_traj)
return 'succeeded'
return smach.CBState(generate_trajectory)
def get_sm(self):
sm = smach.StateMachine(outcomes=['succeeded','preempted','shutdown'])
with sm:
smach.StateMachine.add(
'INPUT_START_CLICK',
ClickMonitor(),
transitions={'click' : 'INPUT_END_CLICK',
'shutdown' : 'shutdown'},
remapping={'click_pose' : 'start_click'}) # output (PoseStamped)
smach.StateMachine.add(
'INPUT_END_CLICK',
ClickMonitor(),
transitions={'click' : 'GENERATE_TRAJECTORY',
'shutdown' : 'shutdown'},
remapping={'click_pose' : 'end_click'}) # output (PoseStamped)
smach.StateMachine.add(
'GENERATE_TRAJECTORY',
self.get_trajectory_generator(),
transitions={'succeeded' : 'INPUT_START_CLICK'})
return sm
def get_sm_basic(self):
sm = smach.StateMachine(outcomes=['succeeded','preempted','shutdown'])
with sm:
smach.StateMachine.add(
'INPUT_START_CLICK',
ClickMonitor(),
transitions={'click' : 'PUBLISH_CONTROL_FRAME',
'shutdown' : 'shutdown'},
remapping={'click_pose' : 'start_click'}) # output (PoseStamped)
@smach.cb_interface(input_keys=['start_click'],
outcomes=['succeeded', 'failed'])
def publish_control_frame(ud):
if ud.start_click.pose.position.x == -10000.0:
return 'failed'
pose = ud.start_click
pose.header.stamp = rospy.Time(0)
click_torso = self.tf_listener.transformPose("/torso_lift_link", pose)
self.tf_pub.update_pose(click_torso)
rospy.sleep(1)
self.arm.set_tip_frame("/contact_control_frame")
#self.arm.set_motion_gains(p_trans=[300, 300, 100])
self.arm.update_gains()
return 'succeeded'
smach.StateMachine.add(
'PUBLISH_CONTROL_FRAME',
smach.CBState(publish_control_frame),
transitions={'succeeded' : 'INPUT_START_CLICK',
'failed' : 'INPUT_START_CLICK'})
return sm
def main():
rospy.init_node('pr2_touch_simple')
smts = SMTouchSimple()
sm = smts.get_sm_basic()
rospy.sleep(1)
sis = IntrospectionServer('touch_simple', sm, '/INPUT_START_CLICK')
sis.start()
outcome = sm.execute()
sis.stop()
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_99502 | 116 | 189 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0053, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0212, 0.0053, 0, 0.66, 0.0435, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Import_L6_C0", "label": "roslib import roslib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0317, 0.0053, 0, 0.66, 0.087, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.037, 0.0053, 0, 0.66, 0.1304, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_pr2_arms')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0423, 0.0053, 0, 0.66, 0.1739, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0476, 0.0053, 0, 0.66, 0.2174, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Import_L10_C0", "label": "rospy import rospy", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0529, 0.0053, 0, 0.66, 0.2609, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Import_L12_C0", "label": "smach import smach", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0635, 0.0053, 0, 0.66, 0.3043, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ImportFrom_L13_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0688, 0.0053, 0, 0.66, 0.3478, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Import_L14_C0", "label": "actionlib import actionlib", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0741, 0.0053, 0, 0.66, 0.3913, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Import_L15_C0", "label": "tf import tf", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0794, 0.0053, 0, 0.66, 0.4348, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Import_L16_C0", "label": "tf.transformations import tf_trans", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0847, 0.0053, 0, 0.66, 0.4783, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tf_trans"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tf_trans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ImportFrom_L17_C0", "label": "from std_msgs.msg import Bool, Float32", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0899, 0.0053, 0, 0.66, 0.5217, 366, 0, 2, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Bool", "Float32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Bool, Float32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ImportFrom_L18_C0", "label": "from std_srvs.srv import Empty", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0053, 0, 0.66, 0.5652, 261, 0, 1, 0, 0, 261, 0, 0], "semantic": {"name": "std_srvs.srv", "arg_names": [], "import_names": ["Empty"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_srvs.srv import Empty"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ImportFrom_L19_C0", "label": "from geometry_msgs.msg import PoseStamped, Vector3", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1005, 0.0053, 0, 0.66, 0.6087, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped", "Vector3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped, Vector3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ImportFrom_L20_C0", "label": "from actionlib_msgs.msg import GoalStatus", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1058, 0.0053, 0, 0.66, 0.6522, 245, 0, 1, 0, 0, 245, 0, 0], "semantic": {"name": "actionlib_msgs.msg", "arg_names": [], "import_names": ["GoalStatus"], "rhs_call_name": "", "annotation": ""}, "snippet": "from actionlib_msgs.msg import GoalStatus"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ImportFrom_L23_C0", "label": "from hrl_generic_arms.pose_converter import PoseConverter", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1217, 0.0053, 0, 0.66, 0.6957, 752, 0, 1, 0, 0, 752, 0, 0], "semantic": {"name": "hrl_generic_arms.pose_converter", "arg_names": [], "import_names": ["PoseConverter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_generic_arms.pose_converter import PoseConverter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ImportFrom_L24_C0", "label": "from hrl_pr2_arms.pr2_arm import create_pr2_arm", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.127, 0.0053, 0, 0.66, 0.7391, 253, 0, 1, 0, 0, 253, 0, 0], "semantic": {"name": "hrl_pr2_arms.pr2_arm", "arg_names": [], "import_names": ["create_pr2_arm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_pr2_arms.pr2_arm import create_pr2_arm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ImportFrom_L25_C0", "label": "from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1323, 0.0053, 0, 0.66, 0.7826, 910, 0, 1, 0, 0, 910, 0, 0], "semantic": {"name": "hrl_pr2_arms.pr2_arm_hybrid", "arg_names": [], "import_names": ["PR2ArmHybridForce"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L27_C0", "label": "ClickMonitor", "type": "class", "loc": [27, 44], "level": 0, "parent": null, "vector": [3, 0, 0.1878, 0.0952, 0, 0.66, 0.8261, 492, 0, 3, 0, 0, 892, 0, 4], "semantic": {"name": "ClickMonitor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ClickMonitor(smach.State):\n def __init__(self):\n smach.State.__init__(self, outcomes=['click', 'shutdown'],\n output_keys=['click_pose'])\n self.cur_msg = None\n rospy.Subscriber('/pixel3d', PoseStamped, self.click_cb)\n\n def click_cb(self, msg):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L28_C4", "label": "__init__", "type": "function", "loc": [28, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L27_C0", "vector": [2, 1, 0.1587, 0.0265, 1, 0.48, 0.0, 555, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n smach.State.__init__(self, outcomes=['click', 'shutdown'],\n output_keys=['click_pose'])\n self.cur_msg = None\n rospy.Subscriber('/pixel3d', PoseStamped, self.click_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L29_C8", "label": "__init__()", "type": "expression", "loc": [29, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L28_C4", "vector": [8, 2, 0.1561, 0.0106, 2, 0.27, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " smach.State.__init__(self, outcomes=['click', 'shutdown'],\n output_keys=['click_pose'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L31_C8", "label": "self.cur_msg =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L28_C4", "vector": [14, 2, 0.164, 0.0053, 2, 0.27, 0.5, 892, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.cur_msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cur_msg = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L32_C8", "label": "Subscriber()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L28_C4", "vector": [8, 2, 0.1693, 0.0053, 2, 0.27, 1.0, 455, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Subscriber", "arg_names": [], "import_names": [], "rhs_call_name": "Subscriber", "annotation": ""}, "snippet": " rospy.Subscriber('/pixel3d', PoseStamped, self.click_cb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L34_C4", "label": "click_cb", "type": "function", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L27_C0", "vector": [2, 1, 0.1825, 0.0106, 1, 0.48, 0.5, 233, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "click_cb", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def click_cb(self, msg):\n self.cur_msg = msg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L35_C8", "label": "self.cur_msg =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L34_C4", "vector": [14, 2, 0.1852, 0.0053, 2, 0.72, 0.0, 892, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cur_msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cur_msg = msg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L37_C4", "label": "execute", "type": "function", "loc": [37, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L27_C0", "vector": [2, 1, 0.2143, 0.0423, 1, 0.48, 1.0, 569, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": ["self", "userdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, userdata):\n self.cur_msg = None\n while not rospy.is_shutdown():\n if self.cur_msg is not None:\n userdata.click_pose = self.cur_msg\n return 'click'\n rospy.sleep(0.01)\n return 'shutdown'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L38_C8", "label": "self.cur_msg =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L37_C4", "vector": [14, 2, 0.2011, 0.0053, 2, 0.71, 0.0, 892, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.cur_msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cur_msg = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:While_L39_C8", "label": "while", "type": "while", "loc": [39, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L37_C4", "vector": [5, 2, 0.2169, 0.0265, 2, 0.71, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not rospy.is_shutdown():\n if self.cur_msg is not None:\n userdata.click_pose = self.cur_msg\n return 'click'\n rospy.sleep(0.01)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L40_C12", "label": "if", "type": "if", "loc": [40, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:While_L39_C8", "vector": [4, 3, 0.2169, 0.0159, 3, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.cur_msg is not None:\n userdata.click_pose = self.cur_msg\n return 'click'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L41_C16", "label": "userdata.click_pose =", "type": "assigned_variable", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L40_C12", "vector": [14, 4, 0.2169, 0.0053, 4, 0.95, 0.0, 343, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata.click_pose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata.click_pose = self.cur_msg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L42_C16", "label": "return", "type": "return", "loc": [42, 42], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L40_C12", "vector": [13, 4, 0.2222, 0.0053, 4, 0.95, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'click'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L43_C12", "label": "sleep()", "type": "expression", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:While_L39_C8", "vector": [8, 3, 0.2275, 0.0053, 3, 0.02, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(0.01)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L44_C8", "label": "return", "type": "return", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L37_C4", "vector": [13, 2, 0.2328, 0.0053, 2, 0.71, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'shutdown'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L46_C0", "label": "TFPubLoop", "type": "class", "loc": [46, 61], "level": 0, "parent": null, "vector": [3, 0, 0.2831, 0.0847, 0, 0.66, 0.8696, 113, 0, 3, 0, 0, 186, 0, 7], "semantic": {"name": "TFPubLoop", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TFPubLoop(object):\n def __init__(self, parent_frame_name, child_frame_name, rate=100):\n self.child_frame_name = child_frame_name\n self.parent_frame_name = parent_frame_name\n self.tf_broad = tf.TransformBroadcaster()\n self.timer = rospy.Timer(rospy.Duration(1. / rate), self.pub_tf)\n self.tf_pose = None\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "label": "__init__", "type": "function", "loc": [47, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L46_C0", "vector": [2, 1, 0.2619, 0.0317, 1, 0.0, 0.0, 555, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "parent_frame_name", "child_frame_name", "rate"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, parent_frame_name, child_frame_name, rate=100):\n self.child_frame_name = child_frame_name\n self.parent_frame_name = parent_frame_name\n self.tf_broad = tf.TransformBroadcaster()\n self.timer = rospy.Timer(rospy.Duration(1. / rate), self.pub_tf)\n self.tf_pose = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L48_C8", "label": "self.child_frame_name =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "vector": [14, 2, 0.254, 0.0053, 2, 0.09, 0.0, 253, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.child_frame_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.child_frame_name = child_frame_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L49_C8", "label": "self.parent_frame_name =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "vector": [14, 2, 0.2593, 0.0053, 2, 0.09, 0.25, 645, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parent_frame_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parent_frame_name = parent_frame_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L50_C8", "label": "self.tf_broad = TransformBroadcaster()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "vector": [14, 2, 0.2646, 0.0053, 2, 0.09, 0.5, 165, 3, 0, 0, 0, 986, 10, 1], "semantic": {"name": "self.tf_broad", "arg_names": [], "import_names": [], "rhs_call_name": "TransformBroadcaster", "annotation": ""}, "snippet": " self.tf_broad = tf.TransformBroadcaster()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L51_C8", "label": "self.timer = Timer()", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "vector": [14, 2, 0.2698, 0.0053, 2, 0.09, 0.75, 407, 3, 2, 0, 0, 771, 10, 2], "semantic": {"name": "self.timer", "arg_names": [], "import_names": [], "rhs_call_name": "Timer", "annotation": ""}, "snippet": " self.timer = rospy.Timer(rospy.Duration(1. / rate), self.pub_tf)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L52_C8", "label": "self.tf_pose =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "vector": [14, 2, 0.2751, 0.0053, 2, 0.09, 1.0, 208, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.tf_pose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tf_pose = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L54_C4", "label": "pub_tf", "type": "function", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L46_C0", "vector": [2, 1, 0.2937, 0.0212, 1, 0.0, 0.5, 929, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "pub_tf", "arg_names": ["self", "timer_info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pub_tf(self, timer_info):\n if self.tf_pose is not None:\n self.tf_broad.sendTransform(self.tf_pose[0], self.tf_pose[1], rospy.Time.now(), \n self.child_frame_name, self.parent_frame_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L55_C8", "label": "if", "type": "if", "loc": [55, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L54_C4", "vector": [4, 2, 0.2963, 0.0159, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.tf_pose is not None:\n self.tf_broad.sendTransform(self.tf_pose[0], self.tf_pose[1], rospy.Time.now(), \n self.child_frame_name, self.parent_frame_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L56_C12", "label": "sendTransform()", "type": "expression", "loc": [56, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L55_C8", "vector": [8, 3, 0.2989, 0.0106, 3, 0.18, 0.0, 373, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "sendTransform", "arg_names": [], "import_names": [], "rhs_call_name": "sendTransform", "annotation": ""}, "snippet": " self.tf_broad.sendTransform(self.tf_pose[0], self.tf_pose[1], rospy.Time.now(), \n self.child_frame_name, self.parent_frame_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L59_C4", "label": "update_pose", "type": "function", "loc": [59, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L46_C0", "vector": [2, 1, 0.3175, 0.0159, 1, 0.0, 1.0, 774, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "update_pose", "arg_names": ["self", "pose"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_pose(self, pose):\n self.tf_pose = PoseConverter.to_pos_quat(pose)\n self.pub_tf(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L60_C8", "label": "self.tf_pose = to_pos_quat()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L59_C4", "vector": [14, 2, 0.3175, 0.0053, 2, 0.94, 0.0, 208, 3, 1, 0, 0, 926, 10, 1], "semantic": {"name": "self.tf_pose", "arg_names": [], "import_names": [], "rhs_call_name": "to_pos_quat", "annotation": ""}, "snippet": " self.tf_pose = PoseConverter.to_pos_quat(pose)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L61_C8", "label": "pub_tf()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L59_C4", "vector": [8, 2, 0.3228, 0.0053, 2, 0.94, 1.0, 929, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pub_tf", "arg_names": [], "import_names": [], "rhs_call_name": "pub_tf", "annotation": ""}, "snippet": " self.pub_tf(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "label": "SMTouchSimple", "type": "class", "loc": [63, 172], "level": 0, "parent": null, "vector": [3, 0, 0.6217, 0.582, 0, 0.66, 0.913, 366, 0, 7, 0, 0, 186, 0, 44], "semantic": {"name": "SMTouchSimple", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SMTouchSimple(object):\n def __init__(self):\n self.tf_listener = tf.TransformListener()\n self.start_frame_pub = rospy.Publisher(\"~start_frame\", PoseStamped)\n self.end_frame_pub = rospy.Publisher(\"~end_frame\", PoseStamped)\n\n self.arm = create_pr2_arm('l', PR2ArmHybridForce)\n self.tf_pub = TFPubLoop(\"/torso_lift_link\", \"/contact_control_frame\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "label": "__init__", "type": "function", "loc": [64, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "vector": [2, 1, 0.3545, 0.037, 1, 0.35, 0.0, 555, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.tf_listener = tf.TransformListener()\n self.start_frame_pub = rospy.Publisher(\"~start_frame\", PoseStamped)\n self.end_frame_pub = rospy.Publisher(\"~end_frame\", PoseStamped)\n\n self.arm = create_pr2_arm('l', PR2ArmHybridForce)\n self.tf_pub = TFPubLoop(\"/torso_lift_link\", \"/contact_control_frame\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L65_C8", "label": "self.tf_listener = TransformListener()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "vector": [14, 2, 0.3439, 0.0053, 2, 0.68, 0.0, 639, 3, 0, 0, 0, 108, 10, 1], "semantic": {"name": "self.tf_listener", "arg_names": [], "import_names": [], "rhs_call_name": "TransformListener", "annotation": ""}, "snippet": " self.tf_listener = tf.TransformListener()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L66_C8", "label": "self.start_frame_pub = Publisher()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "vector": [14, 2, 0.3492, 0.0053, 2, 0.68, 0.25, 435, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.start_frame_pub", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.start_frame_pub = rospy.Publisher(\"~start_frame\", PoseStamped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L67_C8", "label": "self.end_frame_pub = Publisher()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "vector": [14, 2, 0.3545, 0.0053, 2, 0.68, 0.5, 792, 3, 2, 0, 0, 45, 10, 1], "semantic": {"name": "self.end_frame_pub", "arg_names": [], "import_names": [], "rhs_call_name": "Publisher", "annotation": ""}, "snippet": " self.end_frame_pub = rospy.Publisher(\"~end_frame\", PoseStamped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L69_C8", "label": "self.arm = create_pr2_arm()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "vector": [14, 2, 0.3651, 0.0053, 2, 0.68, 0.75, 720, 3, 2, 0, 0, 318, 10, 1], "semantic": {"name": "self.arm", "arg_names": [], "import_names": [], "rhs_call_name": "create_pr2_arm", "annotation": ""}, "snippet": " self.arm = create_pr2_arm('l', PR2ArmHybridForce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L70_C8", "label": "self.tf_pub = TFPubLoop()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "vector": [14, 2, 0.3704, 0.0053, 2, 0.68, 1.0, 4, 3, 2, 0, 0, 113, 10, 1], "semantic": {"name": "self.tf_pub", "arg_names": [], "import_names": [], "rhs_call_name": "TFPubLoop", "annotation": ""}, "snippet": " self.tf_pub = TFPubLoop(\"/torso_lift_link\", \"/contact_control_frame\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L72_C4", "label": "get_transform", "type": "function", "loc": [72, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "vector": [2, 1, 0.4021, 0.0476, 1, 0.35, 0.25, 326, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "get_transform", "arg_names": ["self", "from_frame", "to_frame", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_transform(self, from_frame, to_frame, time=None):\n if time is None:\n time = rospy.Time.now()\n try:\n self.tf_listener.waitForTransform(from_frame, to_frame, time, rospy.Duration(5))\n pos, quat = self.tf_listener.lookupTransform(from_frame, to_frame, time)\n return util.pose_pq_to_mat(pos, quat)\n except (tf.Exception, tf.LookupException, tf.ConnectivityException):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L73_C8", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L72_C4", "vector": [4, 2, 0.3889, 0.0106, 2, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if time is None:\n time = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L74_C12", "label": "time = now()", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L73_C8", "vector": [14, 3, 0.3915, 0.0053, 3, 0.48, 0.0, 654, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "time", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " time = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "label": "try", "type": "try", "loc": [75, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L72_C4", "vector": [7, 2, 0.4101, 0.0317, 2, 0.93, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.tf_listener.waitForTransform(from_frame, to_frame, time, rospy.Duration(5))\n pos, quat = self.tf_listener.lookupTransform(from_frame, to_frame, time)\n return util.pose_pq_to_mat(pos, quat)\n except (tf.Exception, tf.LookupException, tf.ConnectivityException):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L76_C12", "label": "waitForTransform()", "type": "expression", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "vector": [8, 3, 0.4021, 0.0053, 3, 0.4, 0.0, 900, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "waitForTransform", "arg_names": [], "import_names": [], "rhs_call_name": "waitForTransform", "annotation": ""}, "snippet": " self.tf_listener.waitForTransform(from_frame, to_frame, time, rospy.Duration(5))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L77_C12", "label": "pos, quat = lookupTransform()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "vector": [14, 3, 0.4074, 0.0053, 3, 0.4, 0.5, 375, 3, 3, 0, 0, 926, 10, 1], "semantic": {"name": "pos, quat", "arg_names": [], "import_names": [], "rhs_call_name": "lookupTransform", "annotation": ""}, "snippet": " pos, quat = self.tf_listener.lookupTransform(from_frame, to_frame, time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L78_C12", "label": "return", "type": "return", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "vector": [13, 3, 0.4127, 0.0053, 3, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return util.pose_pq_to_mat(pos, quat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L80_C12", "label": "return", "type": "return", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "vector": [13, 3, 0.4233, 0.0053, 3, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L82_C4", "label": "get_trajectory_generator", "type": "function", "loc": [82, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "vector": [2, 1, 0.5159, 0.1693, 1, 0.35, 0.5, 65, 0, 1, 1, 0, 0, 0, 15], "semantic": {"name": "get_trajectory_generator", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_trajectory_generator(self):\n \n @smach.cb_interface(input_keys=['start_click', 'end_click'],\n output_keys=['start_traj_frame', 'end_traj_frame'],\n outcomes=['succeeded'])\n def generate_trajectory(ud):\n b_B_s = PoseConverter.to_homo_mat(ud.start_click)\n b_B_e = PoseConverter.to_homo_mat(ud.end_click)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "label": "generate_trajectory", "type": "function", "loc": [87, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L82_C4", "vector": [2, 2, 0.5238, 0.1323, 2, 0.64, 0.0, 129, 0, 1, 1, 0, 0, 0, 14], "semantic": {"name": "generate_trajectory", "arg_names": ["ud"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def generate_trajectory(ud):\n b_B_s = PoseConverter.to_homo_mat(ud.start_click)\n b_B_e = PoseConverter.to_homo_mat(ud.end_click)\n s_B_e = (b_B_s ** -1) * b_B_e\n b_normal = b_B_s[:3, 2] / np.linalg.norm(b_B_s[:3, 2])\n s_vel = np.mat([s_B_e[0, 3], s_B_e[1, 3], 0]).T\n s_vel = s_vel / np.linalg.norm(s_vel)\n b_vel = b_B_s[:3, :3].T * s_vel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L88_C12", "label": "b_B_s = to_homo_mat()", "type": "assigned_variable", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.4656, 0.0053, 3, 0.69, 0.0, 926, 3, 1, 0, 0, 32, 10, 1], "semantic": {"name": "b_B_s", "arg_names": [], "import_names": [], "rhs_call_name": "to_homo_mat", "annotation": ""}, "snippet": " b_B_s = PoseConverter.to_homo_mat(ud.start_click)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L89_C12", "label": "b_B_e = to_homo_mat()", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.4709, 0.0053, 3, 0.69, 0.0588, 350, 3, 1, 0, 0, 32, 10, 1], "semantic": {"name": "b_B_e", "arg_names": [], "import_names": [], "rhs_call_name": "to_homo_mat", "annotation": ""}, "snippet": " b_B_e = PoseConverter.to_homo_mat(ud.end_click)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L90_C12", "label": "s_B_e =", "type": "assigned_variable", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.4762, 0.0053, 3, 0.69, 0.1176, 481, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s_B_e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s_B_e = (b_B_s ** -1) * b_B_e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L91_C12", "label": "b_normal =", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.4815, 0.0053, 3, 0.69, 0.1765, 248, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "b_normal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b_normal = b_B_s[:3, 2] / np.linalg.norm(b_B_s[:3, 2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L92_C12", "label": "s_vel =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.4868, 0.0053, 3, 0.69, 0.2353, 521, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s_vel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s_vel = np.mat([s_B_e[0, 3], s_B_e[1, 3], 0]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L93_C12", "label": "s_vel =", "type": "assigned_variable", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.4921, 0.0053, 3, 0.69, 0.2941, 521, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s_vel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s_vel = s_vel / np.linalg.norm(s_vel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L94_C12", "label": "b_vel =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.4974, 0.0053, 3, 0.69, 0.3529, 983, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "b_vel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b_vel = b_B_s[:3, :3].T * s_vel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L95_C12", "label": "b_ortho =", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.5026, 0.0053, 3, 0.69, 0.4118, 891, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "b_ortho", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b_ortho = np.mat(np.cross(b_normal.T, b_vel.T)).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L96_C12", "label": "b_ortho =", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.5079, 0.0053, 3, 0.69, 0.4706, 891, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "b_ortho", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b_ortho = b_ortho / np.linalg.norm(b_ortho)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L97_C12", "label": "b_R_traj = vstack()", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.5132, 0.0053, 3, 0.69, 0.5294, 458, 3, 1, 0, 0, 269, 10, 1], "semantic": {"name": "b_R_traj", "arg_names": [], "import_names": [], "rhs_call_name": "vstack", "annotation": ""}, "snippet": " b_R_traj = np.vstack([b_vel.T, b_ortho.T, b_normal.T])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L99_C12", "label": "b_p_start =", "type": "assigned_variable", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.5238, 0.0053, 3, 0.69, 0.5882, 522, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "b_p_start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b_p_start = b_B_s[:3, 3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L100_C12", "label": "b_p_end =", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.5291, 0.0053, 3, 0.69, 0.6471, 117, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "b_p_end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b_p_end = b_B_e[:3, 3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L101_C12", "label": "b_p_end =", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.5344, 0.0053, 3, 0.69, 0.7059, 117, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "b_p_end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b_p_end = 3 #TODO TODO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L103_C12", "label": "publish()", "type": "expression", "loc": [103, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [8, 3, 0.5476, 0.0106, 3, 0.69, 0.7647, 102, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.start_frame_pub.publish(PoseConverter.to_pose_stamped_msg(ud.start_click.header.frame_id, \n (b_p_start, b_R_traj)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L105_C12", "label": "publish()", "type": "expression", "loc": [105, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [8, 3, 0.5582, 0.0106, 3, 0.69, 0.8235, 102, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "publish", "arg_names": [], "import_names": [], "rhs_call_name": "publish", "annotation": ""}, "snippet": " self.end_frame_pub.publish(PoseConverter.to_pose_stamped_msg(ud.start_click.header.frame_id, \n (b_p_end, b_R_traj)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L109_C12", "label": "ud.start_traj_frame =", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.5767, 0.0053, 3, 0.69, 0.8824, 106, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "ud.start_traj_frame", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ud.start_traj_frame = (b_p_start, b_R_traj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L110_C12", "label": "ud.end_traj_frame =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [14, 3, 0.582, 0.0053, 3, 0.69, 0.9412, 558, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "ud.end_traj_frame", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ud.end_traj_frame = (b_p_end, b_R_traj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L111_C12", "label": "return", "type": "return", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "vector": [13, 3, 0.5873, 0.0053, 3, 0.69, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L113_C8", "label": "return", "type": "return", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L82_C4", "vector": [13, 2, 0.5979, 0.0053, 2, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return smach.CBState(generate_trajectory)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "label": "get_sm", "type": "function", "loc": [116, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "vector": [2, 1, 0.6746, 0.127, 1, 0.35, 0.75, 13, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "get_sm", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_sm(self):\n sm = smach.StateMachine(outcomes=['succeeded','preempted','shutdown'])\n \n with sm:\n smach.StateMachine.add(\n 'INPUT_START_CLICK',\n ClickMonitor(),\n transitions={'click' : 'INPUT_END_CLICK',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L117_C8", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "vector": [14, 2, 0.619, 0.0053, 2, 0.07, 0.0, 21, 3, 1, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine(outcomes=['succeeded','preempted','shutdown'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L120_C12", "label": "add()", "type": "expression", "loc": [120, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "vector": [8, 2, 0.6481, 0.0317, 2, 0.07, 0.0, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'INPUT_START_CLICK',\n ClickMonitor(),\n transitions={'click' : 'INPUT_END_CLICK',\n 'shutdown' : 'shutdown'},\n remapping={'click_pose' : 'start_click'}) # output (PoseStamped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L127_C12", "label": "add()", "type": "expression", "loc": [127, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "vector": [8, 2, 0.6852, 0.0317, 2, 0.07, 0.5, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'INPUT_END_CLICK',\n ClickMonitor(),\n transitions={'click' : 'GENERATE_TRAJECTORY',\n 'shutdown' : 'shutdown'},\n remapping={'click_pose' : 'end_click'}) # output (PoseStamped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L134_C12", "label": "add()", "type": "expression", "loc": [134, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "vector": [8, 2, 0.7169, 0.0212, 2, 0.07, 1.0, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'GENERATE_TRAJECTORY',\n self.get_trajectory_generator(),\n transitions={'succeeded' : 'INPUT_START_CLICK'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L139_C8", "label": "return", "type": "return", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "vector": [13, 2, 0.7354, 0.0053, 2, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "label": "get_sm_basic", "type": "function", "loc": [141, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "vector": [2, 1, 0.828, 0.1693, 1, 0.35, 1.0, 56, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "get_sm_basic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_sm_basic(self):\n sm = smach.StateMachine(outcomes=['succeeded','preempted','shutdown'])\n \n with sm:\n smach.StateMachine.add(\n 'INPUT_START_CLICK',\n ClickMonitor(),\n transitions={'click' : 'PUBLISH_CONTROL_FRAME',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L142_C8", "label": "sm = StateMachine()", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "vector": [14, 2, 0.7513, 0.0053, 2, 0.95, 0.0, 21, 3, 1, 0, 0, 174, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "StateMachine", "annotation": ""}, "snippet": " sm = smach.StateMachine(outcomes=['succeeded','preempted','shutdown'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L145_C12", "label": "add()", "type": "expression", "loc": [145, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "vector": [8, 2, 0.7804, 0.0317, 2, 0.95, 0.0, 241, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'INPUT_START_CLICK',\n ClickMonitor(),\n transitions={'click' : 'PUBLISH_CONTROL_FRAME',\n 'shutdown' : 'shutdown'},\n remapping={'click_pose' : 'start_click'}) # output (PoseStamped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "label": "publish_control_frame", "type": "function", "loc": [154, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "vector": [2, 2, 0.8439, 0.0635, 2, 0.95, 0.5, 628, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "publish_control_frame", "arg_names": ["ud"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def publish_control_frame(ud):\n if ud.start_click.pose.position.x == -10000.0:\n return 'failed'\n pose = ud.start_click\n pose.header.stamp = rospy.Time(0)\n click_torso = self.tf_listener.transformPose(\"/torso_lift_link\", pose)\n self.tf_pub.update_pose(click_torso)\n rospy.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L155_C16", "label": "if", "type": "if", "loc": [155, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [4, 3, 0.8228, 0.0106, 3, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ud.start_click.pose.position.x == -10000.0:\n return 'failed'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L156_C20", "label": "return", "type": "return", "loc": [156, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L155_C16", "vector": [13, 4, 0.8254, 0.0053, 4, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'failed'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L157_C16", "label": "pose =", "type": "assigned_variable", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [14, 3, 0.8307, 0.0053, 3, 0.89, 0.125, 767, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pose = ud.start_click"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L158_C16", "label": "pose.header.stamp = Time()", "type": "assigned_variable", "loc": [158, 158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [14, 3, 0.836, 0.0053, 3, 0.89, 0.25, 112, 3, 1, 0, 0, 451, 10, 1], "semantic": {"name": "pose.header.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "Time", "annotation": ""}, "snippet": " pose.header.stamp = rospy.Time(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L159_C16", "label": "click_torso = transformPose()", "type": "assigned_variable", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [14, 3, 0.8413, 0.0053, 3, 0.89, 0.375, 744, 3, 2, 0, 0, 654, 10, 1], "semantic": {"name": "click_torso", "arg_names": [], "import_names": [], "rhs_call_name": "transformPose", "annotation": ""}, "snippet": " click_torso = self.tf_listener.transformPose(\"/torso_lift_link\", pose)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L160_C16", "label": "update_pose()", "type": "expression", "loc": [160, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [8, 3, 0.8466, 0.0053, 3, 0.89, 0.5, 774, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_pose", "arg_names": [], "import_names": [], "rhs_call_name": "update_pose", "annotation": ""}, "snippet": " self.tf_pub.update_pose(click_torso)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L161_C16", "label": "sleep()", "type": "expression", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [8, 3, 0.8519, 0.0053, 3, 0.89, 0.625, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L162_C16", "label": "set_tip_frame()", "type": "expression", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [8, 3, 0.8571, 0.0053, 3, 0.89, 0.75, 819, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_tip_frame", "arg_names": [], "import_names": [], "rhs_call_name": "set_tip_frame", "annotation": ""}, "snippet": " self.arm.set_tip_frame(\"/contact_control_frame\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L164_C16", "label": "update_gains()", "type": "expression", "loc": [164, 164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [8, 3, 0.8677, 0.0053, 3, 0.89, 0.875, 582, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_gains", "arg_names": [], "import_names": [], "rhs_call_name": "update_gains", "annotation": ""}, "snippet": " self.arm.update_gains()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L165_C16", "label": "return", "type": "return", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "vector": [13, 3, 0.873, 0.0053, 3, 0.89, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'succeeded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L166_C12", "label": "add()", "type": "expression", "loc": [166, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "vector": [8, 2, 0.8889, 0.0265, 2, 0.95, 1.0, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " smach.StateMachine.add(\n 'PUBLISH_CONTROL_FRAME',\n smach.CBState(publish_control_frame),\n transitions={'succeeded' : 'INPUT_START_CLICK',\n 'failed' : 'INPUT_START_CLICK'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L172_C8", "label": "return", "type": "return", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "vector": [13, 2, 0.9101, 0.0053, 2, 0.95, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "label": "main", "type": "function", "loc": [175, 186], "level": 0, "parent": null, "vector": [2, 0, 0.955, 0.0635, 0, 0.66, 0.9565, 624, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n rospy.init_node('pr2_touch_simple')\n smts = SMTouchSimple()\n sm = smts.get_sm_basic()\n rospy.sleep(1)\n\n sis = IntrospectionServer('touch_simple', sm, '/INPUT_START_CLICK')\n sis.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L176_C4", "label": "init_node()", "type": "expression", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "vector": [8, 1, 0.9312, 0.0053, 1, 0.8, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node('pr2_touch_simple')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L177_C4", "label": "smts = SMTouchSimple()", "type": "assigned_variable", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "vector": [14, 1, 0.9365, 0.0053, 1, 0.8, 0.1429, 59, 3, 0, 0, 0, 366, 10, 1], "semantic": {"name": "smts", "arg_names": [], "import_names": [], "rhs_call_name": "SMTouchSimple", "annotation": ""}, "snippet": " smts = SMTouchSimple()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L178_C4", "label": "sm = get_sm_basic()", "type": "assigned_variable", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "vector": [14, 1, 0.9418, 0.0053, 1, 0.8, 0.2857, 21, 3, 0, 0, 0, 56, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "get_sm_basic", "annotation": ""}, "snippet": " sm = smts.get_sm_basic()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L179_C4", "label": "sleep()", "type": "expression", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "vector": [8, 1, 0.9471, 0.0053, 1, 0.8, 0.4286, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L181_C4", "label": "sis = IntrospectionServer()", "type": "assigned_variable", "loc": [181, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "vector": [14, 1, 0.9577, 0.0053, 1, 0.8, 0.5714, 608, 3, 3, 0, 0, 702, 10, 1], "semantic": {"name": "sis", "arg_names": [], "import_names": [], "rhs_call_name": "IntrospectionServer", "annotation": ""}, "snippet": " sis = IntrospectionServer('touch_simple', sm, '/INPUT_START_CLICK')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L182_C4", "label": "start()", "type": "expression", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "vector": [8, 1, 0.963, 0.0053, 1, 0.8, 0.7143, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " sis.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L184_C4", "label": "outcome = execute()", "type": "assigned_variable", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "vector": [14, 1, 0.9735, 0.0053, 1, 0.8, 0.8571, 805, 3, 0, 0, 0, 569, 10, 1], "semantic": {"name": "outcome", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " outcome = sm.execute()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L186_C4", "label": "stop()", "type": "expression", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "vector": [8, 1, 0.9841, 0.0053, 1, 0.8, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " sis.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L188_C0", "label": "if", "type": "if", "loc": [188, 189], "level": 0, "parent": null, "vector": [4, 0, 0.9974, 0.0106, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L189_C4", "label": "main()", "type": "expression", "loc": [189, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L188_C0", "vector": [8, 1, 1.0, 0.0053, 1, 0.87, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:While_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:While_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L42_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:While_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:Try_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:ClassDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L155_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L155_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L156_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L157_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L158_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L159_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L160_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L161_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L162_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L164_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L165_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L166_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Return_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99502:If_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99502:Expr_L189_C4"}] |
#! /usr/bin/python
import sys
import numpy as np
import scipy.io
import roslib
roslib.load_manifest('hrl_phri_2011')
import rospy
import rosbag
def main():
field_map = {
"time_offset" : "time_offset",
"tool_frame.transform.translation.x" : "pos_x",
"tool_frame.transform.translation.y" : "pos_y",
"tool_frame.transform.translation.z" : "pos_z",
"tool_frame.transform.rotation.x" : "rot_x",
"tool_frame.transform.rotation.y" : "rot_y",
"tool_frame.transform.rotation.z" : "rot_z",
"tool_frame.transform.rotation.w" : "rot_w",
"pc_pt.x" : "pc_pt_x",
"pc_pt.y" : "pc_pt_y",
"pc_pt.z" : "pc_pt_z",
"pc_normal.x" : "pc_norm_x",
"pc_normal.y" : "pc_norm_y",
"pc_normal.z" : "pc_norm_z",
"pc_dist" : "pc_dist",
"wrench.force.x" : "force_x",
"wrench.force.y" : "force_y",
"wrench.force.z" : "force_z",
"wrench.torque.x" : "torque_x",
"wrench.torque.y" : "torque_y",
"wrench.torque.z" : "torque_z",
"force_magnitude" : "force_mag",
"force_normal" : "force_norm",
"force_tangental" : "force_tan",
"contact_period" : "contact_period",
"time_from_contact_start" : "time_contact",
"ell_coords.x" : "lat",
"ell_coords.y" : "long",
"ell_coords.z" : "height",
}
data = {}
for field in field_map:
data[field_map[field]] = []
bag = rosbag.Bag(sys.argv[1], 'r')
for topic, fp, t in bag.read_messages(topics=["/force_processed"]):
for field in field_map:
exec("data['%s'].append(fp.%s)" % (field_map[field], field))
bag.close()
output_file = ".".join(sys.argv[1].split(".")[:-1] + ["mat"])
scipy.io.savemat(output_file, data)
print "Saved mat file to:", output_file
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_99503 | 22 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0492, 0.0164, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0656, 0.0164, 0, 0.66, 0.125, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Import_L5_C0", "label": "scipy.io import scipy.io", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.082, 0.0164, 0, 0.66, 0.25, 670, 0, 1, 0, 0, 670, 0, 0], "semantic": {"name": "scipy.io", "arg_names": [], "import_names": ["scipy.io"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.io"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Import_L7_C0", "label": "roslib import roslib", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1148, 0.0164, 0, 0.66, 0.375, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.1311, 0.0164, 0, 0.66, 0.5, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_phri_2011')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Import_L9_C0", "label": "rospy import rospy", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1475, 0.0164, 0, 0.66, 0.625, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Import_L11_C0", "label": "rosbag import rosbag", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1803, 0.0164, 0, 0.66, 0.75, 243, 0, 1, 0, 0, 243, 0, 0], "semantic": {"name": "rosbag", "arg_names": [], "import_names": ["rosbag"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rosbag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "label": "main", "type": "function", "loc": [13, 58], "level": 0, "parent": null, "vector": [2, 0, 0.582, 0.7541, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n\n field_map = {\n \"time_offset\" : \"time_offset\",\n \"tool_frame.transform.translation.x\" : \"pos_x\",\n \"tool_frame.transform.translation.y\" : \"pos_y\",\n \"tool_frame.transform.translation.z\" : \"pos_z\",\n \"tool_frame.transform.rotation.x\" : \"rot_x\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L15_C4", "label": "field_map =", "type": "assigned_variable", "loc": [15, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [14, 1, 0.4918, 0.5082, 1, 0.04, 0.0, 726, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "field_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_map = {\n \"time_offset\" : \"time_offset\",\n \"tool_frame.transform.translation.x\" : \"pos_x\",\n \"tool_frame.transform.translation.y\" : \"pos_y\",\n \"tool_frame.transform.translation.z\" : \"pos_z\",\n \"tool_frame.transform.rotation.x\" : \"rot_x\",\n \"tool_frame.transform.rotation.y\" : \"rot_y\",\n \"tool_frame.transform.rotation.z\" : \"rot_z\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L46_C4", "label": "data =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [14, 1, 0.7541, 0.0164, 1, 0.04, 0.125, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L47_C4", "label": "for field", "type": "for", "loc": [47, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [6, 1, 0.7787, 0.0328, 1, 0.04, 0.25, 480, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in field_map:\n data[field_map[field]] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L48_C8", "label": "assign", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L47_C4", "vector": [14, 2, 0.7869, 0.0164, 2, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data[field_map[field]] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L50_C4", "label": "bag = Bag()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [14, 1, 0.8197, 0.0164, 1, 0.04, 0.375, 117, 3, 2, 0, 0, 568, 10, 1], "semantic": {"name": "bag", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " bag = rosbag.Bag(sys.argv[1], 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L51_C4", "label": "for topic, fp, t", "type": "for", "loc": [51, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [6, 1, 0.8525, 0.0492, 1, 0.04, 0.5, 845, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "topic, fp, t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for topic, fp, t in bag.read_messages(topics=[\"/force_processed\"]):\n for field in field_map:\n exec(\"data['%s'].append(fp.%s)\" % (field_map[field], field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L52_C8", "label": "for field", "type": "for", "loc": [52, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L51_C4", "vector": [6, 2, 0.8607, 0.0328, 2, 0.65, 0.0, 480, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in field_map:\n exec(\"data['%s'].append(fp.%s)\" % (field_map[field], field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L53_C12", "label": "exec()", "type": "expression", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L52_C8", "vector": [8, 3, 0.8689, 0.0164, 3, 0.9, 0.0, 272, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exec", "arg_names": [], "import_names": [], "rhs_call_name": "exec", "annotation": ""}, "snippet": " exec(\"data['%s'].append(fp.%s)\" % (field_map[field], field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L54_C4", "label": "close()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [8, 1, 0.8852, 0.0164, 1, 0.04, 0.625, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bag.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L56_C4", "label": "output_file = join()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [14, 1, 0.918, 0.0164, 1, 0.04, 0.75, 395, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "output_file", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " output_file = \".\".join(sys.argv[1].split(\".\")[:-1] + [\"mat\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L57_C4", "label": "savemat()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [8, 1, 0.9344, 0.0164, 1, 0.04, 0.875, 421, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "savemat", "arg_names": [], "import_names": [], "rhs_call_name": "savemat", "annotation": ""}, "snippet": " scipy.io.savemat(output_file, data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L58_C4", "label": "print()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "vector": [8, 1, 0.9508, 0.0164, 1, 0.04, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Saved mat file to:\", output_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:If_L60_C0", "label": "if", "type": "if", "loc": [60, 61], "level": 0, "parent": null, "vector": [4, 0, 0.9918, 0.0328, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L61_C4", "label": "main()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99503:If_L60_C0", "vector": [8, 1, 1.0, 0.0164, 1, 0.21, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:For_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99503:If_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99503:Expr_L61_C4"}] |
#! /usr/bin/python
import sys
import numpy as np
import roslib
roslib.load_manifest('hrl_pr2_arms')
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
import rospy
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
import tf
import tf.transformations as tf_trans
from std_msgs.msg import Bool, Float32
from std_srvs.srv import Empty
from geometry_msgs.msg import PoseStamped, Vector3
from actionlib_msgs.msg import GoalStatus
from pr2_controllers_msgs.msg import Pr2GripperCommandAction, Pr2GripperCommandGoal
from hrl_generic_arms.pose_converter import PoseConverter
from hrl_pr2_arms.pr2_arm import create_pr2_arm
from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce
def main():
rospy.init_node("load_tool")
from optparse import OptionParser
p = OptionParser()
p.add_option('-w', '--wait', dest="wait", default=6,
help="Set wait time.")
p.add_option('-r', '--relax', dest="relax", default=False,
action="store_true", help="Set the gripper torque to 0.")
p.add_option('-t', '--tighten', dest="tighten", default=False,
action="store_true", help="Set the gripper torque to 30.")
(opts, args) = p.parse_args()
g_client = actionlib.SimpleActionClient('l_gripper_controller/gripper_action', Pr2GripperCommandAction)
g_client.wait_for_server()
g_goal = Pr2GripperCommandGoal()
if opts.relax:
g_goal.command.position = 0
g_goal.command.max_effort = 0
g_client.send_goal(g_goal)
#g_client.wait_for_result()
return
if opts.tighten:
g_goal.command.position = 0
g_goal.command.max_effort = 30
g_client.send_goal(g_goal)
g_client.wait_for_result()
return
g_goal.command.position = 1
g_goal.command.max_effort = -1
g_client.send_goal(g_goal)
g_client.wait_for_result()
rospy.sleep(float(opts.wait))
g_goal.command.position = 0
g_goal.command.max_effort = 30
g_client.send_goal(g_goal)
g_client.wait_for_result()
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_99504 | 53 | 73 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0411, 0.0137, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0548, 0.0137, 0, 0.66, 0.0476, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Import_L6_C0", "label": "roslib import roslib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0822, 0.0137, 0, 0.66, 0.0952, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0959, 0.0137, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_pr2_arms')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.1096, 0.0137, 0, 0.66, 0.1905, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.1233, 0.0137, 0, 0.66, 0.2381, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Import_L10_C0", "label": "rospy import rospy", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.137, 0.0137, 0, 0.66, 0.2857, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Import_L12_C0", "label": "smach import smach", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1644, 0.0137, 0, 0.66, 0.3333, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L13_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1781, 0.0137, 0, 0.66, 0.381, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Import_L14_C0", "label": "actionlib import actionlib", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1918, 0.0137, 0, 0.66, 0.4286, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Import_L15_C0", "label": "tf import tf", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.2055, 0.0137, 0, 0.66, 0.4762, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Import_L16_C0", "label": "tf.transformations import tf_trans", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.2192, 0.0137, 0, 0.66, 0.5238, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tf_trans"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tf_trans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L17_C0", "label": "from std_msgs.msg import Bool, Float32", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2329, 0.0137, 0, 0.66, 0.5714, 366, 0, 2, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Bool", "Float32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Bool, Float32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L18_C0", "label": "from std_srvs.srv import Empty", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.2466, 0.0137, 0, 0.66, 0.619, 261, 0, 1, 0, 0, 261, 0, 0], "semantic": {"name": "std_srvs.srv", "arg_names": [], "import_names": ["Empty"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_srvs.srv import Empty"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L19_C0", "label": "from geometry_msgs.msg import PoseStamped, Vector3", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2603, 0.0137, 0, 0.66, 0.6667, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped", "Vector3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped, Vector3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L20_C0", "label": "from actionlib_msgs.msg import GoalStatus", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.274, 0.0137, 0, 0.66, 0.7143, 245, 0, 1, 0, 0, 245, 0, 0], "semantic": {"name": "actionlib_msgs.msg", "arg_names": [], "import_names": ["GoalStatus"], "rhs_call_name": "", "annotation": ""}, "snippet": "from actionlib_msgs.msg import GoalStatus"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L21_C0", "label": "from pr2_controllers_msgs.msg import Pr2GripperCommandAction, Pr2GripperCommandGoal", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.2877, 0.0137, 0, 0.66, 0.7619, 457, 0, 2, 0, 0, 457, 0, 0], "semantic": {"name": "pr2_controllers_msgs.msg", "arg_names": [], "import_names": ["Pr2GripperCommandAction", "Pr2GripperCommandGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pr2_controllers_msgs.msg import Pr2GripperCommandAction, Pr2GripperCommandGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L23_C0", "label": "from hrl_generic_arms.pose_converter import PoseConverter", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.3151, 0.0137, 0, 0.66, 0.8095, 752, 0, 1, 0, 0, 752, 0, 0], "semantic": {"name": "hrl_generic_arms.pose_converter", "arg_names": [], "import_names": ["PoseConverter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_generic_arms.pose_converter import PoseConverter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L24_C0", "label": "from hrl_pr2_arms.pr2_arm import create_pr2_arm", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.3288, 0.0137, 0, 0.66, 0.8571, 253, 0, 1, 0, 0, 253, 0, 0], "semantic": {"name": "hrl_pr2_arms.pr2_arm", "arg_names": [], "import_names": ["create_pr2_arm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_pr2_arms.pr2_arm import create_pr2_arm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L25_C0", "label": "from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.3425, 0.0137, 0, 0.66, 0.9048, 910, 0, 1, 0, 0, 910, 0, 0], "semantic": {"name": "hrl_pr2_arms.pr2_arm_hybrid", "arg_names": [], "import_names": ["PR2ArmHybridForce"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "label": "main", "type": "function", "loc": [27, 70], "level": 0, "parent": null, "vector": [2, 0, 0.6644, 0.6027, 0, 0.66, 0.9524, 624, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n rospy.init_node(\"load_tool\")\n\n from optparse import OptionParser\n p = OptionParser()\n p.add_option('-w', '--wait', dest=\"wait\", default=6,\n help=\"Set wait time.\")\n p.add_option('-r', '--relax', dest=\"relax\", default=False,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L28_C4", "label": "init_node()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.3836, 0.0137, 1, 0.77, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node(\"load_tool\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L30_C4", "label": "from optparse import OptionParser", "type": "import", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [1, 1, 0.411, 0.0137, 1, 0.77, 0.05, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["OptionParser"], "rhs_call_name": "", "annotation": ""}, "snippet": " from optparse import OptionParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L31_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [14, 1, 0.4247, 0.0137, 1, 0.77, 0.1, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L32_C4", "label": "add_option()", "type": "expression", "loc": [32, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.4452, 0.0274, 1, 0.77, 0.15, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-w', '--wait', dest=\"wait\", default=6,\n help=\"Set wait time.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L34_C4", "label": "add_option()", "type": "expression", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.4726, 0.0274, 1, 0.77, 0.2, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-r', '--relax', dest=\"relax\", default=False,\n action=\"store_true\", help=\"Set the gripper torque to 0.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L36_C4", "label": "add_option()", "type": "expression", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.5, 0.0274, 1, 0.77, 0.25, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-t', '--tighten', dest=\"tighten\", default=False,\n action=\"store_true\", help=\"Set the gripper torque to 30.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L38_C4", "label": "opts, args = parse_args()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [14, 1, 0.5205, 0.0137, 1, 0.77, 0.3, 616, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " (opts, args) = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L40_C4", "label": "g_client = SimpleActionClient()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [14, 1, 0.5479, 0.0137, 1, 0.77, 0.35, 803, 3, 2, 0, 0, 230, 10, 1], "semantic": {"name": "g_client", "arg_names": [], "import_names": [], "rhs_call_name": "SimpleActionClient", "annotation": ""}, "snippet": " g_client = actionlib.SimpleActionClient('l_gripper_controller/gripper_action', Pr2GripperCommandAction)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L41_C4", "label": "wait_for_server()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.5616, 0.0137, 1, 0.77, 0.4, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_server", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_server", "annotation": ""}, "snippet": " g_client.wait_for_server()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L43_C4", "label": "g_goal = Pr2GripperCommandGoal()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [14, 1, 0.589, 0.0137, 1, 0.77, 0.45, 125, 3, 0, 0, 0, 981, 10, 1], "semantic": {"name": "g_goal", "arg_names": [], "import_names": [], "rhs_call_name": "Pr2GripperCommandGoal", "annotation": ""}, "snippet": " g_goal = Pr2GripperCommandGoal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "label": "if", "type": "if", "loc": [45, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [4, 1, 0.6507, 0.0822, 1, 0.77, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opts.relax:\n g_goal.command.position = 0\n g_goal.command.max_effort = 0\n g_client.send_goal(g_goal)\n #g_client.wait_for_result()\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L46_C8", "label": "g_goal.command.position =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "vector": [14, 2, 0.6301, 0.0137, 2, 0.7, 0.0, 705, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "g_goal.command.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g_goal.command.position = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L47_C8", "label": "g_goal.command.max_effort =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "vector": [14, 2, 0.6438, 0.0137, 2, 0.7, 0.3333, 10, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "g_goal.command.max_effort", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g_goal.command.max_effort = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L48_C8", "label": "send_goal()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "vector": [8, 2, 0.6575, 0.0137, 2, 0.7, 0.6667, 184, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_goal", "arg_names": [], "import_names": [], "rhs_call_name": "send_goal", "annotation": ""}, "snippet": " g_client.send_goal(g_goal)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Return_L50_C8", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "vector": [13, 2, 0.6849, 0.0137, 2, 0.7, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "label": "if", "type": "if", "loc": [52, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [4, 1, 0.7466, 0.0822, 1, 0.77, 0.55, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opts.tighten:\n g_goal.command.position = 0\n g_goal.command.max_effort = 30\n g_client.send_goal(g_goal)\n g_client.wait_for_result()\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L53_C8", "label": "g_goal.command.position =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "vector": [14, 2, 0.726, 0.0137, 2, 0.03, 0.0, 705, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "g_goal.command.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g_goal.command.position = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L54_C8", "label": "g_goal.command.max_effort =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "vector": [14, 2, 0.7397, 0.0137, 2, 0.03, 0.25, 10, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "g_goal.command.max_effort", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g_goal.command.max_effort = 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L55_C8", "label": "send_goal()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "vector": [8, 2, 0.7534, 0.0137, 2, 0.03, 0.5, 184, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_goal", "arg_names": [], "import_names": [], "rhs_call_name": "send_goal", "annotation": ""}, "snippet": " g_client.send_goal(g_goal)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L56_C8", "label": "wait_for_result()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "vector": [8, 2, 0.7671, 0.0137, 2, 0.03, 0.75, 328, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_result", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_result", "annotation": ""}, "snippet": " g_client.wait_for_result()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Return_L57_C8", "label": "return", "type": "return", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "vector": [13, 2, 0.7808, 0.0137, 2, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L60_C4", "label": "g_goal.command.position =", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [14, 1, 0.8219, 0.0137, 1, 0.77, 0.6, 705, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "g_goal.command.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g_goal.command.position = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L61_C4", "label": "g_goal.command.max_effort =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [14, 1, 0.8356, 0.0137, 1, 0.77, 0.65, 10, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "g_goal.command.max_effort", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g_goal.command.max_effort = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L62_C4", "label": "send_goal()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.8493, 0.0137, 1, 0.77, 0.7, 184, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_goal", "arg_names": [], "import_names": [], "rhs_call_name": "send_goal", "annotation": ""}, "snippet": " g_client.send_goal(g_goal)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L63_C4", "label": "wait_for_result()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.863, 0.0137, 1, 0.77, 0.75, 328, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_result", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_result", "annotation": ""}, "snippet": " g_client.wait_for_result()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L65_C4", "label": "sleep()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.8904, 0.0137, 1, 0.77, 0.8, 476, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(float(opts.wait))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L67_C4", "label": "g_goal.command.position =", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [14, 1, 0.9178, 0.0137, 1, 0.77, 0.85, 705, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "g_goal.command.position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g_goal.command.position = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L68_C4", "label": "g_goal.command.max_effort =", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [14, 1, 0.9315, 0.0137, 1, 0.77, 0.9, 10, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "g_goal.command.max_effort", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g_goal.command.max_effort = 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L69_C4", "label": "send_goal()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.9452, 0.0137, 1, 0.77, 0.95, 184, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_goal", "arg_names": [], "import_names": [], "rhs_call_name": "send_goal", "annotation": ""}, "snippet": " g_client.send_goal(g_goal)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L70_C4", "label": "wait_for_result()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "vector": [8, 1, 0.9589, 0.0137, 1, 0.77, 1.0, 328, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "wait_for_result", "arg_names": [], "import_names": [], "rhs_call_name": "wait_for_result", "annotation": ""}, "snippet": " g_client.wait_for_result()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L72_C0", "label": "if", "type": "if", "loc": [72, 73], "level": 0, "parent": null, "vector": [4, 0, 0.9932, 0.0274, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L73_C4", "label": "main()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L72_C0", "vector": [8, 1, 1.0, 0.0137, 1, 0.44, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:ImportFrom_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Return_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Return_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99504:If_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99504:Expr_L73_C4"}] |
#! /usr/bin/python
import sys
import numpy as np
import scipy.io
import roslib
roslib.load_manifest('hrl_phri_2011')
import rospy
import rosbag
def main():
field_map = {
"/l_cart/f_cmd" :
{
"wrench.force.x" : "f_cmd_x",
"wrench.force.y" : "f_cmd_y",
"wrench.force.z" : "f_cmd_z",
"wrench.torque.x" : "t_cmd_x",
"wrench.torque.y" : "t_cmd_y",
"wrench.torque.z" : "t_cmd_z"
},
"/l_cart/f_err" :
{
"wrench.force.x" : "f_err_x",
"wrench.force.y" : "f_err_y",
"wrench.force.z" : "f_err_z",
"wrench.torque.x" : "t_err_x",
"wrench.torque.y" : "t_err_y",
"wrench.torque.z" : "t_err_z"
},
"/l_cart/k_effective" :
{
"wrench.force.x" : "k_eff_x",
"wrench.force.y" : "k_eff_y",
"wrench.force.z" : "k_eff_z",
"wrench.torque.x" : "kt_eff_x",
"wrench.torque.y" : "kt_eff_y",
"wrench.torque.z" : "kt_eff_z"
},
"/l_cart/sensor_ft" :
{
"wrench.force.x" : "f_sens_x",
"wrench.force.y" : "f_sens_y",
"wrench.force.z" : "f_sens_z",
"wrench.torque.x" : "t_sens_x",
"wrench.torque.y" : "t_sens_y",
"wrench.torque.z" : "t_sens_z"
},
"/l_cart/sensor_raw_ft" :
{
"wrench.force.x" : "f_sens_raw_x",
"wrench.force.y" : "f_sens_raw_y",
"wrench.force.z" : "f_sens_raw_z",
"wrench.torque.x" : "t_sens_raw_x",
"wrench.torque.y" : "t_sens_raw_y",
"wrench.torque.z" : "t_sens_raw_z"
},
"/l_cart/state/x" :
{
"pose.position.x" : "pos_x",
"pose.position.y" : "pos_y",
"pose.position.z" : "pos_z",
"pose.orientation.x" : "rot_x",
"pose.orientation.y" : "rot_y",
"pose.orientation.z" : "rot_z",
"pose.orientation.w" : "rot_w",
},
"/l_cart/state/xd" :
{
"linear.x" : "vel_x",
"linear.y" : "vel_y",
"linear.z" : "vel_z",
"angular.x" : "avel_x",
"angular.y" : "avel_y",
"angular.z" : "avel_z"
},
"/l_cart/x_err" :
{
"linear.x" : "pos_err_x",
"linear.y" : "pos_err_y",
"linear.z" : "pos_err_z",
"angular.x" : "rot_err_x",
"angular.y" : "rot_err_y",
"angular.z" : "rot_err_z"
}
}
data = {}
for topic in field_map:
for field in field_map[topic]:
data[field_map[topic][field]] = []
bag = rosbag.Bag(sys.argv[1], 'r')
for topic in field_map:
for tp, fp, t in bag.read_messages(topics=[topic]):
for field in field_map[topic]:
exec("data['%s'].append(fp.%s)" % (field_map[topic][field], field))
bag.close()
output_file = sys.argv[1].split(".")[0] + ".mat"
scipy.io.savemat(output_file, data)
print "Saved mat file to:", output_file
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_99505 | 24 | 107 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.028, 0.0093, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0374, 0.0093, 0, 0.66, 0.125, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Import_L5_C0", "label": "scipy.io import scipy.io", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0467, 0.0093, 0, 0.66, 0.25, 670, 0, 1, 0, 0, 670, 0, 0], "semantic": {"name": "scipy.io", "arg_names": [], "import_names": ["scipy.io"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.io"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Import_L7_C0", "label": "roslib import roslib", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0654, 0.0093, 0, 0.66, 0.375, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0748, 0.0093, 0, 0.66, 0.5, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_phri_2011')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Import_L9_C0", "label": "rospy import rospy", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0841, 0.0093, 0, 0.66, 0.625, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Import_L11_C0", "label": "rosbag import rosbag", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1028, 0.0093, 0, 0.66, 0.75, 243, 0, 1, 0, 0, 243, 0, 0], "semantic": {"name": "rosbag", "arg_names": [], "import_names": ["rosbag"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rosbag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "label": "main", "type": "function", "loc": [13, 104], "level": 0, "parent": null, "vector": [2, 0, 0.5467, 0.8598, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n\n field_map = {\n \"/l_cart/f_cmd\" : \n {\n \"wrench.force.x\" : \"f_cmd_x\",\n \"wrench.force.y\" : \"f_cmd_y\",\n \"wrench.force.z\" : \"f_cmd_z\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L15_C4", "label": "field_map =", "type": "assigned_variable", "loc": [15, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [14, 1, 0.486, 0.7009, 1, 0.91, 0.0, 726, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "field_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_map = {\n \"/l_cart/f_cmd\" : \n {\n \"wrench.force.x\" : \"f_cmd_x\",\n \"wrench.force.y\" : \"f_cmd_y\",\n \"wrench.force.z\" : \"f_cmd_z\",\n \"wrench.torque.x\" : \"t_cmd_x\",\n \"wrench.torque.y\" : \"t_cmd_y\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L90_C4", "label": "data =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [14, 1, 0.8411, 0.0093, 1, 0.91, 0.125, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L91_C4", "label": "for topic", "type": "for", "loc": [91, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [6, 1, 0.8598, 0.028, 1, 0.91, 0.25, 225, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "topic", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for topic in field_map:\n for field in field_map[topic]:\n data[field_map[topic][field]] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L92_C8", "label": "for field", "type": "for", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L91_C4", "vector": [6, 2, 0.8645, 0.0187, 2, 0.44, 0.0, 480, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in field_map[topic]:\n data[field_map[topic][field]] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L93_C12", "label": "assign", "type": "assigned_variable", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L92_C8", "vector": [14, 3, 0.8692, 0.0093, 3, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data[field_map[topic][field]] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L95_C4", "label": "bag = Bag()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [14, 1, 0.8879, 0.0093, 1, 0.91, 0.375, 117, 3, 2, 0, 0, 568, 10, 1], "semantic": {"name": "bag", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " bag = rosbag.Bag(sys.argv[1], 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L96_C4", "label": "for topic", "type": "for", "loc": [96, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [6, 1, 0.9112, 0.0374, 1, 0.91, 0.5, 225, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "topic", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for topic in field_map:\n for tp, fp, t in bag.read_messages(topics=[topic]):\n for field in field_map[topic]:\n exec(\"data['%s'].append(fp.%s)\" % (field_map[topic][field], field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L97_C8", "label": "for tp, fp, t", "type": "for", "loc": [97, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L96_C4", "vector": [6, 2, 0.9159, 0.028, 2, 0.72, 0.0, 716, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tp, fp, t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tp, fp, t in bag.read_messages(topics=[topic]):\n for field in field_map[topic]:\n exec(\"data['%s'].append(fp.%s)\" % (field_map[topic][field], field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L98_C12", "label": "for field", "type": "for", "loc": [98, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L97_C8", "vector": [6, 3, 0.9206, 0.0187, 3, 0.6, 0.0, 480, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in field_map[topic]:\n exec(\"data['%s'].append(fp.%s)\" % (field_map[topic][field], field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L99_C16", "label": "exec()", "type": "expression", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L98_C12", "vector": [8, 4, 0.9252, 0.0093, 4, 0.73, 0.0, 272, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exec", "arg_names": [], "import_names": [], "rhs_call_name": "exec", "annotation": ""}, "snippet": " exec(\"data['%s'].append(fp.%s)\" % (field_map[topic][field], field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L100_C4", "label": "close()", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [8, 1, 0.9346, 0.0093, 1, 0.91, 0.625, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bag.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L102_C4", "label": "output_file =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [14, 1, 0.9533, 0.0093, 1, 0.91, 0.75, 395, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "output_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " output_file = sys.argv[1].split(\".\")[0] + \".mat\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L103_C4", "label": "savemat()", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [8, 1, 0.9626, 0.0093, 1, 0.91, 0.875, 421, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "savemat", "arg_names": [], "import_names": [], "rhs_call_name": "savemat", "annotation": ""}, "snippet": " scipy.io.savemat(output_file, data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L104_C4", "label": "print()", "type": "expression", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "vector": [8, 1, 0.972, 0.0093, 1, 0.91, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Saved mat file to:\", output_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:If_L106_C0", "label": "if", "type": "if", "loc": [106, 107], "level": 0, "parent": null, "vector": [4, 0, 0.9953, 0.0187, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L107_C4", "label": "main()", "type": "expression", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99505:If_L106_C0", "vector": [8, 1, 1.0, 0.0093, 1, 0.88, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:For_L98_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L99_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99505:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99505:Expr_L107_C4"}] |
#! /usr/bin/python
import sys
import numpy as np
import scipy.io
import scipy.stats
import matplotlib.pyplot as plt
import roslib
roslib.load_manifest('hrl_phri_2011')
import rospy
import rosbag
def main():
bag = rosbag.Bag(sys.argv[1], 'r')
x_forces, cur_x_forces = [], []
for topic, msg, t in bag.read_messages(topics=["/l_cart/sensor_ft"]):
f = [msg.wrench.force.x, msg.wrench.force.y, msg.wrench.force.z]
f_mag = np.linalg.norm(f)
if f_mag > 0.5:
cur_x_forces.append(msg.wrench.force.x)
else:
if len(cur_x_forces) >= 20:
x_forces.extend(cur_x_forces)
cur_x_forces = []
if len(cur_x_forces) >= 20:
x_forces.extend(cur_x_forces)
bag.close()
ptile_inds = [25, 50, 75, 95]
ptiles = {}
for ptile in ptile_inds:
ptiles[ptile] = scipy.stats.scoreatpercentile(x_forces, ptile)
print "Percentile %d: %f" % (ptile, ptiles[ptile])
#plt.plot(x_forces)
#plt.show()
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_99507 | 30 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0256, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1026, 0.0256, 0, 0.66, 0.1, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Import_L5_C0", "label": "scipy.io import scipy.io", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1282, 0.0256, 0, 0.66, 0.2, 670, 0, 1, 0, 0, 670, 0, 0], "semantic": {"name": "scipy.io", "arg_names": [], "import_names": ["scipy.io"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.io"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Import_L6_C0", "label": "scipy.stats import scipy.stats", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0256, 0, 0.66, 0.3, 413, 0, 1, 0, 0, 413, 0, 0], "semantic": {"name": "scipy.stats", "arg_names": [], "import_names": ["scipy.stats"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.stats"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Import_L7_C0", "label": "matplotlib.pyplot import plt", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1795, 0.0256, 0, 0.66, 0.4, 596, 0, 1, 0, 0, 596, 0, 0], "semantic": {"name": "matplotlib.pyplot", "arg_names": [], "import_names": ["plt"], "rhs_call_name": "", "annotation": ""}, "snippet": "import matplotlib.pyplot as plt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Import_L9_C0", "label": "roslib import roslib", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0256, 0, 0.66, 0.5, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L10_C0", "label": "load_manifest()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.2564, 0.0256, 0, 0.66, 0.6, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_phri_2011')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Import_L11_C0", "label": "rospy import rospy", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2821, 0.0256, 0, 0.66, 0.7, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Import_L13_C0", "label": "rosbag import rosbag", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0256, 0, 0.66, 0.8, 243, 0, 1, 0, 0, 243, 0, 0], "semantic": {"name": "rosbag", "arg_names": [], "import_names": ["rosbag"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rosbag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "label": "main", "type": "function", "loc": [15, 34], "level": 0, "parent": null, "vector": [2, 0, 0.6282, 0.5128, 0, 0.66, 0.9, 624, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n bag = rosbag.Bag(sys.argv[1], 'r')\n x_forces, cur_x_forces = [], []\n for topic, msg, t in bag.read_messages(topics=[\"/l_cart/sensor_ft\"]):\n f = [msg.wrench.force.x, msg.wrench.force.y, msg.wrench.force.z]\n f_mag = np.linalg.norm(f)\n if f_mag > 0.5:\n cur_x_forces.append(msg.wrench.force.x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L16_C4", "label": "bag = Bag()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "vector": [14, 1, 0.4103, 0.0256, 1, 0.36, 0.0, 117, 3, 2, 0, 0, 568, 10, 1], "semantic": {"name": "bag", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " bag = rosbag.Bag(sys.argv[1], 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L17_C4", "label": "x_forces, cur_x_forces =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "vector": [14, 1, 0.4359, 0.0256, 1, 0.36, 0.1429, 209, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "x_forces, cur_x_forces", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x_forces, cur_x_forces = [], []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L18_C4", "label": "for topic, msg, t", "type": "for", "loc": [18, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "vector": [6, 1, 0.5641, 0.2308, 1, 0.36, 0.2857, 35, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "topic, msg, t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for topic, msg, t in bag.read_messages(topics=[\"/l_cart/sensor_ft\"]):\n f = [msg.wrench.force.x, msg.wrench.force.y, msg.wrench.force.z]\n f_mag = np.linalg.norm(f)\n if f_mag > 0.5:\n cur_x_forces.append(msg.wrench.force.x)\n else:\n if len(cur_x_forces) >= 20:\n x_forces.extend(cur_x_forces)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L19_C8", "label": "f =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L18_C4", "vector": [14, 2, 0.4872, 0.0256, 2, 0.37, 0.0, 899, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f = [msg.wrench.force.x, msg.wrench.force.y, msg.wrench.force.z]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L20_C8", "label": "f_mag = norm()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L18_C4", "vector": [14, 2, 0.5128, 0.0256, 2, 0.37, 0.5, 921, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "f_mag", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " f_mag = np.linalg.norm(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L21_C8", "label": "if", "type": "if", "loc": [21, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L18_C4", "vector": [4, 2, 0.6026, 0.1538, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f_mag > 0.5:\n cur_x_forces.append(msg.wrench.force.x)\n else:\n if len(cur_x_forces) >= 20:\n x_forces.extend(cur_x_forces)\n cur_x_forces = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L22_C12", "label": "append()", "type": "expression", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L21_C8", "vector": [8, 3, 0.5641, 0.0256, 3, 0.07, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " cur_x_forces.append(msg.wrench.force.x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L24_C12", "label": "if", "type": "if", "loc": [24, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L21_C8", "vector": [4, 3, 0.6282, 0.0513, 3, 0.07, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(cur_x_forces) >= 20:\n x_forces.extend(cur_x_forces)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L25_C16", "label": "extend()", "type": "expression", "loc": [25, 25], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L24_C12", "vector": [8, 4, 0.641, 0.0256, 4, 0.97, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " x_forces.extend(cur_x_forces)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L26_C12", "label": "cur_x_forces =", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L21_C8", "vector": [14, 3, 0.6667, 0.0256, 3, 0.07, 1.0, 412, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "cur_x_forces", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cur_x_forces = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L27_C4", "label": "if", "type": "if", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "vector": [4, 1, 0.7051, 0.0513, 1, 0.36, 0.4286, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(cur_x_forces) >= 20:\n x_forces.extend(cur_x_forces)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L28_C8", "label": "extend()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L27_C4", "vector": [8, 2, 0.7179, 0.0256, 2, 0.0, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " x_forces.extend(cur_x_forces)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L29_C4", "label": "close()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "vector": [8, 1, 0.7436, 0.0256, 1, 0.36, 0.5714, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bag.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L30_C4", "label": "ptile_inds =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "vector": [14, 1, 0.7692, 0.0256, 1, 0.36, 0.7143, 799, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ptile_inds", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptile_inds = [25, 50, 75, 95]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L31_C4", "label": "ptiles =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "vector": [14, 1, 0.7949, 0.0256, 1, 0.36, 0.8571, 930, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ptiles", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptiles = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L32_C4", "label": "for ptile", "type": "for", "loc": [32, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "vector": [6, 1, 0.8462, 0.0769, 1, 0.36, 1.0, 834, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "ptile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ptile in ptile_inds:\n ptiles[ptile] = scipy.stats.scoreatpercentile(x_forces, ptile)\n print(\"Percentile %d: %f\" % (ptile, ptiles[ptile]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L33_C8", "label": " = scoreatpercentile()", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L32_C4", "vector": [14, 2, 0.8462, 0.0256, 2, 0.4, 0.0, 0, 3, 2, 0, 0, 703, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "scoreatpercentile", "annotation": ""}, "snippet": " ptiles[ptile] = scipy.stats.scoreatpercentile(x_forces, ptile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L34_C8", "label": "print()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L32_C4", "vector": [8, 2, 0.8718, 0.0256, 2, 0.4, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Percentile %d: %f\" % (ptile, ptiles[ptile]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L38_C0", "label": "if", "type": "if", "loc": [38, 39], "level": 0, "parent": null, "vector": [4, 0, 0.9872, 0.0513, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L39_C4", "label": "main()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L38_C0", "vector": [8, 1, 1.0, 0.0256, 1, 0.18, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L24_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L25_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:For_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99507:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99507:Expr_L39_C4"}] |
#! /usr/bin/python
import sys
import numpy as np
import scipy.io
import roslib
roslib.load_manifest('hrl_phri_2011')
import rospy
import rosbag
def main():
bag = rosbag.Bag(sys.argv[1], 'r')
prefix = ".".join(sys.argv[1].split(".")[:-1])
fixed_file = prefix + "_fixed.bag"
fixed_bag = rosbag.Bag(fixed_file, 'w')
for topic, tf_msg, t in bag.read_messages():
if topic == "/tf":
if len(tf_msg.transforms) > 0 and tf_msg.transforms[0].child_frame_id == "/tool_netft_raw_frame":
tf_msg.transforms[0].transform.rotation.x = 0
tf_msg.transforms[0].transform.rotation.y = 0
tf_msg.transforms[0].transform.rotation.z = 1
tf_msg.transforms[0].transform.rotation.w = 0
fixed_bag.write(topic, tf_msg, t)
bag.close()
fixed_bag.close()
print "Saved fixed bag to:", fixed_file
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_99508 | 25 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0938, 0.0312, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0312, 0, 0.66, 0.125, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Import_L5_C0", "label": "scipy.io import scipy.io", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1562, 0.0312, 0, 0.66, 0.25, 670, 0, 1, 0, 0, 670, 0, 0], "semantic": {"name": "scipy.io", "arg_names": [], "import_names": ["scipy.io"], "rhs_call_name": "", "annotation": ""}, "snippet": "import scipy.io"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Import_L7_C0", "label": "roslib import roslib", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.2188, 0.0312, 0, 0.66, 0.375, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.25, 0.0312, 0, 0.66, 0.5, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_phri_2011')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Import_L9_C0", "label": "rospy import rospy", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.2812, 0.0312, 0, 0.66, 0.625, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Import_L11_C0", "label": "rosbag import rosbag", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.3438, 0.0312, 0, 0.66, 0.75, 243, 0, 1, 0, 0, 243, 0, 0], "semantic": {"name": "rosbag", "arg_names": [], "import_names": ["rosbag"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rosbag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "label": "main", "type": "function", "loc": [13, 28], "level": 0, "parent": null, "vector": [2, 0, 0.6406, 0.5, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n bag = rosbag.Bag(sys.argv[1], 'r')\n prefix = \".\".join(sys.argv[1].split(\".\")[:-1])\n fixed_file = prefix + \"_fixed.bag\"\n fixed_bag = rosbag.Bag(fixed_file, 'w')\n for topic, tf_msg, t in bag.read_messages():\n if topic == \"/tf\":\n if len(tf_msg.transforms) > 0 and tf_msg.transforms[0].child_frame_id == \"/tool_netft_raw_frame\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L14_C4", "label": "bag = Bag()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "vector": [14, 1, 0.4375, 0.0312, 1, 0.56, 0.0, 117, 3, 2, 0, 0, 568, 10, 1], "semantic": {"name": "bag", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " bag = rosbag.Bag(sys.argv[1], 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L15_C4", "label": "prefix = join()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "vector": [14, 1, 0.4688, 0.0312, 1, 0.56, 0.1429, 284, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " prefix = \".\".join(sys.argv[1].split(\".\")[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L16_C4", "label": "fixed_file =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "vector": [14, 1, 0.5, 0.0312, 1, 0.56, 0.2857, 932, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fixed_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fixed_file = prefix + \"_fixed.bag\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L17_C4", "label": "fixed_bag = Bag()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "vector": [14, 1, 0.5312, 0.0312, 1, 0.56, 0.4286, 516, 3, 2, 0, 0, 568, 10, 1], "semantic": {"name": "fixed_bag", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " fixed_bag = rosbag.Bag(fixed_file, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:For_L18_C4", "label": "for topic, tf_msg, t", "type": "for", "loc": [18, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "vector": [6, 1, 0.6719, 0.25, 1, 0.56, 0.5714, 839, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "topic, tf_msg, t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for topic, tf_msg, t in bag.read_messages():\n if topic == \"/tf\":\n if len(tf_msg.transforms) > 0 and tf_msg.transforms[0].child_frame_id == \"/tool_netft_raw_frame\":\n tf_msg.transforms[0].transform.rotation.x = 0\n tf_msg.transforms[0].transform.rotation.y = 0\n tf_msg.transforms[0].transform.rotation.z = 1\n tf_msg.transforms[0].transform.rotation.w = 0\n fixed_bag.write(topic, tf_msg, t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L19_C8", "label": "if", "type": "if", "loc": [19, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:For_L18_C4", "vector": [4, 2, 0.6719, 0.1875, 2, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if topic == \"/tf\":\n if len(tf_msg.transforms) > 0 and tf_msg.transforms[0].child_frame_id == \"/tool_netft_raw_frame\":\n tf_msg.transforms[0].transform.rotation.x = 0\n tf_msg.transforms[0].transform.rotation.y = 0\n tf_msg.transforms[0].transform.rotation.z = 1\n tf_msg.transforms[0].transform.rotation.w = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "label": "if", "type": "if", "loc": [20, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L19_C8", "vector": [4, 3, 0.6875, 0.1562, 3, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(tf_msg.transforms) > 0 and tf_msg.transforms[0].child_frame_id == \"/tool_netft_raw_frame\":\n tf_msg.transforms[0].transform.rotation.x = 0\n tf_msg.transforms[0].transform.rotation.y = 0\n tf_msg.transforms[0].transform.rotation.z = 1\n tf_msg.transforms[0].transform.rotation.w = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L21_C16", "label": "tf_msg.transforms[0].transform.rotation.x =", "type": "assigned_variable", "loc": [21, 21], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "vector": [14, 4, 0.6562, 0.0312, 4, 0.21, 0.0, 390, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tf_msg.transforms[0].transform.rotation.x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tf_msg.transforms[0].transform.rotation.x = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L22_C16", "label": "tf_msg.transforms[0].transform.rotation.y =", "type": "assigned_variable", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "vector": [14, 4, 0.6875, 0.0312, 4, 0.21, 0.3333, 413, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tf_msg.transforms[0].transform.rotation.y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tf_msg.transforms[0].transform.rotation.y = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L23_C16", "label": "tf_msg.transforms[0].transform.rotation.z =", "type": "assigned_variable", "loc": [23, 23], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "vector": [14, 4, 0.7188, 0.0312, 4, 0.21, 0.6667, 194, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tf_msg.transforms[0].transform.rotation.z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tf_msg.transforms[0].transform.rotation.z = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L24_C16", "label": "tf_msg.transforms[0].transform.rotation.w =", "type": "assigned_variable", "loc": [24, 24], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "vector": [14, 4, 0.75, 0.0312, 4, 0.21, 1.0, 142, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tf_msg.transforms[0].transform.rotation.w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tf_msg.transforms[0].transform.rotation.w = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L25_C8", "label": "write()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:For_L18_C4", "vector": [8, 2, 0.7812, 0.0312, 2, 0.28, 1.0, 837, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fixed_bag.write(topic, tf_msg, t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L26_C4", "label": "close()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "vector": [8, 1, 0.8125, 0.0312, 1, 0.56, 0.7143, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bag.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L27_C4", "label": "close()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "vector": [8, 1, 0.8438, 0.0312, 1, 0.56, 0.8571, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fixed_bag.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L28_C4", "label": "print()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "vector": [8, 1, 0.875, 0.0312, 1, 0.56, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Saved fixed bag to:\", fixed_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L31_C0", "label": "if", "type": "if", "loc": [31, 32], "level": 0, "parent": null, "vector": [4, 0, 0.9844, 0.0625, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L32_C4", "label": "main()", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L31_C0", "vector": [8, 1, 1.0, 0.0312, 1, 0.91, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:For_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L21_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L22_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L23_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L20_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Assign_L24_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99508:If_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99508:Expr_L32_C4"}] |
#! /usr/bin/python
import roslib
roslib.load_manifest('hrl_generic_arms')
import rospy
import tf
import tf.transformations as tf_trans
from hrl_generic_arms.pose_converter import PoseConverter
def main():
rospy.init_node("tf_link_flipper")
child_frame = rospy.get_param("~child_frame")
parent_frame = rospy.get_param("~parent_frame")
link_frame = rospy.get_param("~link_frame")
rate = rospy.get_param("~rate", 100)
link_trans = rospy.get_param("~link_transform")
l_B_c = PoseConverter.to_homo_mat(link_trans['pos'], link_trans['quat'])
tf_broad = tf.TransformBroadcaster()
tf_listener = tf.TransformListener()
rospy.sleep(1)
r = rospy.Rate(rate)
while not rospy.is_shutdown():
time = rospy.Time.now()
tf_listener.waitForTransform(child_frame, parent_frame, rospy.Time(0), rospy.Duration(1))
pos, quat = tf_listener.lookupTransform(child_frame, parent_frame, rospy.Time(0))
c_B_p = PoseConverter.to_homo_mat(pos, quat)
l_B_p = l_B_c * c_B_p
tf_pos, tf_quat = PoseConverter.to_pos_quat(l_B_p)
tf_broad.sendTransform(tf_pos, tf_quat, time, parent_frame, link_frame)
r.sleep()
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_99509 | 29 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0541, 0.027, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L3_C0", "label": "load_manifest()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0811, 0.027, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_generic_arms')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Import_L4_C0", "label": "rospy import rospy", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1081, 0.027, 0, 0.66, 0.2857, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Import_L5_C0", "label": "tf import tf", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1351, 0.027, 0, 0.66, 0.4286, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Import_L6_C0", "label": "tf.transformations import tf_trans", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1622, 0.027, 0, 0.66, 0.5714, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tf_trans"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tf_trans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:ImportFrom_L7_C0", "label": "from hrl_generic_arms.pose_converter import PoseConverter", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1892, 0.027, 0, 0.66, 0.7143, 752, 0, 1, 0, 0, 752, 0, 0], "semantic": {"name": "hrl_generic_arms.pose_converter", "arg_names": [], "import_names": ["PoseConverter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_generic_arms.pose_converter import PoseConverter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "label": "main", "type": "function", "loc": [9, 32], "level": 0, "parent": null, "vector": [2, 0, 0.5541, 0.6486, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 22], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n rospy.init_node(\"tf_link_flipper\")\n\n child_frame = rospy.get_param(\"~child_frame\")\n parent_frame = rospy.get_param(\"~parent_frame\")\n link_frame = rospy.get_param(\"~link_frame\")\n rate = rospy.get_param(\"~rate\", 100)\n link_trans = rospy.get_param(\"~link_transform\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L10_C4", "label": "init_node()", "type": "expression", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [8, 1, 0.2703, 0.027, 1, 0.1, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node(\"tf_link_flipper\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L12_C4", "label": "child_frame = get_param()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.3243, 0.027, 1, 0.1, 0.0909, 581, 3, 1, 0, 0, 427, 10, 1], "semantic": {"name": "child_frame", "arg_names": [], "import_names": [], "rhs_call_name": "get_param", "annotation": ""}, "snippet": " child_frame = rospy.get_param(\"~child_frame\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L13_C4", "label": "parent_frame = get_param()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.3514, 0.027, 1, 0.1, 0.1818, 544, 3, 1, 0, 0, 427, 10, 1], "semantic": {"name": "parent_frame", "arg_names": [], "import_names": [], "rhs_call_name": "get_param", "annotation": ""}, "snippet": " parent_frame = rospy.get_param(\"~parent_frame\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L14_C4", "label": "link_frame = get_param()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.3784, 0.027, 1, 0.1, 0.2727, 523, 3, 1, 0, 0, 427, 10, 1], "semantic": {"name": "link_frame", "arg_names": [], "import_names": [], "rhs_call_name": "get_param", "annotation": ""}, "snippet": " link_frame = rospy.get_param(\"~link_frame\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L15_C4", "label": "rate = get_param()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.4054, 0.027, 1, 0.1, 0.3636, 477, 3, 2, 0, 0, 427, 10, 1], "semantic": {"name": "rate", "arg_names": [], "import_names": [], "rhs_call_name": "get_param", "annotation": ""}, "snippet": " rate = rospy.get_param(\"~rate\", 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L16_C4", "label": "link_trans = get_param()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.4324, 0.027, 1, 0.1, 0.4545, 408, 3, 1, 0, 0, 427, 10, 1], "semantic": {"name": "link_trans", "arg_names": [], "import_names": [], "rhs_call_name": "get_param", "annotation": ""}, "snippet": " link_trans = rospy.get_param(\"~link_transform\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L18_C4", "label": "l_B_c = to_homo_mat()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.4865, 0.027, 1, 0.1, 0.5455, 420, 3, 2, 0, 0, 32, 10, 1], "semantic": {"name": "l_B_c", "arg_names": [], "import_names": [], "rhs_call_name": "to_homo_mat", "annotation": ""}, "snippet": " l_B_c = PoseConverter.to_homo_mat(link_trans['pos'], link_trans['quat'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L20_C4", "label": "tf_broad = TransformBroadcaster()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.5405, 0.027, 1, 0.1, 0.6364, 389, 3, 0, 0, 0, 986, 10, 1], "semantic": {"name": "tf_broad", "arg_names": [], "import_names": [], "rhs_call_name": "TransformBroadcaster", "annotation": ""}, "snippet": " tf_broad = tf.TransformBroadcaster()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L21_C4", "label": "tf_listener = TransformListener()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.5676, 0.027, 1, 0.1, 0.7273, 565, 3, 0, 0, 0, 108, 10, 1], "semantic": {"name": "tf_listener", "arg_names": [], "import_names": [], "rhs_call_name": "TransformListener", "annotation": ""}, "snippet": " tf_listener = tf.TransformListener()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L22_C4", "label": "sleep()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [8, 1, 0.5946, 0.027, 1, 0.1, 0.8182, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L23_C4", "label": "r = Rate()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [14, 1, 0.6216, 0.027, 1, 0.1, 0.9091, 436, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "Rate", "annotation": ""}, "snippet": " r = rospy.Rate(rate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "label": "while", "type": "while", "loc": [24, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "vector": [5, 1, 0.7568, 0.2432, 1, 0.1, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not rospy.is_shutdown():\n time = rospy.Time.now()\n tf_listener.waitForTransform(child_frame, parent_frame, rospy.Time(0), rospy.Duration(1))\n pos, quat = tf_listener.lookupTransform(child_frame, parent_frame, rospy.Time(0))\n c_B_p = PoseConverter.to_homo_mat(pos, quat)\n l_B_p = l_B_c * c_B_p\n tf_pos, tf_quat = PoseConverter.to_pos_quat(l_B_p)\n tf_broad.sendTransform(tf_pos, tf_quat, time, parent_frame, link_frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L25_C8", "label": "time = now()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "vector": [14, 2, 0.6757, 0.027, 2, 0.44, 0.0, 654, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "time", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " time = rospy.Time.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L26_C8", "label": "waitForTransform()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "vector": [8, 2, 0.7027, 0.027, 2, 0.44, 0.1429, 900, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "waitForTransform", "arg_names": [], "import_names": [], "rhs_call_name": "waitForTransform", "annotation": ""}, "snippet": " tf_listener.waitForTransform(child_frame, parent_frame, rospy.Time(0), rospy.Duration(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L27_C8", "label": "pos, quat = lookupTransform()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "vector": [14, 2, 0.7297, 0.027, 2, 0.44, 0.2857, 375, 3, 3, 0, 0, 926, 10, 2], "semantic": {"name": "pos, quat", "arg_names": [], "import_names": [], "rhs_call_name": "lookupTransform", "annotation": ""}, "snippet": " pos, quat = tf_listener.lookupTransform(child_frame, parent_frame, rospy.Time(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L28_C8", "label": "c_B_p = to_homo_mat()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "vector": [14, 2, 0.7568, 0.027, 2, 0.44, 0.4286, 350, 3, 2, 0, 0, 32, 10, 1], "semantic": {"name": "c_B_p", "arg_names": [], "import_names": [], "rhs_call_name": "to_homo_mat", "annotation": ""}, "snippet": " c_B_p = PoseConverter.to_homo_mat(pos, quat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L29_C8", "label": "l_B_p =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "vector": [14, 2, 0.7838, 0.027, 2, 0.44, 0.5714, 751, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "l_B_p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l_B_p = l_B_c * c_B_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L30_C8", "label": "tf_pos, tf_quat = to_pos_quat()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "vector": [14, 2, 0.8108, 0.027, 2, 0.44, 0.7143, 170, 3, 1, 0, 0, 926, 10, 1], "semantic": {"name": "tf_pos, tf_quat", "arg_names": [], "import_names": [], "rhs_call_name": "to_pos_quat", "annotation": ""}, "snippet": " tf_pos, tf_quat = PoseConverter.to_pos_quat(l_B_p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L31_C8", "label": "sendTransform()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "vector": [8, 2, 0.8378, 0.027, 2, 0.44, 0.8571, 373, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "sendTransform", "arg_names": [], "import_names": [], "rhs_call_name": "sendTransform", "annotation": ""}, "snippet": " tf_broad.sendTransform(tf_pos, tf_quat, time, parent_frame, link_frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L32_C8", "label": "sleep()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "vector": [8, 2, 0.8649, 0.027, 2, 0.44, 1.0, 476, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " r.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:If_L36_C0", "label": "if", "type": "if", "loc": [36, 37], "level": 0, "parent": null, "vector": [4, 0, 0.9865, 0.0541, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L37_C4", "label": "main()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99509:If_L36_C0", "vector": [8, 1, 1.0, 0.027, 1, 0.18, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:While_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99509:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99509:Expr_L37_C4"}] |
#! /usr/bin/python
import sys
import numpy as np
import roslib
roslib.load_manifest('hrl_pr2_arms')
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
import rospy
import rosbag
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
import tf
import tf.transformations as tf_trans
from std_msgs.msg import Bool, Float32, Float64MultiArray
from std_srvs.srv import Empty
from geometry_msgs.msg import PoseStamped, Vector3
from actionlib_msgs.msg import GoalStatus
from hrl_generic_arms.pose_converter import PoseConverter
from hrl_pr2_arms.pr2_arm import create_pr2_arm
from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce
def main():
rospy.init_node("teleop_positioner")
from optparse import OptionParser
p = OptionParser()
p.add_option('-r', '--rate', dest="rate", default=10,
help="Set rate.")
(opts, args) = p.parse_args()
arm = create_pr2_arm('l', PR2ArmHybridForce)
rospy.sleep(0.1)
arm.zero_sensor()
cur_pose = arm.get_end_effector_pose()
arm.set_ep(cur_pose, 1)
arm.set_force_directions([])
arm.set_force_gains(p_trans=[3, 1, 1], p_rot=0.5, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)
arm.set_motion_gains(p_trans=400, d_trans=[16, 10, 10], p_rot=[10, 10, 10], d_rot=0)
arm.set_tip_frame("/l_gripper_tool_frame")
arm.update_gains()
arm.set_force(6 * [0])
r = rospy.Rate(float(opts.rate))
while not rospy.is_shutdown():
ep_pose = arm.get_ep()
cur_pose = arm.get_end_effector_pose()
err_ep = arm.ep_error(cur_pose, ep_pose)
if np.linalg.norm(err_ep[0:3]) > 0.012 or np.linalg.norm(err_ep[3:]) > np.pi / 8.:
arm.set_ep(cur_pose, 1)
r.sleep()
cur_pose = arm.get_end_effector_pose()
arm.set_ep(cur_pose, 1)
q = arm.get_joint_angles()
q_posture = q.tolist()[0:3] + 4 * [9999]
arm.set_posture(q_posture)
arm.set_motion_gains(p_trans=400, d_trans=[16, 10, 10], p_rot=[20, 50, 50], d_rot=0)
arm.update_gains()
print PoseConverter.to_pos_quat(cur_pose)
pkg_dir = roslib.rospack.rospackexec(["find", "hrl_phri_2011"])
bag = rosbag.Bag(pkg_dir + "/data/saved_teleop_pose.bag", 'w')
bag.write("/teleop_pose", PoseConverter.to_pose_msg(cur_pose))
q_posture_msg = Float64MultiArray()
q_posture_msg.data = q_posture
bag.write("/teleop_posture", q_posture_msg)
bag.close()
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_99510 | 62 | 74 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0405, 0.0135, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0541, 0.0135, 0, 0.66, 0.0476, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L6_C0", "label": "roslib import roslib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0811, 0.0135, 0, 0.66, 0.0952, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0946, 0.0135, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_pr2_arms')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.1081, 0.0135, 0, 0.66, 0.1905, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.1216, 0.0135, 0, 0.66, 0.2381, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L10_C0", "label": "rospy import rospy", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1351, 0.0135, 0, 0.66, 0.2857, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L11_C0", "label": "rosbag import rosbag", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1486, 0.0135, 0, 0.66, 0.3333, 243, 0, 1, 0, 0, 243, 0, 0], "semantic": {"name": "rosbag", "arg_names": [], "import_names": ["rosbag"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rosbag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L13_C0", "label": "smach import smach", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1757, 0.0135, 0, 0.66, 0.381, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L14_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1892, 0.0135, 0, 0.66, 0.4286, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L15_C0", "label": "actionlib import actionlib", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.2027, 0.0135, 0, 0.66, 0.4762, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L16_C0", "label": "tf import tf", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.2162, 0.0135, 0, 0.66, 0.5238, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Import_L17_C0", "label": "tf.transformations import tf_trans", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2297, 0.0135, 0, 0.66, 0.5714, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tf_trans"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tf_trans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L18_C0", "label": "from std_msgs.msg import Bool, Float32, Float64MultiArray", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.2432, 0.0135, 0, 0.66, 0.619, 366, 0, 3, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Bool", "Float32", "Float64MultiArray"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Bool, Float32, Float64MultiArray"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L19_C0", "label": "from std_srvs.srv import Empty", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2568, 0.0135, 0, 0.66, 0.6667, 261, 0, 1, 0, 0, 261, 0, 0], "semantic": {"name": "std_srvs.srv", "arg_names": [], "import_names": ["Empty"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_srvs.srv import Empty"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L20_C0", "label": "from geometry_msgs.msg import PoseStamped, Vector3", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.2703, 0.0135, 0, 0.66, 0.7143, 951, 0, 2, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped", "Vector3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped, Vector3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L21_C0", "label": "from actionlib_msgs.msg import GoalStatus", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.2838, 0.0135, 0, 0.66, 0.7619, 245, 0, 1, 0, 0, 245, 0, 0], "semantic": {"name": "actionlib_msgs.msg", "arg_names": [], "import_names": ["GoalStatus"], "rhs_call_name": "", "annotation": ""}, "snippet": "from actionlib_msgs.msg import GoalStatus"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L23_C0", "label": "from hrl_generic_arms.pose_converter import PoseConverter", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.3108, 0.0135, 0, 0.66, 0.8095, 752, 0, 1, 0, 0, 752, 0, 0], "semantic": {"name": "hrl_generic_arms.pose_converter", "arg_names": [], "import_names": ["PoseConverter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_generic_arms.pose_converter import PoseConverter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L24_C0", "label": "from hrl_pr2_arms.pr2_arm import create_pr2_arm", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.3243, 0.0135, 0, 0.66, 0.8571, 253, 0, 1, 0, 0, 253, 0, 0], "semantic": {"name": "hrl_pr2_arms.pr2_arm", "arg_names": [], "import_names": ["create_pr2_arm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_pr2_arms.pr2_arm import create_pr2_arm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L25_C0", "label": "from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.3378, 0.0135, 0, 0.66, 0.9048, 910, 0, 1, 0, 0, 910, 0, 0], "semantic": {"name": "hrl_pr2_arms.pr2_arm_hybrid", "arg_names": [], "import_names": ["PR2ArmHybridForce"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "label": "main", "type": "function", "loc": [27, 71], "level": 0, "parent": null, "vector": [2, 0, 0.6622, 0.6081, 0, 0.66, 0.9524, 624, 0, 0, 0, 0, 0, 0, 41], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n rospy.init_node(\"teleop_positioner\")\n\n from optparse import OptionParser\n p = OptionParser()\n p.add_option('-r', '--rate', dest=\"rate\", default=10,\n help=\"Set rate.\")\n (opts, args) = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L28_C4", "label": "init_node()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.3784, 0.0135, 1, 0.97, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node(\"teleop_positioner\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L30_C4", "label": "from optparse import OptionParser", "type": "import", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [1, 1, 0.4054, 0.0135, 1, 0.97, 0.0312, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["OptionParser"], "rhs_call_name": "", "annotation": ""}, "snippet": " from optparse import OptionParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L31_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.4189, 0.0135, 1, 0.97, 0.0625, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L32_C4", "label": "add_option()", "type": "expression", "loc": [32, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.4392, 0.027, 1, 0.97, 0.0938, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-r', '--rate', dest=\"rate\", default=10,\n help=\"Set rate.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L34_C4", "label": "opts, args = parse_args()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.4595, 0.0135, 1, 0.97, 0.125, 616, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " (opts, args) = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L36_C4", "label": "arm = create_pr2_arm()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.4865, 0.0135, 1, 0.97, 0.1562, 413, 3, 2, 0, 0, 318, 10, 1], "semantic": {"name": "arm", "arg_names": [], "import_names": [], "rhs_call_name": "create_pr2_arm", "annotation": ""}, "snippet": " arm = create_pr2_arm('l', PR2ArmHybridForce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L37_C4", "label": "sleep()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.5, 0.0135, 1, 0.97, 0.1875, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L39_C4", "label": "zero_sensor()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.527, 0.0135, 1, 0.97, 0.2188, 103, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "zero_sensor", "arg_names": [], "import_names": [], "rhs_call_name": "zero_sensor", "annotation": ""}, "snippet": " arm.zero_sensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L40_C4", "label": "cur_pose = get_end_effector_pose()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.5405, 0.0135, 1, 0.97, 0.25, 780, 3, 0, 0, 0, 254, 10, 1], "semantic": {"name": "cur_pose", "arg_names": [], "import_names": [], "rhs_call_name": "get_end_effector_pose", "annotation": ""}, "snippet": " cur_pose = arm.get_end_effector_pose()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L41_C4", "label": "set_ep()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.5541, 0.0135, 1, 0.97, 0.2812, 547, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_ep", "arg_names": [], "import_names": [], "rhs_call_name": "set_ep", "annotation": ""}, "snippet": " arm.set_ep(cur_pose, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L42_C4", "label": "set_force_directions()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.5676, 0.0135, 1, 0.97, 0.3125, 788, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_force_directions", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_directions", "annotation": ""}, "snippet": " arm.set_force_directions([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L43_C4", "label": "set_force_gains()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.5811, 0.0135, 1, 0.97, 0.3438, 892, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "set_force_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_gains", "annotation": ""}, "snippet": " arm.set_force_gains(p_trans=[3, 1, 1], p_rot=0.5, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L44_C4", "label": "set_motion_gains()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.5946, 0.0135, 1, 0.97, 0.375, 965, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "set_motion_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_motion_gains", "annotation": ""}, "snippet": " arm.set_motion_gains(p_trans=400, d_trans=[16, 10, 10], p_rot=[10, 10, 10], d_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L45_C4", "label": "set_tip_frame()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.6081, 0.0135, 1, 0.97, 0.4062, 819, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_tip_frame", "arg_names": [], "import_names": [], "rhs_call_name": "set_tip_frame", "annotation": ""}, "snippet": " arm.set_tip_frame(\"/l_gripper_tool_frame\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L46_C4", "label": "update_gains()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.6216, 0.0135, 1, 0.97, 0.4375, 582, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_gains", "arg_names": [], "import_names": [], "rhs_call_name": "update_gains", "annotation": ""}, "snippet": " arm.update_gains()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L47_C4", "label": "set_force()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.6351, 0.0135, 1, 0.97, 0.4688, 329, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_force", "arg_names": [], "import_names": [], "rhs_call_name": "set_force", "annotation": ""}, "snippet": " arm.set_force(6 * [0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L49_C4", "label": "r = Rate()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.6622, 0.0135, 1, 0.97, 0.5, 436, 3, 1, 0, 0, 543, 10, 2], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "Rate", "annotation": ""}, "snippet": " r = rospy.Rate(float(opts.rate))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "label": "while", "type": "while", "loc": [50, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [5, 1, 0.7162, 0.0946, 1, 0.97, 0.5312, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not rospy.is_shutdown():\n ep_pose = arm.get_ep()\n cur_pose = arm.get_end_effector_pose()\n err_ep = arm.ep_error(cur_pose, ep_pose)\n if np.linalg.norm(err_ep[0:3]) > 0.012 or np.linalg.norm(err_ep[3:]) > np.pi / 8.:\n arm.set_ep(cur_pose, 1)\n r.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L51_C8", "label": "ep_pose = get_ep()", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "vector": [14, 2, 0.6892, 0.0135, 2, 0.51, 0.0, 220, 3, 0, 0, 0, 563, 10, 1], "semantic": {"name": "ep_pose", "arg_names": [], "import_names": [], "rhs_call_name": "get_ep", "annotation": ""}, "snippet": " ep_pose = arm.get_ep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L52_C8", "label": "cur_pose = get_end_effector_pose()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "vector": [14, 2, 0.7027, 0.0135, 2, 0.51, 0.25, 780, 3, 0, 0, 0, 254, 10, 1], "semantic": {"name": "cur_pose", "arg_names": [], "import_names": [], "rhs_call_name": "get_end_effector_pose", "annotation": ""}, "snippet": " cur_pose = arm.get_end_effector_pose()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L53_C8", "label": "err_ep = ep_error()", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "vector": [14, 2, 0.7162, 0.0135, 2, 0.51, 0.5, 777, 3, 2, 0, 0, 838, 10, 1], "semantic": {"name": "err_ep", "arg_names": [], "import_names": [], "rhs_call_name": "ep_error", "annotation": ""}, "snippet": " err_ep = arm.ep_error(cur_pose, ep_pose)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:If_L54_C8", "label": "if", "type": "if", "loc": [54, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "vector": [4, 2, 0.7365, 0.027, 2, 0.51, 0.75, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if np.linalg.norm(err_ep[0:3]) > 0.012 or np.linalg.norm(err_ep[3:]) > np.pi / 8.:\n arm.set_ep(cur_pose, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L55_C12", "label": "set_ep()", "type": "expression", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:If_L54_C8", "vector": [8, 3, 0.7432, 0.0135, 3, 0.56, 0.0, 547, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_ep", "arg_names": [], "import_names": [], "rhs_call_name": "set_ep", "annotation": ""}, "snippet": " arm.set_ep(cur_pose, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L56_C8", "label": "sleep()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "vector": [8, 2, 0.7568, 0.0135, 2, 0.51, 1.0, 476, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " r.sleep()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L57_C4", "label": "cur_pose = get_end_effector_pose()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.7703, 0.0135, 1, 0.97, 0.5625, 780, 3, 0, 0, 0, 254, 10, 1], "semantic": {"name": "cur_pose", "arg_names": [], "import_names": [], "rhs_call_name": "get_end_effector_pose", "annotation": ""}, "snippet": " cur_pose = arm.get_end_effector_pose()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L58_C4", "label": "set_ep()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.7838, 0.0135, 1, 0.97, 0.5938, 547, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_ep", "arg_names": [], "import_names": [], "rhs_call_name": "set_ep", "annotation": ""}, "snippet": " arm.set_ep(cur_pose, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L59_C4", "label": "q = get_joint_angles()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.7973, 0.0135, 1, 0.97, 0.625, 516, 3, 0, 0, 0, 820, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "get_joint_angles", "annotation": ""}, "snippet": " q = arm.get_joint_angles()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L60_C4", "label": "q_posture =", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.8108, 0.0135, 1, 0.97, 0.6562, 66, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "q_posture", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q_posture = q.tolist()[0:3] + 4 * [9999]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L61_C4", "label": "set_posture()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.8243, 0.0135, 1, 0.97, 0.6875, 300, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_posture", "arg_names": [], "import_names": [], "rhs_call_name": "set_posture", "annotation": ""}, "snippet": " arm.set_posture(q_posture)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L62_C4", "label": "set_motion_gains()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.8378, 0.0135, 1, 0.97, 0.7188, 965, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "set_motion_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_motion_gains", "annotation": ""}, "snippet": " arm.set_motion_gains(p_trans=400, d_trans=[16, 10, 10], p_rot=[20, 50, 50], d_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L63_C4", "label": "update_gains()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.8514, 0.0135, 1, 0.97, 0.75, 582, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_gains", "arg_names": [], "import_names": [], "rhs_call_name": "update_gains", "annotation": ""}, "snippet": " arm.update_gains()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L64_C4", "label": "print()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.8649, 0.0135, 1, 0.97, 0.7812, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(PoseConverter.to_pos_quat(cur_pose))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L65_C4", "label": "pkg_dir = rospackexec()", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.8784, 0.0135, 1, 0.97, 0.8125, 266, 3, 1, 0, 0, 680, 10, 1], "semantic": {"name": "pkg_dir", "arg_names": [], "import_names": [], "rhs_call_name": "rospackexec", "annotation": ""}, "snippet": " pkg_dir = roslib.rospack.rospackexec([\"find\", \"hrl_phri_2011\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L66_C4", "label": "bag = Bag()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.8919, 0.0135, 1, 0.97, 0.8438, 117, 3, 2, 0, 0, 568, 10, 1], "semantic": {"name": "bag", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " bag = rosbag.Bag(pkg_dir + \"/data/saved_teleop_pose.bag\", 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L67_C4", "label": "write()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.9054, 0.0135, 1, 0.97, 0.875, 837, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " bag.write(\"/teleop_pose\", PoseConverter.to_pose_msg(cur_pose))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L68_C4", "label": "q_posture_msg = Float64MultiArray()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.9189, 0.0135, 1, 0.97, 0.9062, 582, 3, 0, 0, 0, 797, 10, 1], "semantic": {"name": "q_posture_msg", "arg_names": [], "import_names": [], "rhs_call_name": "Float64MultiArray", "annotation": ""}, "snippet": " q_posture_msg = Float64MultiArray()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L69_C4", "label": "q_posture_msg.data =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [14, 1, 0.9324, 0.0135, 1, 0.97, 0.9375, 533, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "q_posture_msg.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q_posture_msg.data = q_posture"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L70_C4", "label": "write()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.9459, 0.0135, 1, 0.97, 0.9688, 837, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " bag.write(\"/teleop_posture\", q_posture_msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L71_C4", "label": "close()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "vector": [8, 1, 0.9595, 0.0135, 1, 0.97, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bag.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:If_L73_C0", "label": "if", "type": "if", "loc": [73, 74], "level": 0, "parent": null, "vector": [4, 0, 0.9932, 0.027, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L74_C4", "label": "main()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99510:If_L73_C0", "vector": [8, 1, 1.0, 0.0135, 1, 0.47, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:ImportFrom_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:While_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99510:If_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99510:Expr_L74_C4"}] |
#! /usr/bin/python
import sys
import numpy as np
import roslib
roslib.load_manifest('hrl_pr2_arms')
roslib.load_manifest('smach_ros')
roslib.load_manifest('actionlib')
import rospy
import rosbag
import smach
from smach_ros import SimpleActionState, ServiceState, IntrospectionServer
import actionlib
import tf
import tf.transformations as tf_trans
from std_msgs.msg import Bool, Float32
from std_srvs.srv import Empty
from geometry_msgs.msg import PoseStamped, Vector3, Pose
from actionlib_msgs.msg import GoalStatus
from hrl_generic_arms.pose_converter import PoseConverter
from hrl_pr2_arms.pr2_arm import create_pr2_arm
from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce
def main():
rospy.init_node("switch_controller")
from optparse import OptionParser
p = OptionParser()
p.add_option('-s', '--stiff', dest="stiff", default=False,
action="store_true", help="Enable stiff controller.")
p.add_option('-f', '--force', dest="force", default=False,
action="store_true", help="Enable force controller.")
p.add_option('-m', '--force_mag', dest="force_mag", default=2,
help="Specify force magnitude.")
p.add_option('-x', '--max_force', dest="max_force", default=-1,
help="Specify max force magnitude.")
p.add_option('-i', '--impedance', dest="impedance", default=False,
action="store_true", help="Enable impedance controller.")
p.add_option('-c', '--compliance', dest="compliance", default=-1,
help="Enable impedance controller.")
p.add_option('-t', '--tip_frame', dest="tip_frame", default="/l_gripper_tool_frame",
help="Set tip to this frame.")
p.add_option('-z', '--zero_sensor', dest="zero_sensor", default=False,
action="store_true", help="Just zero the sensor.")
p.add_option('-r', '--reset_pose', dest="reset_pose", default=False,
action="store_true", help="Use the saved position in the data file.")
(opts, args) = p.parse_args()
arm = create_pr2_arm('l', PR2ArmHybridForce)
rospy.sleep(0.1)
# reset arm
arm.zero_sensor()
if opts.zero_sensor:
return
arm.set_force(6 * [0])
#
if opts.reset_pose:
pkg_dir = roslib.rospack.rospackexec(["find", "hrl_phri_2011"])
bag = rosbag.Bag(pkg_dir + "/data/saved_teleop_pose.bag", 'r')
for topic, msg, stamp in bag.read_messages("/teleop_pose"):
pose = PoseConverter.to_pos_rot([msg.position.x, msg.position.y, msg.position.z],
[msg.orientation.x, msg.orientation.y, msg.orientation.z,
msg.orientation.w])
for topic, msg, stamp in bag.read_messages("/teleop_posture"):
posture = msg.data
bag.close()
arm.set_posture(posture)
i_poses = arm.interpolate_ep(arm.get_end_effector_pose(), pose, 100)
for cur_pose in i_poses:
arm.set_ep(cur_pose, 1)
rospy.sleep(0.1)
return
# set common parameters
arm.set_force_max([float(opts.max_force), -1, -1, -1, -1, -1])
arm.set_tip_frame(opts.tip_frame)
if opts.stiff:
compliance = float(opts.compliance)
if compliance < 0:
compliance = 1300
#arm.set_force_gains(p_trans=[1, 1, 1], p_rot=0.1, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)
arm.set_force_gains(p_trans=[1, 0, 0], p_rot=0.1, i_trans=[0.002, 0, 0], i_max_trans=[10, 0, 0], i_rot=0, i_max_rot=0)
arm.set_motion_gains(p_trans=[compliance, 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)
arm.set_force_directions([])
arm.set_force(6 * [0])
elif opts.impedance:
compliance = float(opts.compliance)
if compliance < 0:
compliance = 80
arm.set_force_gains(p_trans=[3, 1, 1], p_rot=0.1, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)
arm.set_motion_gains(p_trans=[compliance, 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)
arm.set_force_directions([])
arm.set_force(6 * [0])
elif opts.force:
arm.set_force_gains(p_trans=[3, 1, 1], p_rot=0.1, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)
arm.set_motion_gains(p_trans=[float(opts.compliance), 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)
arm.set_force_directions(['x'])
arm.set_force([float(opts.force_mag), 0, 0, 0, 0, 0])
else:
p.print_help()
return
arm.update_gains()
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_99511 | 82 | 111 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.009, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L4_C0", "label": "numpy import np", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.036, 0.009, 0, 0.66, 0.0476, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L6_C0", "label": "roslib import roslib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0541, 0.009, 0, 0.66, 0.0952, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L7_C0", "label": "load_manifest()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0631, 0.009, 0, 0.66, 0.1429, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('hrl_pr2_arms')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L8_C0", "label": "load_manifest()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0721, 0.009, 0, 0.66, 0.1905, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('smach_ros')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L9_C0", "label": "load_manifest()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0811, 0.009, 0, 0.66, 0.2381, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "roslib.load_manifest('actionlib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L10_C0", "label": "rospy import rospy", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0901, 0.009, 0, 0.66, 0.2857, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L11_C0", "label": "rosbag import rosbag", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0991, 0.009, 0, 0.66, 0.3333, 243, 0, 1, 0, 0, 243, 0, 0], "semantic": {"name": "rosbag", "arg_names": [], "import_names": ["rosbag"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rosbag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L13_C0", "label": "smach import smach", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1171, 0.009, 0, 0.66, 0.381, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "smach", "arg_names": [], "import_names": ["smach"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L14_C0", "label": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1261, 0.009, 0, 0.66, 0.4286, 716, 0, 3, 0, 0, 716, 0, 0], "semantic": {"name": "smach_ros", "arg_names": [], "import_names": ["SimpleActionState", "ServiceState", "IntrospectionServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from smach_ros import SimpleActionState, ServiceState, IntrospectionServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L15_C0", "label": "actionlib import actionlib", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1351, 0.009, 0, 0.66, 0.4762, 694, 0, 1, 0, 0, 694, 0, 0], "semantic": {"name": "actionlib", "arg_names": [], "import_names": ["actionlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import actionlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L16_C0", "label": "tf import tf", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1441, 0.009, 0, 0.66, 0.5238, 951, 0, 1, 0, 0, 951, 0, 0], "semantic": {"name": "tf", "arg_names": [], "import_names": ["tf"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Import_L17_C0", "label": "tf.transformations import tf_trans", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1532, 0.009, 0, 0.66, 0.5714, 762, 0, 1, 0, 0, 762, 0, 0], "semantic": {"name": "tf.transformations", "arg_names": [], "import_names": ["tf_trans"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tf.transformations as tf_trans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L18_C0", "label": "from std_msgs.msg import Bool, Float32", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1622, 0.009, 0, 0.66, 0.619, 366, 0, 2, 0, 0, 366, 0, 0], "semantic": {"name": "std_msgs.msg", "arg_names": [], "import_names": ["Bool", "Float32"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_msgs.msg import Bool, Float32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L19_C0", "label": "from std_srvs.srv import Empty", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1712, 0.009, 0, 0.66, 0.6667, 261, 0, 1, 0, 0, 261, 0, 0], "semantic": {"name": "std_srvs.srv", "arg_names": [], "import_names": ["Empty"], "rhs_call_name": "", "annotation": ""}, "snippet": "from std_srvs.srv import Empty"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L20_C0", "label": "from geometry_msgs.msg import PoseStamped, Vector3, Pose", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1802, 0.009, 0, 0.66, 0.7143, 951, 0, 3, 0, 0, 951, 0, 0], "semantic": {"name": "geometry_msgs.msg", "arg_names": [], "import_names": ["PoseStamped", "Vector3", "Pose"], "rhs_call_name": "", "annotation": ""}, "snippet": "from geometry_msgs.msg import PoseStamped, Vector3, Pose"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L21_C0", "label": "from actionlib_msgs.msg import GoalStatus", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1892, 0.009, 0, 0.66, 0.7619, 245, 0, 1, 0, 0, 245, 0, 0], "semantic": {"name": "actionlib_msgs.msg", "arg_names": [], "import_names": ["GoalStatus"], "rhs_call_name": "", "annotation": ""}, "snippet": "from actionlib_msgs.msg import GoalStatus"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L23_C0", "label": "from hrl_generic_arms.pose_converter import PoseConverter", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.2072, 0.009, 0, 0.66, 0.8095, 752, 0, 1, 0, 0, 752, 0, 0], "semantic": {"name": "hrl_generic_arms.pose_converter", "arg_names": [], "import_names": ["PoseConverter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_generic_arms.pose_converter import PoseConverter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L24_C0", "label": "from hrl_pr2_arms.pr2_arm import create_pr2_arm", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.2162, 0.009, 0, 0.66, 0.8571, 253, 0, 1, 0, 0, 253, 0, 0], "semantic": {"name": "hrl_pr2_arms.pr2_arm", "arg_names": [], "import_names": ["create_pr2_arm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_pr2_arms.pr2_arm import create_pr2_arm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L25_C0", "label": "from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.2252, 0.009, 0, 0.66, 0.9048, 910, 0, 1, 0, 0, 910, 0, 0], "semantic": {"name": "hrl_pr2_arms.pr2_arm_hybrid", "arg_names": [], "import_names": ["PR2ArmHybridForce"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hrl_pr2_arms.pr2_arm_hybrid import PR2ArmHybridForce"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "label": "main", "type": "function", "loc": [27, 108], "level": 0, "parent": null, "vector": [2, 0, 0.6081, 0.7387, 0, 0.66, 0.9524, 624, 0, 0, 0, 0, 0, 0, 48], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n rospy.init_node(\"switch_controller\")\n\n from optparse import OptionParser\n p = OptionParser()\n p.add_option('-s', '--stiff', dest=\"stiff\", default=False,\n action=\"store_true\", help=\"Enable stiff controller.\")\n p.add_option('-f', '--force', dest=\"force\", default=False,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L28_C4", "label": "init_node()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.2523, 0.009, 1, 0.44, 0.0, 463, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init_node", "arg_names": [], "import_names": [], "rhs_call_name": "init_node", "annotation": ""}, "snippet": " rospy.init_node(\"switch_controller\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L30_C4", "label": "from optparse import OptionParser", "type": "import", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [1, 1, 0.2703, 0.009, 1, 0.44, 0.0455, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["OptionParser"], "rhs_call_name": "", "annotation": ""}, "snippet": " from optparse import OptionParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L31_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [14, 1, 0.2793, 0.009, 1, 0.44, 0.0909, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L32_C4", "label": "add_option()", "type": "expression", "loc": [32, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.2928, 0.018, 1, 0.44, 0.1364, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-s', '--stiff', dest=\"stiff\", default=False,\n action=\"store_true\", help=\"Enable stiff controller.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L34_C4", "label": "add_option()", "type": "expression", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.3108, 0.018, 1, 0.44, 0.1818, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-f', '--force', dest=\"force\", default=False,\n action=\"store_true\", help=\"Enable force controller.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L36_C4", "label": "add_option()", "type": "expression", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.3288, 0.018, 1, 0.44, 0.2273, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-m', '--force_mag', dest=\"force_mag\", default=2,\n help=\"Specify force magnitude.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L38_C4", "label": "add_option()", "type": "expression", "loc": [38, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.3468, 0.018, 1, 0.44, 0.2727, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-x', '--max_force', dest=\"max_force\", default=-1,\n help=\"Specify max force magnitude.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L40_C4", "label": "add_option()", "type": "expression", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.3649, 0.018, 1, 0.44, 0.3182, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-i', '--impedance', dest=\"impedance\", default=False,\n action=\"store_true\", help=\"Enable impedance controller.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L42_C4", "label": "add_option()", "type": "expression", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.3829, 0.018, 1, 0.44, 0.3636, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-c', '--compliance', dest=\"compliance\", default=-1,\n help=\"Enable impedance controller.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L44_C4", "label": "add_option()", "type": "expression", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.4009, 0.018, 1, 0.44, 0.4091, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-t', '--tip_frame', dest=\"tip_frame\", default=\"/l_gripper_tool_frame\",\n help=\"Set tip to this frame.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L46_C4", "label": "add_option()", "type": "expression", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.4189, 0.018, 1, 0.44, 0.4545, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-z', '--zero_sensor', dest=\"zero_sensor\", default=False,\n action=\"store_true\", help=\"Just zero the sensor.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L48_C4", "label": "add_option()", "type": "expression", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.4369, 0.018, 1, 0.44, 0.5, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-r', '--reset_pose', dest=\"reset_pose\", default=False,\n action=\"store_true\", help=\"Use the saved position in the data file.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L50_C4", "label": "opts, args = parse_args()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [14, 1, 0.4505, 0.009, 1, 0.44, 0.5455, 616, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " (opts, args) = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L52_C4", "label": "arm = create_pr2_arm()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [14, 1, 0.4685, 0.009, 1, 0.44, 0.5909, 413, 3, 2, 0, 0, 318, 10, 1], "semantic": {"name": "arm", "arg_names": [], "import_names": [], "rhs_call_name": "create_pr2_arm", "annotation": ""}, "snippet": " arm = create_pr2_arm('l', PR2ArmHybridForce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L53_C4", "label": "sleep()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.4775, 0.009, 1, 0.44, 0.6364, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L56_C4", "label": "zero_sensor()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.5045, 0.009, 1, 0.44, 0.6818, 103, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "zero_sensor", "arg_names": [], "import_names": [], "rhs_call_name": "zero_sensor", "annotation": ""}, "snippet": " arm.zero_sensor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L57_C4", "label": "if", "type": "if", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [4, 1, 0.518, 0.018, 1, 0.44, 0.7273, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opts.zero_sensor:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Return_L58_C8", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L57_C4", "vector": [13, 2, 0.5225, 0.009, 2, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L59_C4", "label": "set_force()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.5315, 0.009, 1, 0.44, 0.7727, 329, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_force", "arg_names": [], "import_names": [], "rhs_call_name": "set_force", "annotation": ""}, "snippet": " arm.set_force(6 * [0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "label": "if", "type": "if", "loc": [62, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [4, 1, 0.6261, 0.1441, 1, 0.44, 0.8182, 0, 7, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opts.reset_pose:\n pkg_dir = roslib.rospack.rospackexec([\"find\", \"hrl_phri_2011\"])\n bag = rosbag.Bag(pkg_dir + \"/data/saved_teleop_pose.bag\", 'r')\n for topic, msg, stamp in bag.read_messages(\"/teleop_pose\"):\n pose = PoseConverter.to_pos_rot([msg.position.x, msg.position.y, msg.position.z],\n [msg.orientation.x, msg.orientation.y, msg.orientation.z,\n msg.orientation.w])\n for topic, msg, stamp in bag.read_messages(\"/teleop_posture\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L63_C8", "label": "pkg_dir = rospackexec()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [14, 2, 0.5676, 0.009, 2, 0.51, 0.0, 266, 3, 1, 0, 0, 680, 10, 1], "semantic": {"name": "pkg_dir", "arg_names": [], "import_names": [], "rhs_call_name": "rospackexec", "annotation": ""}, "snippet": " pkg_dir = roslib.rospack.rospackexec([\"find\", \"hrl_phri_2011\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L64_C8", "label": "bag = Bag()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [14, 2, 0.5766, 0.009, 2, 0.51, 0.125, 117, 3, 2, 0, 0, 568, 10, 1], "semantic": {"name": "bag", "arg_names": [], "import_names": [], "rhs_call_name": "Bag", "annotation": ""}, "snippet": " bag = rosbag.Bag(pkg_dir + \"/data/saved_teleop_pose.bag\", 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L65_C8", "label": "for topic, msg, stamp", "type": "for", "loc": [65, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [6, 2, 0.5991, 0.036, 2, 0.51, 0.25, 634, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "topic, msg, stamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for topic, msg, stamp in bag.read_messages(\"/teleop_pose\"):\n pose = PoseConverter.to_pos_rot([msg.position.x, msg.position.y, msg.position.z],\n [msg.orientation.x, msg.orientation.y, msg.orientation.z,\n msg.orientation.w])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L66_C12", "label": "pose = to_pos_rot()", "type": "assigned_variable", "loc": [66, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L65_C8", "vector": [14, 3, 0.6036, 0.027, 3, 0.04, 0.0, 767, 3, 2, 0, 0, 204, 10, 1], "semantic": {"name": "pose", "arg_names": [], "import_names": [], "rhs_call_name": "to_pos_rot", "annotation": ""}, "snippet": " pose = PoseConverter.to_pos_rot([msg.position.x, msg.position.y, msg.position.z],\n [msg.orientation.x, msg.orientation.y, msg.orientation.z,\n msg.orientation.w])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L69_C8", "label": "for topic, msg, stamp", "type": "for", "loc": [69, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [6, 2, 0.6261, 0.018, 2, 0.51, 0.375, 634, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "topic, msg, stamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for topic, msg, stamp in bag.read_messages(\"/teleop_posture\"):\n posture = msg.data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L70_C12", "label": "posture =", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L69_C8", "vector": [14, 3, 0.6306, 0.009, 3, 0.68, 0.0, 307, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "posture", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " posture = msg.data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L71_C8", "label": "close()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [8, 2, 0.6396, 0.009, 2, 0.51, 0.5, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bag.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L72_C8", "label": "set_posture()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [8, 2, 0.6486, 0.009, 2, 0.51, 0.625, 300, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_posture", "arg_names": [], "import_names": [], "rhs_call_name": "set_posture", "annotation": ""}, "snippet": " arm.set_posture(posture)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L73_C8", "label": "i_poses = interpolate_ep()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [14, 2, 0.6577, 0.009, 2, 0.51, 0.75, 466, 3, 3, 0, 0, 794, 10, 2], "semantic": {"name": "i_poses", "arg_names": [], "import_names": [], "rhs_call_name": "interpolate_ep", "annotation": ""}, "snippet": " i_poses = arm.interpolate_ep(arm.get_end_effector_pose(), pose, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L74_C8", "label": "for cur_pose", "type": "for", "loc": [74, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [6, 2, 0.6757, 0.027, 2, 0.51, 0.875, 780, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "cur_pose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for cur_pose in i_poses:\n arm.set_ep(cur_pose, 1)\n rospy.sleep(0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L75_C12", "label": "set_ep()", "type": "expression", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L74_C8", "vector": [8, 3, 0.6757, 0.009, 3, 0.62, 0.0, 547, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_ep", "arg_names": [], "import_names": [], "rhs_call_name": "set_ep", "annotation": ""}, "snippet": " arm.set_ep(cur_pose, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L76_C12", "label": "sleep()", "type": "expression", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L74_C8", "vector": [8, 3, 0.6847, 0.009, 3, 0.62, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " rospy.sleep(0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Return_L77_C8", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "vector": [13, 2, 0.6937, 0.009, 2, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L80_C4", "label": "set_force_max()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.7207, 0.009, 1, 0.44, 0.8636, 198, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_force_max", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_max", "annotation": ""}, "snippet": " arm.set_force_max([float(opts.max_force), -1, -1, -1, -1, -1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L81_C4", "label": "set_tip_frame()", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.7297, 0.009, 1, 0.44, 0.9091, 819, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_tip_frame", "arg_names": [], "import_names": [], "rhs_call_name": "set_tip_frame", "annotation": ""}, "snippet": " arm.set_tip_frame(opts.tip_frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "label": "if", "type": "if", "loc": [83, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [4, 1, 0.8559, 0.2252, 1, 0.44, 0.9545, 0, 7, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opts.stiff:\n compliance = float(opts.compliance)\n if compliance < 0:\n compliance = 1300\n#arm.set_force_gains(p_trans=[1, 1, 1], p_rot=0.1, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)\n arm.set_force_gains(p_trans=[1, 0, 0], p_rot=0.1, i_trans=[0.002, 0, 0], i_max_trans=[10, 0, 0], i_rot=0, i_max_rot=0)\n arm.set_motion_gains(p_trans=[compliance, 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)\n arm.set_force_directions([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L84_C8", "label": "compliance = float()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "vector": [14, 2, 0.7568, 0.009, 2, 0.1, 0.0, 60, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "compliance", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " compliance = float(opts.compliance)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L85_C8", "label": "if", "type": "if", "loc": [85, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "vector": [4, 2, 0.7703, 0.018, 2, 0.1, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if compliance < 0:\n compliance = 1300"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L86_C12", "label": "compliance =", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L85_C8", "vector": [14, 3, 0.7748, 0.009, 3, 0.77, 0.0, 60, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "compliance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compliance = 1300"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L88_C8", "label": "set_force_gains()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "vector": [8, 2, 0.7928, 0.009, 2, 0.1, 0.3333, 892, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "set_force_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_gains", "annotation": ""}, "snippet": " arm.set_force_gains(p_trans=[1, 0, 0], p_rot=0.1, i_trans=[0.002, 0, 0], i_max_trans=[10, 0, 0], i_rot=0, i_max_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L89_C8", "label": "set_motion_gains()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "vector": [8, 2, 0.8018, 0.009, 2, 0.1, 0.5, 965, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "set_motion_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_motion_gains", "annotation": ""}, "snippet": " arm.set_motion_gains(p_trans=[compliance, 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L90_C8", "label": "set_force_directions()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "vector": [8, 2, 0.8108, 0.009, 2, 0.1, 0.6667, 788, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_force_directions", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_directions", "annotation": ""}, "snippet": " arm.set_force_directions([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L91_C8", "label": "set_force()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "vector": [8, 2, 0.8198, 0.009, 2, 0.1, 0.8333, 329, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_force", "arg_names": [], "import_names": [], "rhs_call_name": "set_force", "annotation": ""}, "snippet": " arm.set_force(6 * [0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "label": "if", "type": "if", "loc": [92, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "vector": [4, 2, 0.8964, 0.1441, 2, 0.1, 1.0, 0, 7, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif opts.impedance:\n compliance = float(opts.compliance)\n if compliance < 0:\n compliance = 80\n arm.set_force_gains(p_trans=[3, 1, 1], p_rot=0.1, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)\n arm.set_motion_gains(p_trans=[compliance, 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)\n arm.set_force_directions([])\n arm.set_force(6 * [0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L93_C8", "label": "compliance = float()", "type": "assigned_variable", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "vector": [14, 3, 0.8378, 0.009, 3, 0.72, 0.0, 60, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "compliance", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " compliance = float(opts.compliance)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L94_C8", "label": "if", "type": "if", "loc": [94, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "vector": [4, 3, 0.8514, 0.018, 3, 0.72, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if compliance < 0:\n compliance = 80"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L95_C12", "label": "compliance =", "type": "assigned_variable", "loc": [95, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L94_C8", "vector": [14, 4, 0.8559, 0.009, 4, 0.7, 0.0, 60, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "compliance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compliance = 80"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L96_C8", "label": "set_force_gains()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "vector": [8, 3, 0.8649, 0.009, 3, 0.72, 0.3333, 892, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "set_force_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_gains", "annotation": ""}, "snippet": " arm.set_force_gains(p_trans=[3, 1, 1], p_rot=0.1, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L97_C8", "label": "set_motion_gains()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "vector": [8, 3, 0.8739, 0.009, 3, 0.72, 0.5, 965, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "set_motion_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_motion_gains", "annotation": ""}, "snippet": " arm.set_motion_gains(p_trans=[compliance, 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L98_C8", "label": "set_force_directions()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "vector": [8, 3, 0.8829, 0.009, 3, 0.72, 0.6667, 788, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_force_directions", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_directions", "annotation": ""}, "snippet": " arm.set_force_directions([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L99_C8", "label": "set_force()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "vector": [8, 3, 0.8919, 0.009, 3, 0.72, 0.8333, 329, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_force", "arg_names": [], "import_names": [], "rhs_call_name": "set_force", "annotation": ""}, "snippet": " arm.set_force(6 * [0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "label": "if", "type": "if", "loc": [100, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "vector": [4, 3, 0.9324, 0.0721, 3, 0.72, 1.0, 0, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif opts.force:\n arm.set_force_gains(p_trans=[3, 1, 1], p_rot=0.1, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)\n arm.set_motion_gains(p_trans=[float(opts.compliance), 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)\n arm.set_force_directions(['x'])\n arm.set_force([float(opts.force_mag), 0, 0, 0, 0, 0])\n else:\n p.print_help()\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L101_C8", "label": "set_force_gains()", "type": "expression", "loc": [101, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "vector": [8, 4, 0.9099, 0.009, 4, 0.6, 0.0, 892, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "set_force_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_gains", "annotation": ""}, "snippet": " arm.set_force_gains(p_trans=[3, 1, 1], p_rot=0.1, i_trans=[0.002, 0.001, 0.001], i_max_trans=[10, 5, 5], i_rot=0, i_max_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L102_C8", "label": "set_motion_gains()", "type": "expression", "loc": [102, 102], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "vector": [8, 4, 0.9189, 0.009, 4, 0.6, 0.2, 965, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "set_motion_gains", "arg_names": [], "import_names": [], "rhs_call_name": "set_motion_gains", "annotation": ""}, "snippet": " arm.set_motion_gains(p_trans=[float(opts.compliance), 1300, 1300], d_trans=[16, 10, 10], p_rot=120, d_rot=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L103_C8", "label": "set_force_directions()", "type": "expression", "loc": [103, 103], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "vector": [8, 4, 0.9279, 0.009, 4, 0.6, 0.4, 788, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_force_directions", "arg_names": [], "import_names": [], "rhs_call_name": "set_force_directions", "annotation": ""}, "snippet": " arm.set_force_directions(['x'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L104_C8", "label": "set_force()", "type": "expression", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "vector": [8, 4, 0.9369, 0.009, 4, 0.6, 0.6, 329, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_force", "arg_names": [], "import_names": [], "rhs_call_name": "set_force", "annotation": ""}, "snippet": " arm.set_force([float(opts.force_mag), 0, 0, 0, 0, 0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L106_C8", "label": "print_help()", "type": "expression", "loc": [106, 106], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "vector": [8, 4, 0.955, 0.009, 4, 0.6, 0.8, 931, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "print_help", "arg_names": [], "import_names": [], "rhs_call_name": "print_help", "annotation": ""}, "snippet": " p.print_help()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "vector": [13, 4, 0.964, 0.009, 4, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L108_C4", "label": "update_gains()", "type": "expression", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "vector": [8, 1, 0.973, 0.009, 1, 0.44, 1.0, 582, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_gains", "arg_names": [], "import_names": [], "rhs_call_name": "update_gains", "annotation": ""}, "snippet": " arm.update_gains()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L110_C0", "label": "if", "type": "if", "loc": [110, 111], "level": 0, "parent": null, "vector": [4, 0, 0.9955, 0.018, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L111_C4", "label": "main()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L110_C0", "vector": [8, 1, 1.0, 0.009, 1, 0.29, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:ImportFrom_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Return_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:For_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Return_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99511:If_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99511:Expr_L111_C4"}] |
class TaskError(Exception):
def __init__(self, value):
self.parameter = value
def __str__(self):
return repr(self.parameter)
class ActionType:
def __init__(self, inputs, outputs):
self.inputs = inputs
self.outputs = outputs
class ParamType:
def __init__(self, name, ptype, options=None):
self.name = name
self.ptype = ptype
self.options = options
class Action:
def __init__(self, name, params):
self.name = name
self.params = params
class BehaviorDescriptor:
def __init__(self):
self.descriptors = {
'twist': ActionType([ParamType('angle', 'radian')], [ParamType('success', 'bool')]),
'linear_move': ActionType([ParamType('start_loc', 'se3'),
ParamType('movement', 'r3'),
ParamType('stop', 'discrete', ['pressure', 'pressure_accel'])],
[ParamType('success', 'bool')]),
}
start_location = (np.matrix([0.3, 0.15, 0.9]).T, np.matrix([0., 0., 0., 0.1]))
movement = np.matrix([.4, 0, 0.]).T
self.seed = [Action('linear_move', [start_location, movement, 'pressure']),
Action('linear_move', [Action('current_location', [])])]
self.run(self.seed)
def run(self, seed):
pass
#def go_to_home_pose(self):
# #self.behaviors.movement.set_movement_mode_cart()
# return self.behaviors.movement.move_absolute(self.start_location, stop='pressure')
# #self.behaviors.movement.set_movement_mode_ik()
# #return self.behaviors.movement.move_absolute(self.start_location, stop='pressure')
#def location_activated_behaviors(self, point_bl, stored_point=False):
# driving_param = {'light_switch': {'coarse': .7, 'fine': .5, 'voi': .2},
# 'drawer': {'coarse': .7, 'fine': .7, 'voi': .2}}
# map_T_base_link = tfu.transform('map', 'base_link', self.tf_listener)
# point_map = tfu.transform_points(map_T_base_link, point_bl)
# matches = self.find_close_by_points(point_map)
# if len(matches) > 0:
# #pdb.set_trace()
# ldata = self.location_data[self.location_labels[matches[0]]]
# task = ldata['task']
# rospy.loginfo('Found closeby location %s' % str(ldata))
# else:
# rospy.loginfo( 'No location matches found. Please enter location type:')
# for i, k in enumerate(driving_param.keys()):
# rospy.loginfo(' %d %s' %(i,k))
# task_number = raw_input()
# task = driving_param.keys()[int(task_number)]
# self.robot.sound.say('task %s' % task.replace('_', ' '))
# rospy.loginfo('Task is %s' % task)
# if self.approach_location(point_bl,
# coarse_stop=driving_param[task]['coarse'],
# fine_stop=driving_param[task]['fine'],
# voi_radius=driving_param[task]['voi']):
# return
# else:
# ret = self.approach_perpendicular_to_surface(point_bl,
# voi_radius=driving_param[task]['voi'],
# dist_approach=driving_param[task]['fine'])
# if ret != 3:
# rospy.logerr('location_activated_behaviors: approach_perpendicular_to_surface failed!')
# return
# base_link_T_map = tfu.transform('base_link', 'map', self.tf_listener)
# point_bl_t1 = tfu.transform_points(base_link_T_map, point_map)
# try:
# self.untuck()
# self.behaviors.movement.move_absolute(self.start_location, stop='pressure')
# self.behaviors.movement.pressure_listener.rezero()
# if task == 'light_switch':
# #self.location_add(perturbed_map, task)
# # TODO: what happens when we first encounter this location?! experiment n times to create dataset?
# self.practice(point_bl_t1,
# ft.partial(self.light_switch1,
# point_offset=np.matrix([0,0,.03]).T,
# press_contact_pressure=300,
# move_back_distance=np.matrix([-.0075,0,0]).T,
# press_pressure=3500,
# press_distance=np.matrix([0,0,-.15]).T,
# visual_change_thres=.03),
# 'light_switch')
# self.tuck()
# if False: #Old branch where we retry blindly
# MAX_RETRIES = 15
# rospy.loginfo('location_activated_behaviors: go_home_pose')
# #self.go_to_home_pose()
# self.behaviors.movement.move_absolute(self.start_location, stop='pressure')
# gaussian = pr.Gaussian(np.matrix([ 0, 0, 0.]).T, \
# np.matrix([[1., 0, 0], \
# [0, .02**2, 0], \
# [0, 0, .02**2]]))
# retry_count = 0
# success = False
# gaussian_noise = np.matrix([0, 0, 0.0]).T
# point_offset = np.matrix([0, 0, 0.03]).T
# while not success:
# perturbation = gaussian_noise
# perturbed_point_bl = point_bl_t1 + perturbation
# success, _ = self.light_switch1(perturbed_point_bl, point_offset=point_offset, \
# press_contact_pressure=300, move_back_distance=np.matrix([-.0075,0,0]).T,\
# press_pressure=3500, press_distance=np.matrix([0,0,-.15]).T, \
# visual_change_thres=.03)
# gaussian_noise = gaussian.sample()
# gaussian_noise[0,0] = 0
# retry_count = retry_count + 1
# if retry_count > MAX_RETRIES:
# self.robot.sound.say('giving up tried %d times already' % MAX_RETRIES)
# break
# elif not success:
# self.robot.sound.say('retrying')
# if success:
# self.robot.sound.say('successful!')
# if not stored_point or retry_count > 1:
# map_T_base_link = tfu.transform('map', 'base_link', self.tf_listener)
# perturbed_map = tfu.transform_points(map_T_base_link, perturbed_point_bl)
# self.location_add(perturbed_map, task)
# self.robot.sound.say('recorded point')
# #if retry_count > 1:
# # if not self.add_perturbation_to_location(point_map, perturbation):
# # self.robot.sound.say('unable to add perturbation to database! please fix')
# self.tuck()
#
# if task == 'drawer':
# self.drawer(point_bl_t1)
# self.tuck()
# self.robot.sound.say('done')
# self.location_add(point_map, task)
#
# #except lm.RobotSafetyError, e:
# # rospy.loginfo('location_activated_behaviors: Caught a robot safety exception "%s"' % str(e.parameter))
# # #self.behaviors.movement.move_absolute(self.start_location, stop='accel')
# except lm.RobotSafetyError, e:
# rospy.loginfo('location_activated_behaviors: Caught a robot safety exception "%s"' % str(e.parameter))
# self.behaviors.movement.move_absolute(self.start_location, stop='accel')
#
# except TaskError, e:
# rospy.loginfo('location_activated_behaviors: TaskError: %s' % str(e.parameter))
# rospy.loginfo('location_activated_behaviors: DONE MANIPULATION!')
# self.robot.sound.say('done')
#if self.approach_location(point_bl,
# coarse_stop=self.locations_man.driving_param[task]['coarse'],
# fine_stop=self.locations_man.driving_param[task]['fine'],
# voi_radius=self.locations_man.driving_param[task]['voi']):
# #rospy.logerr('location_approach_driving: intial approach failed')
# return True, 'initial approach'
#else:
#def load_classifier(self, classifier_name, data_file_name):
# self.learners[classifier_name] = ipa.InterestPointPerception(classifier_name,
# data_file_name, self.tf_listener)
#return {'points3d': np.column_stack(points3d_tried),
# 'instances': np.column_stack(instances_tried),
# 'points2d': np.column_stack(points2d_tried),
# 'labels': np.matrix(labels),
# 'sizes': fea_dict['sizes']}
#def blind_exploration3(self, task_id, behavior, undo_behavior, point_bl, stop_fun,
# max_retries=15, closeness_tolerance=.01, fea_dict=None):
# params = r3d.Recognize3DParam()
# params.uncertainty_x = 1.
# params.uncertainty_y = .02
# params.uncertainty_z = .02
# params.n_samples = 400
# params.uni_mix = 0.
# #MAX_RETRIES = 20
#
# # instances, locs2d, locs3d, image, rdict, sizes =
# if fea_dict == None:
# fea_dict, _ = self.read_features_save(task_id, point_bl, params)
# image_T_bl = tfu.transform('openni_rgb_optical_frame', 'base_link', self.tf_listener)
# fea_dict['image_T_bl'] = image_T_bl
# #fea_dict = self.feature_ex.read(expected_loc_bl=point_bl, params=params)
#
# dists = ut.norm(fea_dict['points3d'] - point_bl)
# ordering = np.argsort(dists).A1
# points3d_sampled = fea_dict['points3d'][:, ordering]
# points2d_sampled = fea_dict['points2d'][:, ordering]
# instances_sampled = fea_dict['instances'][:, ordering]
# start_pose = self.robot.head.pose()
# point3d_img = tfu.transform_points(fea_dict['image_T_bl'], point_bl)
# point2d_img = self.feature_ex.cal.project(point3d_img)
# sampled_idx = 0
# iter_count = 0
# labels = []
# points_tried = []
# tinstances = []
# sp2d = []
# while iter_count < max_retries and not stop_fun(np.matrix(labels)):
# if len(points_tried)> 0 and \
# np.any(ut.norm(np.column_stack(points_tried) - points3d_sampled[:, sampled_idx]) < closeness_tolerance):
# sampled_idx = sampled_idx + 1
# continue
# #pdb.set_trace()
# #self.robot.sound.say('executing behavior')
# self.robot.head.set_pose(start_pose, 1)
# success, reason = behavior(points3d_sampled[:, sampled_idx])
# iter_count = iter_count + 1
# points_tried.append(points3d_sampled[:, sampled_idx])
# tinstances.append(instances_sampled[:, sampled_idx])
# sp2d.append(points2d_sampled[:, sampled_idx])
# sampled_idx = sampled_idx + 1
# #tinstances.append(fea_dict['instances'][:,iter_count])
# #sp2d.append(fea_dict['points2d'][:,iter_count])
# #add point and label to points tried
# if success:
# labels.append(r3d.POSITIVE)
# if undo_behavior != None:
# #If we were successful, call blind exploration with the undo behavior
# def any_pos_sf(labels_mat):
# if np.any(r3d.POSITIVE == labels_mat):
# return True
# return False
# if task_id != None:
# utid = self.locations_man.create_undo_task(task_id)
# else:
# utid = None
# #TODO: gather instances for undo action
# #TODO: figure out why position of point_bl is shifted in second call
# self.seed_dataset_explore(utid, undo_behavior, None, point_bl, any_pos_sf,
# max_retries, fea_dict=fea_dict)
# #success, reason = undo_behavior(points3d_sampled[:, 'iter_count'])
# else:
# labels.append(r3d.NEGATIVE)
# #Visualization
# img = cv.CloneMat(fea_dict['image'])
# r3d.draw_points(img, points2d_sampled, [255, 255, 255], 2, -1)
# _, pos_points, neg_points = separate_by_labels(np.column_stack(sp2d), np.matrix(labels))
# r3d.draw_points(img, point2d_img, [255, 0, 0], 4, 2)
# r3d.draw_points(img, pos_points, [0, 255, 0], 2, -1)
# r3d.draw_points(img, neg_points, [0, 0, 255], 2, -1)
# r3d.draw_points(img, sp2d[-1], [0, 184, 245], 3, -1)
# self.img_pub.publish(img)
#
# rospy.loginfo('tried %d times' % iter_count)
# return {'points3d': np.column_stack(points_tried),
# 'instances': np.column_stack(tinstances),
# 'points2d': np.column_stack(sp2d),
# 'labels': np.matrix(labels),
# 'sizes': fea_dict['sizes']}
# #if iter_count > MAX_RETRIES:
# # self.robot.sound.say('giving up tried %d times already' % MAX_RETRIES)
# # break
# #elif not success:
# # self.robot.sound.say('retrying')
# return points tried record
#success, _ = self.light_switch1(perturbed_point_bl, point_offset=point_offset, \
# press_contact_pressure=300, move_back_distance=np.matrix([-.0075,0,0]).T,\
# press_pressure=3500, press_distance=np.matrix([0,0,-.15]).T, \
# visual_change_thres=.03)
# points tried = []
# while we have not succeeded and not stop_fun(points tried):
# label = behavior(point)
# add point and label to points tried
# perturb point
# return points tried record
#def load_classifier(self, name, fname):
# print 'loading classifier'
# dataset = ut.load_pickle(fname)
# self.train(dataset, name)
#self.location_labels = []
#self.location_data = []
#if os.path.isfile(self.saved_locations_fname):
# location_data = ut.load_pickle(self.saved_locations_fname) #each col is a 3d point, 3xn mat
# for idx, rloc in enumerate(location_data):
# self.location_centers.append(rloc['center'])
# self.location_labels.append(idx)
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# self.location_data = location_data
#if os.path.isfile(self.saved_locations_fname):
# location_data = ut.load_pickle(self.saved_locations_fname) #each col is a 3d point, 3xn mat
# for idx, rloc in enumerate(location_data):
# self.location_centers.append(rloc['center'])
# self.location_labels.append(idx)
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# self.location_data = location_data
#pass
#location_idx = self.location_labels[close_by_locs[0]]
#ldata = self.location_data[location_idx]
#rospy.loginfo('location_add: point close to %d at %s.' % (location_idx, str(ldata['center'].T)))
#ldata['points'].append(point_map)
#ldata['center'] = np.column_stack(ldata['points']).mean(1)
#self.location_centers[location_idx] = ldata['center']
#self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# def update_center(self, center_id, point_map):
# #If close by locations found then add to points list and update center
# location_idx = self.location_labels[close_by_locs[0]]
# ldata = self.location_data[location_idx]
#
# rospy.loginfo('location_add: point close to %d at %s.' % (location_idx, str(ldata['center'].T)))
# ldata['points'].append(point_map)
# ldata['center'] = np.column_stack(ldata['points']).mean(1)
# self.location_centers[location_idx] = ldata['center']
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
#
#def location_add(self, point_map, task, data):
# close_by_locs = self.find_close_by_points_match_task(point_map, task)
# if len(close_by_locs) == 0:
# rospy.loginfo('location_add: point not close to any existing location. creating new record.')
# self.location_data.append({
# 'task': task,
# 'center': point_map,
# 'perceptual_dataset': None,
# 'points':[point_map]})
# self.location_centers.append(point_map)
# self.location_labels.append(len(self.location_data) - 1)
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# else:
# #If close by locations found then add to points list and update center
# location_idx = self.location_labels[close_by_locs[0]]
# ldata = self.location_data[location_idx]
# rospy.loginfo('location_add: point close to %d at %s.' % (location_idx, str(ldata['center'].T)))
# ldata['points'].append(point_map)
# ldata['center'] = np.column_stack(ldata['points']).mean(1)
# self.location_centers[location_idx] = ldata['center']
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# ut.save_pickle(self.location_data, self.saved_locations_fname)
# rospy.loginfo('location_add: saved point in map.')
# def find_close_by_points(self, point_map):
# if self.locations_tree != None:
# close_by_locs = self.locations_tree.query_ball_point(np.array(point_map.T), self.LOCATION_ADD_RADIUS)[0]
# return close_by_locs
# else:
# return []
# 3) listing all locations
# 4) listing locations closest to given point, with and without task
#def find_close_by_points_match_task(self, point_map, task):
# matches = self.find_close_by_points(point_map)
# task_matches = []
# for m in matches:
# idx = self.location_labels[m]
# ldata = self.location_data[idx]
# if ldata['task'] == task:
# task_matches.append(m)
# return task_matches
#class PickPointsCloseToStartLocation:
#
# def __init__(self, point_bl, closeness_tolerance=.01, max_retries=20):
# self.params = r3d.Recognize3DParam()
# self.params.uncertainty_x = 1.
# self.params.uncertainty_y = .02
# self.params.uncertainty_z = .02
# self.params.n_samples = 400
# self.params.uni_mix = 0.
#
# self.sampled_idx = 0
# self.iter_count = 0
# self.max_retries = max_retries
# self.closeness_tolerance = closeness_tolerance
#
# self.points3d_tried = []
# self.points2d_tried = []
# self.instances_tried = []
#
# def process_scan(self, fea_dict):
# dists = ut.norm(fea_dict['points3d'] - point_bl)
# ordering = np.argsort(dists).A1
#
# self.points3d_sampled = fea_dict['points3d'][:, ordering]
# self.points2d_sampled = fea_dict['points2d'][:, ordering]
# self.instances_sampled = fea_dict['instances'][:, ordering]
#
# def get_params(self):
# return self.params
#
# def stop(self):
# return self.iter_count > max_retries
#
# def pick_next(self):
# while len(self.points3d_tried) > 0 \
# and np.any(ut.norm(np.column_stack(self.points3d_tried) - self.points3d_sampled[:, self.sampled_idx]) < self.closeness_tolerance):
# self.sampled_idx = self.sampled_idx + 1
#
# self.points3d_tried.append(self.points3d_sampled[:, self.sampled_idx])
# self.points2d_tried.append(self.points2d_sampled[:, self.sampled_idx])
# self.instances_tried.append(self.instances_sampled[:, self.sampled_idx])
# self.iter_count = iter_count + 1
#
# return {'points3d': self.points3d_sampled[:, self.sampled_idx],
# 'points2d': self.points2d_sampled[:, self.sampled_idx],
# 'instances': self.instances_sampled[:, self.sampled_idx]}
#
# def get_instances_used(self):
# if len(self.points3d_sampled) > 0:
# return {'points3d': np.column_stack(self.points3d_sampled),
# 'points2d': np.column_stack(self.points2d_sampled),
# 'instances': np.column_stack(self.instances_sampled)}
# else:
# return None
#
#class PickPointsUsingActiveLearning:
#
# def __init__(self, locations_manager):
# self.params = r3d.Recognize3DParam()
# self.params.uncertainty_x = 1.
# self.params.n_samples = 2000
# self.params.uni_mix = .1
#
# self.points3d_tried = []
# self.points2d_tried = []
# self.instances_tried = []
#
# def process_scan(self, fea_dict):
#
# def get_params(self):
#
# def pick_next(self):
#
# def stop(self):
#
# def get_instances_used(self):
#self.LOCATION_ADD_RADIUS = .5
#self.kinect_listener = kl.KinectListener()
#self.kinect_cal = rc.ROSCameraCalibration('camera/rgb/camera_info')
#self.kinect_img_sub = message_filters.Subscriber('/camera/rgb/image_color', smsg.Image)
#self.kinect_depth_sub = message_filters.Subscriber('/camera/depth/points2', smsg.PointCloud2)
#ts = message_filters.TimeSynchronizer([image_sub, depth_sub], 10)
#ts.registerCallback(callback)
#self.load_classifier('light_switch', 'labeled_light_switch_data.pkl')
#self.start_location = (np.matrix([0.25, 0.30, 1.3]).T, np.matrix([0., 0., 0., 0.1]))
#loading stored locations
#self.saved_locations_fname = 'saved_locations.pkl'
#self.location_centers = []
#self.location_labels = []
#self.location_data = []
#self.locations_tree = None
#if os.path.isfile(self.saved_locations_fname):
# location_data = ut.load_pickle(self.saved_locations_fname) #each col is a 3d point, 3xn mat
# for idx, rloc in enumerate(location_data):
# self.location_centers.append(rloc['center'])
# self.location_labels.append(idx)
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# self.location_data = location_data
# joint angles used for tuck
#pdb.set_trace()
#self.untuck()
#self.behaviors.movement.set_movement_mode_ik()
#self.movement.set_movement_mode_ik()
#self.tuck()
#self.r1 = np.matrix([[-0.31006769, 1.2701541 , -2.07800829, -1.45963243, -4.35290489,
# -1.86052221, 5.07369192]]).T
#self.l0 = np.matrix([[ 1.05020383, -0.34464327, 0.05654 , -2.11967694,
# -10.69100221, -1.95457839, -3.99544713]]).T
#self.l1 = np.matrix([[ 1.06181076, 0.42026402, 0.78775801, -2.32394841,
# -11.36144995, -1.93439025, -3.14650108]]).T
#self.l2 = np.matrix([[ 0.86275197, 0.93417818, 0.81181124, -2.33654346,
# -11.36121856, -2.14040499, -3.15655164]]).T
#self.l3 = np.matrix([[ 0.54339568, 1.2537778 , 1.85395725, -2.27255481, -9.92394984,
# -0.86489749, -3.00261708]]).T
#def train(self, dataset, name):
# rec_params = self.feature_ex.rec_params
# nneg = np.sum(dataset.outputs == r3d.NEGATIVE) #TODO: this was copied and pasted from r3d
# npos = np.sum(dataset.outputs == r3d.POSITIVE)
# print '================= Training ================='
# print 'NEG examples', nneg
# print 'POS examples', npos
# print 'TOTAL', dataset.outputs.shape[1]
# neg_to_pos_ratio = float(nneg)/float(npos)
# weight_balance = ' -w0 1 -w1 %.2f' % neg_to_pos_ratio
# print 'training'
# learner = r3d.SVMPCA_ActiveLearner(use_pca=True)
# #TODO: figure out something scaling inputs field!
# learner.train(dataset, dataset.inputs,
# rec_params.svm_params + weight_balance,
# rec_params.variance_keep)
# self.learners[name] = {'learner': learner, 'dataset': dataset}
# print 'done loading'
#def tuck(self):
# ldiff = np.linalg.norm(pr2.diff_arm_pose(self.robot.left.pose(), self.l3))
# # np.linalg.norm(self.robot.left.pose() - self.l3)
# rdiff = np.linalg.norm(pr2.diff_arm_pose(self.robot.right.pose(), self.r1))
# #rdiff = np.linalg.norm(self.robot.right.pose() - self.r1)
# if ldiff < .3 and rdiff < .3:
# rospy.loginfo('tuck: Already tucked. Ignoring request.')
# return
# self.robot.right.set_pose(self.r1, block=False)
# self.robot.left.set_pose(self.l0, block=True)
# poses = np.column_stack([self.l0, self.l1, self.l2, self.l3])
# #pdb.set_trace()
# self.robot.left.set_poses(poses, np.array([0., 1.5, 3, 4.5]))
#def untuck(self):
# if np.linalg.norm(self.robot.left.pose() - self.l0) < .3:
# rospy.loginfo('untuck: Already untucked. Ignoring request.')
# return
# self.robot.right.set_pose(self.r1, 2., block=False)
# self.robot.left.set_pose(self.l3, 2., block=True)
# poses = np.column_stack([self.l3, self.l2, self.l1, self.l0])
# self.robot.left.set_poses(poses, np.array([0., 3., 6., 9.])/2.)
#if len(self.location_centers) < 1:
# return
#rospy.loginfo('click_cb: double clicked but no 3d point given')
#rospy.loginfo('click_cb: will use the last successful location given')
#base_link_T_map = tfu.transform('base_link', 'map', self.tf_listener)
#point_bl = tfu.transform_points(base_link_T_map, self.location_centers[-1])
#rospy.loginfo('click_cb: using ' + str(self.location_centers[-1].T))
#self.location_activated_behaviors(point_bl, stored_point=True)
#def find_close_by_points(self, point_map):
# if self.locations_tree != None:
# close_by_locs = self.locations_tree.query_ball_point(np.array(point_map.T), self.LOCATION_ADD_RADIUS)[0]
# return close_by_locs
# else:
# return []
#def find_close_by_points_match_task(self, point_map, task):
# matches = self.find_close_by_points(point_map)
# task_matches = []
# for m in matches:
# idx = self.location_labels[m]
# ldata = self.location_data[idx]
# if ldata['task'] == task:
# task_matches.append(m)
# return task_matches
#def location_add(self, point_map, task, data):
# close_by_locs = self.find_close_by_points_match_task(point_map, task)
# if len(close_by_locs) == 0:
# rospy.loginfo('location_add: point not close to any existing location. creating new record.')
# self.location_data.append({
# 'task': task,
# 'center': point_map,
# 'perceptual_dataset': None,
# 'points':[point_map]})
# self.location_centers.append(point_map)
# self.location_labels.append(len(self.location_data) - 1)
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# else:
# #If close by locations found then add to points list and update center
# location_idx = self.location_labels[close_by_locs[0]]
# ldata = self.location_data[location_idx]
# rospy.loginfo('location_add: point close to %d at %s.' % (location_idx, str(ldata['center'].T)))
# ldata['points'].append(point_map)
# ldata['center'] = np.column_stack(ldata['points']).mean(1)
# self.location_centers[location_idx] = ldata['center']
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# ut.save_pickle(self.location_data, self.saved_locations_fname)
# rospy.loginfo('location_add: saved point in map.')
#def location_add(self, point_map, task):
# close_by_locs = self.find_close_by_points_match_task(point_map, task)
# if len(close_by_locs) == 0:
# rospy.loginfo('location_add: point not close to any existing location. creating new record.')
# self.location_data.append({
# 'task': task,
# 'center': point_map,
# 'points':[point_map]})
# self.location_centers.append(point_map)
# self.location_labels.append(len(self.location_data) - 1)
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# else:
# #If close by locations found then add to points list and update center
# location_idx = self.location_labels[close_by_locs[0]]
# ldata = self.location_data[location_idx]
# rospy.loginfo('location_add: point close to %d at %s.' % (location_idx, str(ldata['center'].T)))
# ldata['points'].append(point_map)
# ldata['center'] = np.column_stack(ldata['points']).mean(1)
# self.location_centers[location_idx] = ldata['center']
# self.locations_tree = sp.KDTree(np.array(np.column_stack(self.location_centers).T))
# ut.save_pickle(self.location_data, self.saved_locations_fname)
# rospy.loginfo('location_add: saved point in map.')
#def record_processed_data_kinect2(self, point3d_bl, kinect_fea):
# instances, locs2d_image, locs3d_bl, image = kinect_fea #self.feature_ex.read(point3d_bl)
# #rospy.loginfo('Getting a kinect reading')
# tstring = time.strftime('%A_%m_%d_%Y_%I:%M%p')
# kimage_name = '%s_highres.png' % tstring
# cv.SaveImage(kimage_name, kimage)
# preprocessed_dict = {'instances': instances,
# 'points2d': locs2d_image,
# 'points3d': locs3d_bl,
# 'image': kimage_name,
# 'labels': labels,
# 'sizes': feature_extractor.sizes}
#self.feature_ex.read(point3d_bl)
#rdict = self.kinect_listener.read()
#kimage = rdict['image']
#rospy.loginfo('Waiting for calibration.')
#while self.kinect_cal.has_msg == False:
# time.sleep(.1)
#which frames?
#rospy.loginfo('Getting transforms.')
#k_T_bl = tfu.transform('openni_rgb_optical_frame', '/base_link', self.tf_listener)
#tstring = time.strftime('%A_%m_%d_%Y_%I:%M%p')
#kimage_name = '%s_highres.png' % tstring
#rospy.loginfo('Saving images (basename %s)' % tstring)
#cv.SaveImage(kimage_name, kimage)
#rospy.loginfo('Saving pickles')
#pickle_fname = '%s_interest_point_dataset.pkl' % tstring
#data_pkl = {'touch_point': point3d_bl,
# 'points3d': rdict['points3d'],
# 'image': kimage_name,
# 'cal': self.prosilica_cal,
# 'k_T_bl': k_T_bl}
#'point_touched': point3d_bl}
#ut.save_pickle(data_pkl, pickle_fname)
#print 'Recorded to', pickle_fname
#npoint = point + gaussian_noise
#success_off, touchloc_bl = self.light_switch1(npoint,
#pdb.set_trace()
# ##
# # The behavior can make service calls to a GUI asking users to label
# def repeat_action(self, task_id, ctask_id, point3d_bl, sampling_object, stop_fun, fea_dict=None):
#
# # instances, locs2d_image, locs3d_bl, image, raw_dict =
# #kf_dict = self.feature_ex.read(point3d_bl)
# params = r3d.Recognize3DParam()
# params.uncertainty_x = 1.
# params.n_samples = 2000
# params.uni_mix = .1
#
# kdict, fname = self.read_features_save(task_id, point3d_bl, params)
# learner = self.locations_man.learners[task_id]
# behavior = self.get_behavior_by_task(self.locations_man.data[task_id]['task'])
# undo_behavior = self.get_undo_behavior_by_task(self.locations_man.data[task_id]['task'])
# start_pose = self.robot.head.pose()
#
# kdict['image_T_bl'] = tfu.transform('openni_rgb_optical_frame', 'base_link', self.tf_listener)
# point3d_img = tfu.transform_points(kdict['image_T_bl'], point3d_bl)
# point2d_img = self.feature_ex.cal.project(point3d_img)
#
# labels = []
# points3d_tried = []
# points2d_tried = []
# converged = False
# indices_added = []
# pdb.set_trace()
#
#
# while not converged and not stop_fun(np.matrix(labels)):
# #Find remaining instances
# remaining_pt_indices = r3d.inverse_indices(indices_added, kdict['instances'].shape[1])
# remaining_instances = kdict['instances'][:, remaining_pt_indices]
#
# #Ask learner to pick an instance
# ridx, selected_dist, converged = learner.select_next_instances_no_terminate(remaining_instances)
# selected_idx = remaining_pt_indices[ridx]
# indices_added.append(selected_idx)
#
# #draw
# img = cv.CloneMat(kdict['image'])
# #Draw the center
# r3d.draw_points(img, point2d_img, [255, 0, 0], 4, 2)
# #Draw possible points
# r3d.draw_points(img, kdict['points2d'], [255, 255, 255], 2, -1)
# #Draw what we have so far
# if len(points2d_tried) > 0:
# _, pos_exp, neg_exp = separate_by_labels(np.column_stack(points2d_tried), np.matrix(labels))
# r3d.draw_points(img, pos_exp, [0, 255, 0], 3, 1)
# r3d.draw_points(img, neg_exp, [0, 0, 255], 3, 1)
#
# predictions = np.matrix(learner.classify(kdict['instances']))
# _, pos_pred, neg_pred = separate_by_labels(kdict['points2d'], predictions)
# r3d.draw_points(img, pos_pred, [0, 255, 0], 2, -1)
# r3d.draw_points(img, neg_pred, [0, 0, 255], 2, -1)
#
# #Draw what we're selecting
# r3d.draw_points(img, kdict['points2d'][:, selected_idx], [0, 184, 245], 3, -1)
# self.img_pub.publish(img)
#
# #Get label for instance
# self.robot.head.set_pose(start_pose, 1)
#
# #EXCECUTE!!
# success, reason = behavior(kdict['points3d'][:, selected_idx])
# if success:
# color = [0,255,0]
# label = r3d.POSITIVE
# def any_pos_sf(labels_mat):
# if np.any(r3d.POSITIVE == labels_mat):
# return True
# return False
# utid = self.locations_man.create_undo_task(task_id)
# self.blind_exploration2(utid, undo_behavior, None, point3d_bl, any_pos_sf,
# max_retries=max_undo_retries, fea_dict=kdict)
#
# else:
# label = r3d.NEGATIVE
# color = [0,0,255]
#
# labels.append(label)
# points3d_tried.append(kdict['points3d'][:, selected_idx])
# points2d_tried.append(kdict['points2d'][:, selected_idx])
#
# datapoint = {'instances': kdict['instances'][:, selected_idx],
# 'points2d': kdict['points2d'][:, selected_idx],
# 'points3d': kdict['points3d'][:, selected_idx],
# 'sizes': kdict['sizes'],
# 'labels': np.matrix([label])
# }
# self.locations_man.add_perceptual_data(task_id, datapoint)
# self.locations_man.save_database()
# self.locations_man.train(task_id)
#
# #Classify
# predictions = np.matrix(learner.classify(kdict['instances']))
#
# #Draw
# img = cv.CloneMat(kdict['image'])
# _, pos_exp, neg_exp = separate_by_labels(np.column_stack(points2d_tried), np.matrix(labels))
# r3d.draw_points(img, point2d_img, [255, 0, 0], 4, 2)
# r3d.draw_points(img, kdict['points2d'], [255, 255, 255], 2, -1)
# r3d.draw_points(img, pos_exp, [0, 255, 0], 3, 1)
# r3d.draw_points(img, neg_exp, [0, 0, 255], 3, 1)
#
# _, pos_pred, neg_pred = separate_by_labels(kdict['points2d'], predictions)
# r3d.draw_points(img, pos_pred, [0, 255, 0], 2, -1)
# r3d.draw_points(img, neg_pred, [0, 0, 255], 2, -1)
# r3d.draw_points(img, points2d_tried[-1], color, 3, -1)
#
# #publish
# self.img_pub.publish(img)
#Save dataset in the location's folder
#def save_dataset(self, task_id, point, rdict):
# pt.join(task_id,
# self.locations_man
# self.record_perceptual_data(point, rdict)
# #TODO...
#TODO TEST
#BOOKMARK 3/7 4:03 AM
#LAST DITCH EXECUTION(point, stop_fun):
#def blind_exploration(self, behavior, point_bl, stop_fun, max_retries=15):
# gaussian = pr.Gaussian(np.matrix([ 0, 0, 0.]).T, \
# np.matrix([[1., 0, 0], \
# [0, .02**2, 0], \
# [0, 0, .02**2]]))
# iter_count = 0
# gaussian_noise = np.matrix([0, 0, 0.0]).T #We want to try the given point first
# labels = []
# points_tried = []
# #while we have not succeeded and not stop_fun(points tried):
# while iter_count < MAX_RETRIES and stop_fun(np.matrix(labels)):
# perturbation = gaussian_noise
# perturbed_point_bl = point_bl + perturbation
# self.robot.sound.say('executing behavior')
# success, reason = behavior(perturbed_point_bl)
# points_tried.append(perturbed_point_bl)
# #add point and label to points tried
# if success:
# labels.append(r3d.POSITIVE)
# else:
# labels.append(r3d.NEGATIVE)
# #perturb point
# gaussian_noise = gaussian.sample()
# gaussian_noise[0,0] = 0
# iter_count = iter_count + 1
#
# self.robot.sound.say('tried %d times' % iter_count)
# return np.column_stack(points_tried)
#def blind_exploration2(self, task_id, behavior, undo_behavior, point_bl, stop_fun,
# max_retries=15, closeness_tolerance=.005, fea_dict=None):
# params = r3d.Recognize3DParam()
# params.uncertainty_x = 1.
# params.uncertainty_y = .02
# params.uncertainty_z = .02
# params.n_samples = 400
# params.uni_mix = 0.
# MAX_RETRIES = 20
#
# if fea_dict == None:
# fea_dict, _ = self.read_features_save(task_id, point_bl, params)
#
# dists = ut.norm(fea_dict['points3d'] - point_bl)
# ordering = np.argsort(dists).A1
# points3d_sampled = fea_dict['points3d'][:, ordering]
# points2d_sampled = fea_dict['points2d'][:, ordering]
# instances_sampled = fea_dict['instances'][:, ordering]
# labels = []
# points_tried = []
# tinstances = []
# sp2d = []
# labels.append(r3d.POSITIVE)
# points_tried.append(points3d_sampled[:, 0])
# tinstances.append(instances_sampled[:, 0])
# sp2d.append(points2d_sampled[:, 0])
# labels.append(r3d.NEGATIVE)
# points_tried.append(points3d_sampled[:, 1])
# tinstances.append(instances_sampled[:, 1])
# sp2d.append(points2d_sampled[:, 1])
# return {'points3d': np.column_stack(points_tried),
# 'instances': np.column_stack(tinstances),
# 'points2d': np.column_stack(sp2d),
# 'labels': np.matrix(labels),
# 'sizes': fea_dict['sizes']}
#def __init__(self, object_name, labeled_data_fname, tf_listener):
#make learner
#learner = SVMActiveLearnerApp()
#labeled_light_switch_dataset = ut.load_pickle(data_file_name)
#learner.train(labeled_light_switch_dataset,
# labeled_light_switch_dataset.sizes['intensity']
# self.params.variance_keep)
#self.learners[classifier_name] = learner
#def locate_light_switch(self):
# #capture data
# pointcloud_msg = self.laser_scan.scan(math.radians(180.), math.radians(-180.), 20.)
# prosilica_image = self.prosilica.get_frame() #TODO check if this is a cvmat
# while self.prosilica_cal.has_msg == False:
# time.sleep(.1)
# #preprocess
# ic_data = IntensityCloudData(pointcloud_msg, prosilica_image,
# tfu.transform('/high_def_optical_frame', '/base_link', self.tf_listener),
# self.prosilica_cal,
# r3d.Recognize3DParam())
# instances = ic_data.extract_vectorized_features()
# results = []
# for i in range(instances.shape[1]):
# nlabel = self.learners['light_switch'].classify(instances[:, i])
# results.append(nlabel)
# results = np.matrix(results)
# positive_indices = np.where(results == r3d.POSITIVE)[1]
# #want 3d location of each instance
# positive_points_3d = ic_data.sampled_points[:, positive_indices]
# #return a random point for now
# rindex = np.random.randint(0, len(positive_indices))
# return positive_points_3d[:,rindex]
#def add_perturbation_to_location(self, point_map, perturbation):
# locs = self.find_close_by_points(point_map)
# if locs != None:
# location = self.location_data[self.location_labels(locs[0])]
# if not location.has_key('perturbation'):
# location['perturbation'] = []
# location['perturbation'].append(perturbation)
# return True
# return False
#self.go_to_home_pose()
#print '>>>> POINT IS', point_bl_t1.T
#point_bl_t1 = np.matrix([[ 0.73846737, 0.07182931, 0.55951065]]).T
#DIST_THRESHOLD = .8 for lightswitch
#DIST_THRESHOLD = .85 #for drawers
#DIST_APPROACH = .5
#COARSE_STOP = .7
#FINE_STOP = .7
#VOI_RADIUS = .2
#point_dist = np.linalg.norm(point_bl_t0[0:2,0])
#rospy.loginfo('run_behaviors: Point is %.3f away.' % point_dist)
#map_T_base_link = tfu.transform('map', 'base_link', self.tf_listener)
#point_map = tfu.transform_points(map_T_base_link, point_bl_t0)
#if point_dist > DIST_THRESHOLD:
# rospy.loginfo('run_behaviors: Point is greater than %.1f m away (%.3f). Driving closer.' % (DIST_THRESHOLD, point_dist))
# ##self.turn_to_point(point_bl_t0)
# rospy.loginfo( 'run_behaviors: CLICKED on point_bl ' + str(point_bl_t0.T))
# ret = self.drive_approach_behavior(point_bl_t0, dist_far=COARSE_STOP)
# if ret != 3:
# base_link_T_map = tfu.transform('base_link', 'map', self.tf_listener)
# point_bl_t1 = tfu.transform_points(base_link_T_map, point_map)
# dist_end = np.linalg.norm(point_bl_t1[0:2,0])
# if dist_end > DIST_THRESHOLD:
# rospy.logerr('run_behaviors: drive_approach_behavior failed! %.3f' % dist_end)
# self.robot.sound.say("I am unable to navigate to that location")
# return
# base_link_T_map = tfu.transform('base_link', 'map', self.tf_listener)
# point_bl_t1 = tfu.transform_points(base_link_T_map, point_map)
# ret = self.approach_perpendicular_to_surface(point_bl_t1, voi_radius=VOI_RADIUS, dist_approach=FINE_STOP)
# if ret != 3:
# rospy.logerr('run_behaviors: approach_perpendicular_to_surface failed!')
# return
# #map_T_base_link = tfu.transform('map', 'base_link', self.tf_listener)
# #point_bl_t2 = tfu.transform_points(base_link_T_map, point_map)
# self.robot.sound.say('done')
# rospy.loginfo('run_behaviors: DONE DRIVING!')
#elif False:
#if tf_listener == None:
# self.tf_listener = tf.TransformListener()
#else:
# self.tf_listener = tf_listener
#self.pr2 = pr2_obj
#self.cman = con.ControllerManager(arm, self.tf_listener, using_slip_controller=1)
#self.reactive_gr = rgr.ReactiveGrasper(self.cman)
#if arm == 'l':
# ptopic = '/pressure/l_gripper_motor'
# self.arm_obj = self.pr2.left
# self.ik_frame = 'l_wrist_roll_link'
# self.tool_frame = 'l_gripper_tool_frame'
#else:
# ptopic = '/pressure/r_gripper_motor'
# self.arm_obj = self.pr2.right
# self.ik_frame = 'r_wrist_roll_link'
# self.tool_frame = 'r_gripper_tool_frame'
#self.movement_mode = 'ik' #or cart
#rospy.Subscriber('cursor3d', PointStamped, self.laser_point_handler)
#self.double_click = rospy.Subscriber('mouse_left_double_click', String, self.double_click_cb)
#def set_movement_mode_ik(self):
# self.movement_mode = 'ik'
# self.reactive_gr.cm.switch_to_joint_mode()
# self.reactive_gr.cm.freeze_arm()
#def set_movement_mode_cart(self):
# self.movement_mode = 'cart'
#pdb.set_trace()
#self.gather_interest_point_dataset(point)
#point = np.matrix([ 0.60956734, -0.00714498, 1.22718197]).T
#pressure_parameters = range(1900, 2050, 30)
#self.record_perceptual_data(point)
#successes = []
#parameters = [np.matrix([-.15, 0, 0]).T, 300, np.matrix([-.005, 0, 0]).T, 3500, np.matrix([0,0,-.15]).T, .03]
#for p in pressure_parameters:
# experiment = []
# for i in range(4):
# #Turn off lights
# rospy.loginfo('Experimenting with press_pressure = %d' % p)
# success_off = self.light_switch1(point,
# point_offset=np.matrix([-.15,0,0]).T, press_contact_pressure=300, move_back_distance=np.matrix([-.005,0,0]).T,\
# press_pressure=3500, press_distance=np.matrix([0,0,-.15]).T, visual_change_thres=.03)
# experiment.append(success_off)
# rospy.loginfo('Lights turned off? %s' % str(success_off))
# return
# #Turn on lights
# success_on = self.light_switch1(point,
# point_offset=np.matrix([-.15,0,-.10]).T, press_contact_pressure=300, move_back_distance=np.matrix([-0.005, 0, 0]).T,
# press_pressure=3500, press_distance=np.matrix([0,0,.1]).T, visual_change_thres=.03)
# #def light_switch1(self, point,
# # point_offset, press_contact_pressure, move_back_distance,
# # press_pressure, press_distance, visual_change_thres):
# print 'Lights turned on?', success_on
# successes.append(experiment)
#ut.save_pickle({'pressure': pressure_parameters,
# 'successes': successes}, 'pressure_variation_results.pkl')
#return self.pressure_listener.check_threshold() or self.pressure_listener.check_safety_threshold()
##stop if you hit a tip, side, back, or palm
#(left_touching, right_touching, palm_touching) = self.reactive_gr.check_guarded_move_contacts()
##saw a contact, freeze the arm
#if left_touching or right_touching or palm_touching:
# rospy.loginfo("CONTACT made!")
# return True
#else:
# return False
#print 'move returning'
#return whether the left and right fingers were touching
#return (left_touching, right_touching, palm_touching)
#def execute_action_list(self):
#def run(self, seed):
# # search for pairs of perception operators and manipulation operators that would work
# population = 10
# seeds = []
# for i in range(population):
# aseed = copy.deepcopy(seed)
# # 'bool', 'radian', 'se3', 'r3', 'discrete',
# new_seed_actions = []
# for action in aseed:
# if replace_action:
# pass
# if delete_action:
# pass
#
# if insert_action:
# #pick random action from descriptors list
# new_action =
# new_seed_actions += new_action
# pass
#
# if perturb_parameter:
# num_params = len(action.params)
# rand_param_idx = ...
# self.descriptors[action.name].params[rand_param_idx]
# rand_param_types[rand_param_types]
# #can replace/delete/insert action
# #can pick a parameter and perturb it
# #pdb.set_trace()
# print seed
#point = np.matrix([0.63125642, -0.02918334, 1.2303758 ]).T
#print 'move direction', movement.T
#print 'CORRECTING', point.T
#print 'NEW', point.T
#start_location = (np.matrix([0.25, 0.15, 0.7]).T, np.matrix([0., 0., 0., 0.1]))
#movement = np.matrix([.4, 0., 0.]).T
#what other behavior would I want?
# touch then move away..
# move back but more slowly..
# want a safe physical
# a safe exploration strategy
#self.behaviors.linear_move(self.behaviors.current_location(), back_alittle, stop='none')
#loc_before = self.behaviors.current_location()[0]
#loc_after = self.behaviors.current_location()[0]
#pdb.set_trace()
#self.behaviors.linear_move(self.behaviors.current_location(), down, stop='pressure_accel')
#self.behaviors.linear_move(self.behaviors.current_location(), back, stop='none')
#pdb.set_trace()
#b.twist(math.radians(30.))
#bd = BehaviorDescriptor()
#movement = point - self.behaviors.current_location()[0]
#pdb.set_trace()
#self.behaviors.linear_move(self.behaviors.current_location(), movement, stop='pressure_accel')
#loc = self.behaviors.current_location()[0]
#front_loc = point.copy()
#front_loc[0,0] = loc[0,0]
#self.behaviors.set_pressure_threshold(150)
#self.behaviors.move_absolute((front_loc, self.behaviors.current_location()[1]), stop='pressure_accel')
#self.behaviors.move_absolute((point, self.behaviors.current_location()[1]), stop='pressure_accel')
#def detect_event(self):
# self.behaviors.cman._start_gripper_event_detector(timeout=40.)
# stop_func = self.behaviors._tactile_stop_func
# while stop_func():
#pass
#self.robot = pr2.PR2()
#self.kin = pk.PR2Kinematics(self.robot.tf_listener)
#def linear_move(self, start_location, direction, distance, arm):
# if arm == 'left':
# arm_kin = self.kin.left
# else:
# arm_kin = self.kin.right
# start_pose = arm_kin.ik(start_location)
# loc = start_location[0:3, 4]
# end_location = loc + distance*direction
# end_pose = arm_kin.ik(end_location)
# self.robot.left_arm.set_pose(start_pose, 5.) #!!!
# self.robot.left_arm.set_pose(end_pose, 5.) #!!!
##stop if you hit a tip, side, back, or palm
#(left_touching, right_touching, palm_touching) = rg.check_guarded_move_contacts()
##saw a contact, freeze the arm
#if left_touching or right_touching or palm_touching:
# rospy.loginfo("saw contact")
# rg.cm.switch_to_joint_mode()
# rg.cm.freeze_arm()
# break
#import pdb
#start_location = [0.34, 0.054, 0.87] + [0.015454981255042808, -0.02674860197736427, -0.012255429236635201, 0.999447577565171]
#direction = np.matrix([1., 0., 0.]).T
#self.reactive_l.move_cartesian_step(start_location, blocking = 1)
#(left_touching, right_touching, palm_touching) = self.reactive_l.guarded_move_cartesian(grasp_pose, 10.0, 5.0)
#self.cman_r = con.ControllerManager('r')
#self.reactive_r = rgr.ReactiveGrasper(self.cman_r)
#self.cman_r.start_joint_controllers()
#self.reactive_r.start_gripper_controller()
#(pos, rot) = self.cman.return_cartesian_pose()
#pdb.set_trace()
#currentgoal = pos + rot
#currentgoal[2] -= .05
#self.reactive_l.move_cartesian_step(currentgoal, blocking = 1)
#(left_touching, right_touching, palm_touching) = self.reactive_l.guarded_move_cartesian(grasp_pose, 10.0, 5.0)
#exit()
#end_loc = start_location + direction * distance
#self.reactive_l.move_cartesian_step(start_loc, blocking = 1)
#self.reactive_l.move_cartesian_step(end_loc, blocking = 1)
#left_pose = b.robot.left.pose()
#left_cart = ut.load_pickle('start_pose.pkl')
#pdb.set_trace()
#kin_sol = b.kin.left.ik(left_cart)
#b.robot.left.set_pose(kin_sol, 5.)
##b.linear_move(left_cart)
##left_cart = b.kin.left.fk(left_pose)
##pdb.set_trace()
#print left_cart
#(pos, rot) = cm.return_cartesian_pose()
#currentgoal = pos+rot
#currentgoal[2] -= .05
#rg.move_cartesian_step(currentgoal, blocking = 1)
#exit()
#b.linear_move()
#cart_pose = kin.left.fk('torso_lift_link', 'l_wrist_roll_link', joints)
#kin.left.ik(cart_pose, 'torso_lift_link')
#def light_switch1_on(self, point, press_pressure=3500, press_contact_pressure=150):
# point = point + np.matrix([-.15, 0, -0.20]).T
# success, reason = self.behaviors.reach(point)
# if not success:
# rospy.loginfo('Reach failed due to "%s"' % reason)
# rospy.loginfo('PRESSING')
# success, reason = self.behaviors.press(np.matrix([0, 0, .20]).T, \
# press_pressure, press_contact_pressure)
# if not success:
# rospy.loginfo('Press failed due to "%s"' % reason)
# return
# rospy.loginfo('RESETING')
# r2 = self.behaviors.move_absolute(self.start_location, stop='pressure_accel')
# if r2 != None:
# rospy.loginfo('moving back to start location failed due to "%s"' % r2)
# return
# print 'DONE.'
#def _tactile_stop_func(self):
# r1 = self.pressure_listener.check_threshold()
# r2 = self.pressure_listener.check_safety_threshold()
# if r1:
# rospy.loginfo('Pressure exceeded!')
# if r2:
# rospy.loginfo('Pressure safety limit EXCEEDED!')
# return r1 or r2
#r1 = self.pressure_listener.check_threshold()
#r2 = self.pressure_listener.check_safety_threshold()
#if r1:
# rospy.loginfo('Pressure exceeded!')
#if r2:
# rospy.loginfo('Pressure safety limit EXCEEDED!')
#pressure_state = r1 or r2
#pressure_state = self.pressure_listener.check_threshold() or self.pressure_listener.check_safety_threshold()
#action finished (trigger seen)
#def optimize_parameters(self, x0, x_range, behavior, objective_func, reset_env_func, reset_param):
# reset_retries = 3
# num_params = len(x0)
# x = copy.deepcopy(x0)
# # for each parameter
# #for i in range(num_params):
# while i < num_params:
# #search for a good setting
# not_converged = True
# xmin = x_range[i, 0]
# xmax = x_range[i, 1]
# while not_converged:
# current_val = x[i]
# candidates_i = [(x[i] + xmin) / 2., (x[i] + xmax) / 2.]
# successes = []
# for cand in candidates_i:
# x[i] = cand
# success = behavior(x)
# if success:
# for reset_i in range(reset_retries):
# reset_success = reset_env_func(*reset_param)
# if reset_success:
# break
# successes.append(success)
# if successes[0] and successes[1]:
# raise RuntimeException('What? this isn\'t suppose to happen.')
# elif successes[0] and not successes[1]:
# next_val = candidates_i[0]
# elif successes[1] and not successes[0]:
# next_val = candidates_i[1]
# else:
# raise RuntimeException('What? this isn\'t suppose to happen.')
# #if all the trials are bad
# if not test(successes):
# #go back by 1 parameter
# i = i - 1
# #if there are more than one good parameter
# for p in params
# ... = objective_func(p)
# i = i + 1
# return x
#def autonomous_learn(self, point3d_bl, behavior, object_name):
# # We learn, but must moderate between spatial cues and requirements of
# # the learner. Spatial cue is a heuristic that can guide to positive
# # examples. Learning heuristic reduces the number of experiments to
# # perform given that we know that we are generally *not* successful
# # (assume that this procedure launches only during non mission critial circumstances).
# # So in the case where we're actively learning we're going to ignore the spatial heuristic.
# # Well... can we incorporate distance to the selected 3d point as a feature?
# # ah!
# learn_manager = self.learners[object_name]
# #scan and extract features
# self.robot.head.look_at(point3d_bl, 'base_link', True)
# learn_manager.scan(point3d_bl)
# gaussian = pr.Gaussian(np.matrix([ 0, 0, 0.]).T, \
# np.matrix([[1., 0, 0], \
# [0, .02**2, 0], \
# [0, 0, .02**2]]))
# #pdb.set_trace()
# gaussian_noise = np.matrix([0,0,0.]).T
# while not learn_manager.is_ready():
# pi = point3d_bl + gaussian_noise
# label = behavior(pi)
# #look at point, then try to add again
# if not learn_manager.add_example(pi, np.matrix([label])):
# rospy.logerr('Unable to extract features from point %s' % str(pi.T))
# continue
# learn_manager.train()
# learn_manager.draw_and_send()
# gaussian_noise = gaussian.sample()
# gaussian_noise[0,0] = 0
# #Acquire data
# #Given image, cloud, 3d point ask, extract features.
# #while no_interruptions and stopping_criteria_not_reached
# # maximally_informative_point = get maximally informative point
# # label = behavior(maximally_informative_point)
# # retrain!
# converged = False
# while not converged:
# indices, dists = learn_manager.select_next_instances(1)
# if idx != None:
# pt2d = learn_manager.points2d[:, indices[0]]
# pt3d = learn_manager.points3d[:, indices[0]]
# label = behavior(pt3d)
# #learn_manager.add_example(pt3d, np.matrix([label]), pt2d)
# if not learn_manager.add_example(pi, np.matrix([label])):
# rospy.logerr('Unable to extract features from point %s' % str(pi.T))
# continue
# learn_manager.train()
# learn_manager.draw_and_send()
# else:
# converged = True
#def gather_interest_point_dataset(self, point):
# gaussian = pr.Gaussian(np.matrix([0, 0, 0.]).T, \
# np.matrix([[1., 0, 0], \
# [0, .02**2, 0], \
# [0, 0, .02**2]]))
# for i in range(100):
# # perturb_point
# gaussian_noise = gaussian.sample()
# gaussian_noise[0,0] = 0
# success_off, touchloc_bl = self.light_switch1(point,
# point_offset=np.matrix([-.15, 0, 0]).T, press_contact_pressure=300,
# move_back_distance=np.matrix([-.005,0,0]).T, press_pressure=2500,
# press_distance=np.matrix([0,0,-.15]).T, visual_change_thres=.03)
# rospy.loginfo('Lights turned off? %s' % str(success_off))
# pdb.set_trace()
# self.behaviors.movement.move_absolute((np.matrix([.15, .45, 1.3]).T, self.start_location[1]), stop='pressure_accel')
# self.record_perceptual_data(touchloc_bl)
# self.behaviors.movement.move_absolute(self.start_location, stop='pressure_accel')
# if success_off:
# self.behaviors.movement.move_absolute((np.matrix([.15, .45, 1.3]).T, self.start_location[1]), stop='pressure_accel')
# self.record_perceptual_data(touchloc_bl)
# self.behaviors.movement.move_absolute(self.start_location, stop='pressure_accel')
# success_on, touchloc_bl2 = self.light_switch1(point,
# point_offset=np.matrix([-.15,0,-.10]).T, press_contact_pressure=300,
# move_back_distance=np.matrix([-0.005, 0, 0]).T, press_pressure=2500,
# press_distance=np.matrix([0,0,.1]).T, visual_change_thres=.03)
# ##1
# #if success_on:
# # self.movement.behaviors.move_absolute((np.matrix([.15, .45, 1.3]).T, self.start_location[1]), stop='pressure_accel')
# # self.record_perceptual_data(touchloc_bl)
# # self.movement.behaviors.move_absolute(self.start_location, stop='pressure_accel')
# #Turn on lights
# #success_on, touchloc_bl = self.light_switch1(npoint,
# else:
# return
#def record_perceptual_data_laser_scanner(self, point_touched_bl):
# #what position should the robot be in?
# #set arms to non-occluding pose
# #record region around the finger where you touched
# rospy.loginfo('Getting laser scan.')
# points = []
# for i in range(3):
# rospy.loginfo('scan %d' % i)
# points.append(self.laser_scan.scan(math.radians(180.), math.radians(-180.), 20./3.))
# rospy.loginfo('Getting Prosilica image.')
# prosilica_image = self.prosilica.get_frame()
# rospy.loginfo('Getting image from left wide angle camera.')
# left_image = self.wide_angle_camera_left.get_frame()
# rospy.loginfo('Getting image from right wide angle camera.')
# right_image = self.wide_angle_camera_left.get_frame()
# rospy.loginfo('Waiting for calibration.')
# while self.prosilica_cal.has_msg == False:
# time.sleep(.1)
# #which frames?
# rospy.loginfo('Getting transforms.')
# pro_T_bl = tfu.transform('/self.OPTICAL_FRAMEhigh_def_optical_frame', '/base_link', self.tf_listener)
# laser_T_bl = tfu.transform('/laser_tilt_link', '/base_link', self.tf_listener)
# tstring = time.strftime('%A_%m_%d_%Y_%I:%M%p')
# prosilica_name = '%s_highres.png' % tstring
# left_name = '%s_left.png' % tstring
# right_name = '%s_right.png' % tstring
# rospy.loginfo('Saving images (basename %s)' % tstring)
# cv.SaveImage(prosilica_name, prosilica_image)
# cv.SaveImage(left_name, left_image)
# cv.SaveImage(right_name, right_image)
# rospy.loginfo('Saving pickles')
# pickle_fname = '%s_interest_point_dataset.pkl' % tstring
# data_pkl = {'touch_point': point_touched_bl,
# 'points_laser': points,
# 'laser_T_bl': laser_T_bl,
# 'pro_T_bl': pro_T_bl,
# 'high_res': prosilica_name,
# 'prosilica_cal': self.prosilica_cal,
# 'left_image': left_name,
# 'left_cal': self.left_cal,
# 'right_image': right_name,
# 'right_cal': self.right_cal}
# #'point_touched': point_touched_bl}
#
# ut.save_pickle(data_pkl, pickle_fname)
# print 'Recorded to', pickle_fname
#if mode == 'autonomous learn':
# def light_behavior(point):
# point_offset = np.matrix([0, 0, 0.03]).T
# success, _ = self.light_switch1(point, point_offset=point_offset, \
# press_contact_pressure=300, move_back_distance=np.matrix([-.0075,0,0]).T,\
# press_pressure=3500, press_distance=np.matrix([0,0,-.15]).T, \
# visual_change_thres=.03)
# if success:
# return 1.0
# else:
# return 0.0
# self.untuck()
# self.behaviors.movement.move_absolute(self.start_location, stop='pressure')
# self.behaviors.movement.pressure_listener.rezero()
# self.autonomous_learn(point_bl, light_behavior, 'light_switch')
#if mode == 'location activated':
# self.location_activated_behaviors(point_bl)
#elif mode == 'location activated':
# all_locs = self.locations_man.list_all()
# for i, pair in enumerate(all_locs):
# key, task = pair
# print i, task, key
# rospy.loginfo('Select location to execute action')
# selected = int(raw_input())
#if mode == 'practice':
# self.add_to_practice_points_map(point_bl)
##If that location is new:
#map_T_base_link = tfu.transform('map', 'base_link', self.tf_listener)
#point_map = tfu.transform_points(map_T_base_link, point_bl)
#close_by_locs = self.locations_man.list_close_by(point_map)
#if len(close_by_locs) <= 0:
# #initialize new location
# rospy.loginfo('Select task type:')
# for i, ttype in enumerate(self.locations_man.task_types):
# print i, ttype
# task_type = self.locations_man[int(raw_input())]
# task_id = self.locations_man.create_new_location(task_type, point_map)
# rospy.loginfo('if existing dataset exists enter that dataset\'s name')
# print 'friday_730_light_switch2.pkl'
# filename = raw_input()
# if len(filename) > 0:
# dataset = ut.load_pickle(filename)
# self.locations_man.data[task_id]['dataset'] = dataset
# self.locations_man.train(dataset, task_id)
# else:
# self.last_ditch_execution(
#elif len(close_by_locs) == 1:
# task_id, task = close_by_locs[0]
# rospy.loginfo('Executing task %s with id % s', task, task_id)
# self.execute_behavior(task_id, point_bl)
#elif len(close_by_locs) > 1:
# #TODO: implement this case
# rospy.logerr('ERROR: unimplemented')
# pdb.set_trace()
# self.execute_behavior(task_id, point_bl)
#else:
# rospy.logerr('ERROR: we shouldn\'t have reached here')
# pdb.set_trace()
| ajibawa-2023/Python-Code-Large/train/row_99513 | 26 | 1,619 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L2_C0", "label": "TaskError", "type": "class", "loc": [2, 7], "level": 0, "parent": null, "vector": [3, 0, 0.0028, 0.0037, 0, 0.66, 0.0, 591, 0, 2, 0, 0, 645, 0, 1], "semantic": {"name": "TaskError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TaskError(Exception):\n def __init__(self, value):\n self.parameter = value\n\n def __str__(self):\n return repr(self.parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L3_C4", "label": "__init__", "type": "function", "loc": [3, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L2_C0", "vector": [2, 1, 0.0022, 0.0012, 1, 0.11, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, value):\n self.parameter = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L4_C8", "label": "self.parameter =", "type": "assigned_variable", "loc": [4, 4], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L3_C4", "vector": [14, 2, 0.0025, 0.0006, 2, 0.19, 0.0, 718, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parameter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parameter = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L6_C4", "label": "__str__", "type": "function", "loc": [6, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L2_C0", "vector": [2, 1, 0.004, 0.0012, 1, 0.11, 1.0, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return repr(self.parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Return_L7_C8", "label": "return", "type": "return", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L6_C4", "vector": [13, 2, 0.0043, 0.0006, 2, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return repr(self.parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L9_C0", "label": "ActionType", "type": "class", "loc": [9, 12], "level": 0, "parent": null, "vector": [3, 0, 0.0065, 0.0025, 0, 0.66, 0.25, 330, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "ActionType", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ActionType:\n def __init__(self, inputs, outputs):\n self.inputs = inputs\n self.outputs = outputs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L10_C4", "label": "__init__", "type": "function", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L9_C0", "vector": [2, 1, 0.0068, 0.0019, 1, 0.35, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "inputs", "outputs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, inputs, outputs):\n self.inputs = inputs\n self.outputs = outputs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L11_C8", "label": "self.inputs =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L10_C4", "vector": [14, 2, 0.0068, 0.0006, 2, 0.44, 0.0, 646, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.inputs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.inputs = inputs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L12_C8", "label": "self.outputs =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L10_C4", "vector": [14, 2, 0.0074, 0.0006, 2, 0.44, 1.0, 88, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.outputs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.outputs = outputs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L14_C0", "label": "ParamType", "type": "class", "loc": [14, 18], "level": 0, "parent": null, "vector": [3, 0, 0.0099, 0.0031, 0, 0.66, 0.5, 920, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "ParamType", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ParamType:\n def __init__(self, name, ptype, options=None):\n self.name = name\n self.ptype = ptype\n self.options = options"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L15_C4", "label": "__init__", "type": "function", "loc": [15, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L14_C0", "vector": [2, 1, 0.0102, 0.0025, 1, 0.42, 0.0, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "ptype", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, ptype, options=None):\n self.name = name\n self.ptype = ptype\n self.options = options"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L16_C8", "label": "self.name =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L15_C4", "vector": [14, 2, 0.0099, 0.0006, 2, 0.73, 0.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L17_C8", "label": "self.ptype =", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L15_C4", "vector": [14, 2, 0.0105, 0.0006, 2, 0.73, 0.5, 872, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptype = ptype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L18_C8", "label": "self.options =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L15_C4", "vector": [14, 2, 0.0111, 0.0006, 2, 0.73, 1.0, 968, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.options = options"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L20_C0", "label": "Action", "type": "class", "loc": [20, 24], "level": 0, "parent": null, "vector": [3, 0, 0.0136, 0.0031, 0, 0.66, 0.75, 566, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "Action", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Action:\n\n def __init__(self, name, params):\n self.name = name\n self.params = params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L22_C4", "label": "__init__", "type": "function", "loc": [22, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L20_C0", "vector": [2, 1, 0.0142, 0.0019, 1, 0.48, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, params):\n self.name = name\n self.params = params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L23_C8", "label": "self.name =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L22_C4", "vector": [14, 2, 0.0142, 0.0006, 2, 0.19, 0.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L24_C8", "label": "self.params =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L22_C4", "vector": [14, 2, 0.0148, 0.0006, 2, 0.19, 1.0, 402, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params = params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L26_C0", "label": "BehaviorDescriptor", "type": "class", "loc": [26, 44], "level": 0, "parent": null, "vector": [3, 0, 0.0216, 0.0117, 0, 0.66, 1.0, 619, 0, 2, 0, 0, 0, 0, 15], "semantic": {"name": "BehaviorDescriptor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BehaviorDescriptor:\n\n def __init__(self):\n self.descriptors = {\n 'twist': ActionType([ParamType('angle', 'radian')], [ParamType('success', 'bool')]),\n 'linear_move': ActionType([ParamType('start_loc', 'se3'), \n ParamType('movement', 'r3'), \n ParamType('stop', 'discrete', ['pressure', 'pressure_accel'])], "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "label": "__init__", "type": "function", "loc": [28, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L26_C0", "vector": [2, 1, 0.0213, 0.0086, 1, 0.96, 0.0, 555, 0, 1, 0, 0, 0, 0, 15], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.descriptors = {\n 'twist': ActionType([ParamType('angle', 'radian')], [ParamType('success', 'bool')]),\n 'linear_move': ActionType([ParamType('start_loc', 'se3'), \n ParamType('movement', 'r3'), \n ParamType('stop', 'discrete', ['pressure', 'pressure_accel'])], \n [ParamType('success', 'bool')]),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L29_C8", "label": "self.descriptors =", "type": "assigned_variable", "loc": [29, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "vector": [14, 2, 0.0198, 0.0043, 2, 0.83, 0.0, 747, 0, 0, 0, 0, 0, 6, 8], "semantic": {"name": "self.descriptors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.descriptors = {\n 'twist': ActionType([ParamType('angle', 'radian')], [ParamType('success', 'bool')]),\n 'linear_move': ActionType([ParamType('start_loc', 'se3'), \n ParamType('movement', 'r3'), \n ParamType('stop', 'discrete', ['pressure', 'pressure_accel'])], \n [ParamType('success', 'bool')]),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L37_C8", "label": "start_location =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "vector": [14, 2, 0.0229, 0.0006, 2, 0.83, 0.25, 464, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "start_location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start_location = (np.matrix([0.3, 0.15, 0.9]).T, np.matrix([0., 0., 0., 0.1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L38_C8", "label": "movement =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "vector": [14, 2, 0.0235, 0.0006, 2, 0.83, 0.5, 668, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "movement", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " movement = np.matrix([.4, 0, 0.]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L39_C8", "label": "self.seed =", "type": "assigned_variable", "loc": [39, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "vector": [14, 2, 0.0244, 0.0012, 2, 0.83, 0.75, 495, 0, 0, 0, 0, 0, 5, 3], "semantic": {"name": "self.seed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.seed = [Action('linear_move', [start_location, movement, 'pressure']),\n Action('linear_move', [Action('current_location', [])])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:Expr_L41_C8", "label": "run()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "vector": [8, 2, 0.0253, 0.0006, 2, 0.83, 1.0, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " self.run(self.seed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L43_C4", "label": "run", "type": "function", "loc": [43, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L26_C0", "vector": [2, 1, 0.0269, 0.0012, 1, 0.96, 1.0, 679, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "run", "arg_names": ["self", "seed"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self, seed):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L3_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L4_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Return_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99513:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99513:FunctionDef_L43_C4"}] |
#! /usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import roslib; roslib.load_manifest('trf_learn')
import rospy
import trf_learn.recognize_3d as r3d
import trf_learn.locations_manager as lcm
import sys
import optparse
import pdb
import numpy as np
import ml_lib.dataset as ds
class LeaveOneOut:
def __init__(self, filename, dataset_name):
self.rec_params = r3d.Recognize3DParam()
self.locations_man = lcm.LocationsManager(filename, rec_params=self.rec_params, train=True)
self.dataset_name = dataset_name
pdb.set_trace()
print 'The following datasets are available:', self.locations_man.data.keys()
def leave_one_out(self):
#For each data set in locations man, for each data point, remove one data point, train, test on that point
dataset = self.locations_man.data[self.dataset_name]['dataset']
num_datapoints = dataset.inputs.shape[1]
#dataset.inputs = np.row_stack((np.matrix(range(num_datapoints)), dataset.inputs))
predicted_values = []
correct = 0
incorrect = 0
confusion = np.matrix([[0,0], [0,0.]])
num_pos = np.sum(dataset.outputs)
num_neg = num_datapoints-num_pos
#for i in range(2):
for i in range(num_datapoints):
loo_dataset, left_out_input, left_out_output = ds.leave_one_out(dataset, i)
self.locations_man.data[self.dataset_name]['dataset'] = loo_dataset
self.locations_man.train(self.dataset_name, save_pca_images=False)
learner = self.locations_man.learners[self.dataset_name]
predicted = learner.classify(left_out_input)
predicted_values += predicted
if predicted[0] == 0:
if left_out_output[0,0] == 0:
confusion[0,0] += 1
else:
confusion[0,1] += 1
else:
#predicted[0] == 1
if left_out_output[0,0] == 0:
confusion[1,0] += 1
else:
confusion[1,1] += 1
if predicted[0] == left_out_output[0,0]:
correct += 1
else:
incorrect += 1
print '============================================'
print 'dataset', self.dataset_name
print 'confusion matrix\n', confusion
confusion[:,0] = confusion[:,0] / num_neg
confusion[:,1] = confusion[:,1] / num_pos
print 'correct', correct, '\nincorrect', incorrect, '\npercentage', 100.* (correct/float(num_datapoints))
print predicted_values
print '============================================'
#predicted_values += predicted
#np.matrix(predicted_values)
#print 'result', predicted[0], predicted.__class__, left_out_output[0,0]
if __name__ == '__main__':
#p = optparse.OptionParser()
#p.add_option("-d", "--display", action="store", default='locations_narrow_v11.pkl')
if len(sys.argv) > 1:
name = sys.argv[1]
else:
name = 'locations_narrow_v11.pkl'
loo = LeaveOneOut(name, sys.argv[2])
loo.leave_one_out()
print 'end!'
| ajibawa-2023/Python-Code-Large/train/row_99514 | 51 | 113 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L30_C0", "label": "roslib import roslib", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.2655, 0.0088, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('trf_learn')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L30_C15", "label": "load_manifest()", "type": "expression", "loc": [30, 30], "level": 0, "parent": null, "vector": [8, 0, 0.2655, 0.0088, 0, 0.66, 0.0909, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('trf_learn')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L31_C0", "label": "rospy import rospy", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.2743, 0.0088, 0, 0.66, 0.1818, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L32_C0", "label": "trf_learn.recognize_3d import r3d", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.2832, 0.0088, 0, 0.66, 0.2727, 737, 0, 1, 0, 0, 737, 0, 0], "semantic": {"name": "trf_learn.recognize_3d", "arg_names": [], "import_names": ["r3d"], "rhs_call_name": "", "annotation": ""}, "snippet": "import trf_learn.recognize_3d as r3d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L33_C0", "label": "trf_learn.locations_manager import lcm", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.292, 0.0088, 0, 0.66, 0.3636, 769, 0, 1, 0, 0, 769, 0, 0], "semantic": {"name": "trf_learn.locations_manager", "arg_names": [], "import_names": ["lcm"], "rhs_call_name": "", "annotation": ""}, "snippet": "import trf_learn.locations_manager as lcm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L34_C0", "label": "sys import sys", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.3009, 0.0088, 0, 0.66, 0.4545, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L35_C0", "label": "optparse import optparse", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.3097, 0.0088, 0, 0.66, 0.5455, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L36_C0", "label": "pdb import pdb", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.3186, 0.0088, 0, 0.66, 0.6364, 91, 0, 1, 0, 0, 91, 0, 0], "semantic": {"name": "pdb", "arg_names": [], "import_names": ["pdb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pdb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L37_C0", "label": "numpy import np", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.3274, 0.0088, 0, 0.66, 0.7273, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Import_L38_C0", "label": "ml_lib.dataset import ds", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.3363, 0.0088, 0, 0.66, 0.8182, 809, 0, 1, 0, 0, 809, 0, 0], "semantic": {"name": "ml_lib.dataset", "arg_names": [], "import_names": ["ds"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ml_lib.dataset as ds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:ClassDef_L40_C0", "label": "LeaveOneOut", "type": "class", "loc": [40, 93], "level": 0, "parent": null, "vector": [3, 0, 0.5885, 0.4779, 0, 0.66, 0.9091, 948, 0, 2, 0, 0, 0, 0, 18], "semantic": {"name": "LeaveOneOut", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LeaveOneOut:\n\n def __init__(self, filename, dataset_name):\n self.rec_params = r3d.Recognize3DParam()\n self.locations_man = lcm.LocationsManager(filename, rec_params=self.rec_params, train=True)\n self.dataset_name = dataset_name\n pdb.set_trace()\n print('The following datasets are available:', self.locations_man.data.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "label": "__init__", "type": "function", "loc": [42, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:ClassDef_L40_C0", "vector": [2, 1, 0.3938, 0.0531, 1, 0.48, 0.0, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "filename", "dataset_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, filename, dataset_name):\n self.rec_params = r3d.Recognize3DParam()\n self.locations_man = lcm.LocationsManager(filename, rec_params=self.rec_params, train=True)\n self.dataset_name = dataset_name\n pdb.set_trace()\n print('The following datasets are available:', self.locations_man.data.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L43_C8", "label": "self.rec_params = Recognize3DParam()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "vector": [14, 2, 0.3805, 0.0088, 2, 0.39, 0.0, 245, 3, 0, 0, 0, 851, 10, 1], "semantic": {"name": "self.rec_params", "arg_names": [], "import_names": [], "rhs_call_name": "Recognize3DParam", "annotation": ""}, "snippet": " self.rec_params = r3d.Recognize3DParam()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L44_C8", "label": "self.locations_man = LocationsManager()", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "vector": [14, 2, 0.3894, 0.0088, 2, 0.39, 0.25, 50, 3, 3, 0, 0, 694, 10, 1], "semantic": {"name": "self.locations_man", "arg_names": [], "import_names": [], "rhs_call_name": "LocationsManager", "annotation": ""}, "snippet": " self.locations_man = lcm.LocationsManager(filename, rec_params=self.rec_params, train=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L45_C8", "label": "self.dataset_name =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "vector": [14, 2, 0.3982, 0.0088, 2, 0.39, 0.5, 908, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.dataset_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dataset_name = dataset_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L46_C8", "label": "set_trace()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "vector": [8, 2, 0.4071, 0.0088, 2, 0.39, 0.75, 796, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "set_trace", "arg_names": [], "import_names": [], "rhs_call_name": "set_trace", "annotation": ""}, "snippet": " pdb.set_trace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L47_C8", "label": "print()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "vector": [8, 2, 0.4159, 0.0088, 2, 0.39, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The following datasets are available:', self.locations_man.data.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "label": "leave_one_out", "type": "function", "loc": [49, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:ClassDef_L40_C0", "vector": [2, 1, 0.6283, 0.3982, 1, 0.48, 1.0, 294, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "leave_one_out", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def leave_one_out(self):\n #For each data set in locations man, for each data point, remove one data point, train, test on that point\n dataset = self.locations_man.data[self.dataset_name]['dataset']\n num_datapoints = dataset.inputs.shape[1]\n #dataset.inputs = np.row_stack((np.matrix(range(num_datapoints)), dataset.inputs))\n\n predicted_values = []\n correct = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L51_C8", "label": "dataset =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.4513, 0.0088, 2, 0.7, 0.0, 603, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dataset = self.locations_man.data[self.dataset_name]['dataset']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L52_C8", "label": "num_datapoints =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.4602, 0.0088, 2, 0.7, 0.0625, 594, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "num_datapoints", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num_datapoints = dataset.inputs.shape[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L55_C8", "label": "predicted_values =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.4867, 0.0088, 2, 0.7, 0.125, 51, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "predicted_values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " predicted_values = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L56_C8", "label": "correct =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.4956, 0.0088, 2, 0.7, 0.1875, 757, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "correct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " correct = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L57_C8", "label": "incorrect =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.5044, 0.0088, 2, 0.7, 0.25, 584, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "incorrect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " incorrect = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L58_C8", "label": "confusion = matrix()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.5133, 0.0088, 2, 0.7, 0.3125, 985, 3, 1, 0, 0, 162, 10, 1], "semantic": {"name": "confusion", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " confusion = np.matrix([[0,0], [0,0.]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L59_C8", "label": "num_pos = sum()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.5221, 0.0088, 2, 0.7, 0.375, 855, 3, 1, 0, 0, 824, 10, 1], "semantic": {"name": "num_pos", "arg_names": [], "import_names": [], "rhs_call_name": "sum", "annotation": ""}, "snippet": " num_pos = np.sum(dataset.outputs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L60_C8", "label": "num_neg =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.531, 0.0088, 2, 0.7, 0.4375, 627, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "num_neg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num_neg = num_datapoints-num_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "label": "for i", "type": "for", "loc": [62, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [6, 2, 0.646, 0.2035, 2, 0.7, 0.5, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(num_datapoints):\n loo_dataset, left_out_input, left_out_output = ds.leave_one_out(dataset, i)\n self.locations_man.data[self.dataset_name]['dataset'] = loo_dataset\n self.locations_man.train(self.dataset_name, save_pca_images=False)\n learner = self.locations_man.learners[self.dataset_name]\n predicted = learner.classify(left_out_input)\n predicted_values += predicted\n if predicted[0] == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L63_C12", "label": "loo_dataset, left_out_input, left_out_output = leave_one_out()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "vector": [14, 3, 0.5575, 0.0088, 3, 0.9, 0.0, 256, 3, 2, 0, 0, 294, 10, 1], "semantic": {"name": "loo_dataset, left_out_input, left_out_output", "arg_names": [], "import_names": [], "rhs_call_name": "leave_one_out", "annotation": ""}, "snippet": " loo_dataset, left_out_input, left_out_output = ds.leave_one_out(dataset, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L64_C12", "label": "assign", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "vector": [14, 3, 0.5664, 0.0088, 3, 0.9, 0.1667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.locations_man.data[self.dataset_name]['dataset'] = loo_dataset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L65_C12", "label": "train()", "type": "expression", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "vector": [8, 3, 0.5752, 0.0088, 3, 0.9, 0.3333, 371, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "train", "arg_names": [], "import_names": [], "rhs_call_name": "train", "annotation": ""}, "snippet": " self.locations_man.train(self.dataset_name, save_pca_images=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L66_C12", "label": "learner =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "vector": [14, 3, 0.5841, 0.0088, 3, 0.9, 0.5, 946, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "learner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " learner = self.locations_man.learners[self.dataset_name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L67_C12", "label": "predicted = classify()", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "vector": [14, 3, 0.5929, 0.0088, 3, 0.9, 0.6667, 946, 3, 1, 0, 0, 702, 10, 1], "semantic": {"name": "predicted", "arg_names": [], "import_names": [], "rhs_call_name": "classify", "annotation": ""}, "snippet": " predicted = learner.classify(left_out_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L69_C12", "label": "if", "type": "if", "loc": [69, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "vector": [4, 3, 0.6549, 0.0973, 3, 0.9, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if predicted[0] == 0:\n if left_out_output[0,0] == 0:\n confusion[0,0] += 1\n else:\n confusion[0,1] += 1\n else:\n #predicted[0] == 1\n if left_out_output[0,0] == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L70_C16", "label": "if", "type": "if", "loc": [70, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L69_C12", "vector": [4, 4, 0.6327, 0.0354, 4, 0.07, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if left_out_output[0,0] == 0:\n confusion[0,0] += 1\n else:\n confusion[0,1] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L76_C16", "label": "if", "type": "if", "loc": [76, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L69_C12", "vector": [4, 4, 0.6858, 0.0354, 4, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if left_out_output[0,0] == 0:\n confusion[1,0] += 1\n else:\n confusion[1,1] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L81_C12", "label": "if", "type": "if", "loc": [81, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "vector": [4, 3, 0.7301, 0.0354, 3, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if predicted[0] == left_out_output[0,0]:\n correct += 1\n else:\n incorrect += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L86_C8", "label": "print()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [8, 2, 0.7611, 0.0088, 2, 0.7, 0.5625, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('============================================')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L87_C8", "label": "print()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [8, 2, 0.7699, 0.0088, 2, 0.7, 0.625, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('dataset', self.dataset_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L88_C8", "label": "print()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [8, 2, 0.7788, 0.0088, 2, 0.7, 0.6875, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('confusion matrix\\n', confusion)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L89_C8", "label": "assign", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.7876, 0.0088, 2, 0.7, 0.75, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " confusion[:,0] = confusion[:,0] / num_neg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L90_C8", "label": "assign", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [14, 2, 0.7965, 0.0088, 2, 0.7, 0.8125, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " confusion[:,1] = confusion[:,1] / num_pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L91_C8", "label": "print()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [8, 2, 0.8053, 0.0088, 2, 0.7, 0.875, 535, 3, 6, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('correct', correct, '\\nincorrect', incorrect, '\\npercentage', 100.* (correct/float(num_datapoints)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L92_C8", "label": "print()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [8, 2, 0.8142, 0.0088, 2, 0.7, 0.9375, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(predicted_values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L93_C8", "label": "print()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "vector": [8, 2, 0.823, 0.0088, 2, 0.7, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('============================================')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "label": "if", "type": "if", "loc": [100, 111], "level": 0, "parent": null, "vector": [4, 0, 0.9336, 0.1062, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n #p = optparse.OptionParser()\n #p.add_option(\"-d\", \"--display\", action=\"store\", default='locations_narrow_v11.pkl')\n\n if len(sys.argv) > 1:\n name = sys.argv[1]\n else:\n name = 'locations_narrow_v11.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L104_C4", "label": "if", "type": "if", "loc": [104, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "vector": [4, 1, 0.9336, 0.0354, 1, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) > 1:\n name = sys.argv[1]\n else:\n name = 'locations_narrow_v11.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L105_C8", "label": "name =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L104_C4", "vector": [14, 2, 0.9292, 0.0088, 2, 0.64, 0.0, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L107_C8", "label": "name =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L104_C4", "vector": [14, 2, 0.9469, 0.0088, 2, 0.64, 1.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'locations_narrow_v11.pkl'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L109_C4", "label": "loo = LeaveOneOut()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "vector": [14, 1, 0.9646, 0.0088, 1, 0.77, 0.3333, 216, 3, 2, 0, 0, 948, 10, 1], "semantic": {"name": "loo", "arg_names": [], "import_names": [], "rhs_call_name": "LeaveOneOut", "annotation": ""}, "snippet": " loo = LeaveOneOut(name, sys.argv[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L110_C4", "label": "leave_one_out()", "type": "expression", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "vector": [8, 1, 0.9735, 0.0088, 1, 0.77, 0.6667, 294, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "leave_one_out", "arg_names": [], "import_names": [], "rhs_call_name": "leave_one_out", "annotation": ""}, "snippet": " loo.leave_one_out()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L111_C4", "label": "print()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "vector": [8, 1, 0.9823, 0.0088, 1, 0.77, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('end!')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99514:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L69_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L70_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L69_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L76_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:For_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99514:If_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99514:Expr_L111_C4"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import roslib; roslib.load_manifest('hai_sandbox')
import hrl_lib.util as ut
import pylab as pb
import numpy as np
import pdb
def conf_to_percent(rec):
conf = rec['mat']
conf[0,:] = conf[0,:] / rec['neg']
conf[1,:] = conf[1,:] / rec['pos']
return conf[0,0], conf[1,1]
def plot_classifier_performance(fname, pname, plot_all):
results = ut.load_pickle(fname)
#pdb.set_trace()
#results['train_set_statistics'] # [ {'conf', 'size'}, {}...]
#results['current_scan_statistics'] # [ {'conf'} {}...]
#results['perf_on_other_scans'] # [[{'name', 'conf'}, {}...] [{} {}...]...]
#where conf is {'mat', 'neg', 'pos'}
scores = {}
for rlist in results['perf_on_other_scans']:
for d in rlist:
if scores.has_key(d['name']):
scores[d['name']].append(conf_to_percent(d['conf']))
else:
scores[d['name']] = [conf_to_percent(d['conf'])]
for k in scores.keys():
scores[k] = zip(*scores[k])
if results.has_key('train_set_statistics'):
train_neg, train_pos = zip(*[conf_to_percent(d['conf']) for d in results['train_set_statistics']])
else:
train_neg = train_pos = None
if results.has_key('current_scan_statistics'):
pdb.set_trace()
test_neg, test_pos = zip(*[conf_to_percent(d['conf']) for d in results['current_scan_statistics']])
else:
test_neg = test_pos = None
n_iterations = np.array(range(len(results['train_set_statistics'])))
#======================================================================
pb.figure(1)
if results.has_key('train_set_statistics'):
pb.plot(n_iterations, train_neg, label='train ' + pname)
if test_neg != None:
pb.plot(n_iterations, test_neg, label='test ' + pname)
if plot_all:
for i, k in enumerate(scores.keys()):
pb.plot(n_iterations, scores[k][0], '--', label=str(i))
#if results.has_key('current_scan_statistics'):
if results.has_key('converged_at_iter'):
pb.plot([results['converged_at_iter'], results['converged_at_iter']], [0., 1.], 'r')
pb.title('True negatives')
pb.legend()
#======================================================================
pb.figure(2)
if train_pos != None:
pb.plot(n_iterations, train_pos, label='train ' + pname)
if test_pos != None:
pb.plot(n_iterations, test_pos, label='test ' + pname)
#if results.has_key('current_scan_statistics'):
print 'mapping from dataset to id'
if plot_all:
for i, k in enumerate(scores.keys()):
pb.plot(n_iterations, scores[k][1], '--', label=str(i))
print 'ID', i, 'dataset', k
if results.has_key('converged_at_iter'):
pb.plot([results['converged_at_iter'], results['converged_at_iter']], [0., 1.], 'r')
pb.title('True positives')
pb.legend()
def plot_features_perf(fnames, pnames):
all_scores = {}
dset_names = None
for fname, pname in zip(fnames, pnames):
results = ut.load_pickle(fname)
train_neg, train_pos = zip(*[conf_to_percent(d['conf']) for d in results['train_set_statistics']])
scores = {}
for rlist in results['perf_on_other_scans']:
for d in rlist:
if scores.has_key(d['name']):
scores[d['name']].append(conf_to_percent(d['conf']))
else:
scores[d['name']] = [conf_to_percent(d['conf'])]
for k in scores.keys():
scores[k] = zip(*scores[k])
scores['train'] = [(train_neg), (train_pos)]
all_scores[pname] = scores
if dset_names == None:
dset_names = scores.keys()
neg_by_dset = {}
for n in dset_names:
posn = []
for pname in pnames:
posn.append(all_scores[pname][n][0][0])
neg_by_dset[n] = posn
pos_by_dset = {}
for n in dset_names:
posn = []
for pname in pnames:
posn.append(all_scores[pname][n][1][0])
pos_by_dset[n] = posn
ind = np.arange(len(pnames))
width = 0.05
fig = pb.figure(1)
ax = fig.add_subplot(111)
rects=[]
for i, name in enumerate(dset_names):
rect = ax.bar(ind+(width*i), pos_by_dset[name], width, color=tuple(np.random.rand(3).tolist()))
rects.append(rect)
ax.set_ylabel('accuracy')
ax.set_title('True positives by dataset and features used')
ax.set_xticks(ind+width)
ax.set_xticklabels(tuple(pnames))
fig = pb.figure(2)
ax = fig.add_subplot(111)
rects=[]
for i, name in enumerate(dset_names):
rect = ax.bar(ind+(width*i), neg_by_dset[name], width, color=tuple(np.random.rand(3).tolist()))
rects.append(rect)
ax.set_ylabel('accuracy')
ax.set_title('True negatives by dataset and features used')
ax.set_xticks(ind+width)
ax.set_xticklabels(tuple(pnames))
if __name__ == '__main__':
import sys
import optparse
p = optparse.OptionParser()
p.add_option("-m", "--mode", action="store", type="string")
p.add_option("-f", "--file", action="append", type="string")
p.add_option('-n', '--name', action="append", type="string")
opt, args = p.parse_args()
if opt.mode == 'active':
if len(opt.file) <= 1:
plot_all = True
else:
plot_all = False
for i in range(len(opt.file)):
plot_classifier_performance(opt.file[i], opt.name[i], plot_all)
pb.show()
if opt.mode == 'features':
plot_features_perf(opt.file, opt.name)
pb.show()
#For comparing between different algorithms, don't need to plot performance on all scans just
| ajibawa-2023/Python-Code-Large/train/row_99515 | 125 | 201 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L28_C0", "label": "roslib import roslib", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.1393, 0.005, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hai_sandbox')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L28_C15", "label": "load_manifest()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.1393, 0.005, 0, 0.66, 0.1111, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('hai_sandbox')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L29_C0", "label": "hrl_lib.util import ut", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.1443, 0.005, 0, 0.66, 0.2222, 775, 0, 1, 0, 0, 775, 0, 0], "semantic": {"name": "hrl_lib.util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.util as ut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L30_C0", "label": "pylab import pb", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.1493, 0.005, 0, 0.66, 0.3333, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L31_C0", "label": "numpy import np", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.1542, 0.005, 0, 0.66, 0.4444, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L32_C0", "label": "pdb import pdb", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.1592, 0.005, 0, 0.66, 0.5556, 91, 0, 1, 0, 0, 91, 0, 0], "semantic": {"name": "pdb", "arg_names": [], "import_names": ["pdb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pdb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "label": "conf_to_percent", "type": "function", "loc": [34, 38], "level": 0, "parent": null, "vector": [2, 0, 0.1791, 0.0249, 0, 0.66, 0.6667, 689, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "conf_to_percent", "arg_names": ["rec"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def conf_to_percent(rec):\n conf = rec['mat']\n conf[0,:] = conf[0,:] / rec['neg']\n conf[1,:] = conf[1,:] / rec['pos']\n return conf[0,0], conf[1,1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L35_C4", "label": "conf =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "vector": [14, 1, 0.1741, 0.005, 1, 0.97, 0.0, 433, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "conf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " conf = rec['mat']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L36_C4", "label": "assign", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "vector": [14, 1, 0.1791, 0.005, 1, 0.97, 0.3333, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " conf[0,:] = conf[0,:] / rec['neg']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L37_C4", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "vector": [14, 1, 0.1841, 0.005, 1, 0.97, 0.6667, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " conf[1,:] = conf[1,:] / rec['pos']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Return_L38_C4", "label": "return", "type": "return", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "vector": [13, 1, 0.1891, 0.005, 1, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return conf[0,0], conf[1,1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "label": "plot_classifier_performance", "type": "function", "loc": [40, 105], "level": 0, "parent": null, "vector": [2, 0, 0.3607, 0.3284, 0, 0.66, 0.7778, 44, 0, 3, 0, 0, 0, 0, 42], "semantic": {"name": "plot_classifier_performance", "arg_names": ["fname", "pname", "plot_all"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_classifier_performance(fname, pname, plot_all):\n results = ut.load_pickle(fname)\n #pdb.set_trace()\n #results['train_set_statistics'] # [ {'conf', 'size'}, {}...]\n #results['current_scan_statistics'] # [ {'conf'} {}...]\n #results['perf_on_other_scans'] # [[{'name', 'conf'}, {}...] [{} {}...]...]\n #where conf is {'mat', 'neg', 'pos'}\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L41_C4", "label": "results = load_pickle()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [14, 1, 0.204, 0.005, 1, 0.6, 0.0, 143, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " results = ut.load_pickle(fname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L48_C4", "label": "scores =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [14, 1, 0.2388, 0.005, 1, 0.6, 0.0476, 50, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "scores", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scores = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L49_C4", "label": "for rlist", "type": "for", "loc": [49, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [6, 1, 0.2562, 0.0299, 1, 0.6, 0.0952, 501, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "rlist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for rlist in results['perf_on_other_scans']:\n for d in rlist:\n if scores.has_key(d['name']):\n scores[d['name']].append(conf_to_percent(d['conf']))\n else:\n scores[d['name']] = [conf_to_percent(d['conf'])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L50_C8", "label": "for d", "type": "for", "loc": [50, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L49_C4", "vector": [6, 2, 0.2587, 0.0249, 2, 0.63, 0.0, 355, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for d in rlist:\n if scores.has_key(d['name']):\n scores[d['name']].append(conf_to_percent(d['conf']))\n else:\n scores[d['name']] = [conf_to_percent(d['conf'])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L51_C12", "label": "if", "type": "if", "loc": [51, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L50_C8", "vector": [4, 3, 0.2612, 0.0199, 3, 0.44, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if scores.has_key(d['name']):\n scores[d['name']].append(conf_to_percent(d['conf']))\n else:\n scores[d['name']] = [conf_to_percent(d['conf'])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L52_C16", "label": "append()", "type": "expression", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L51_C12", "vector": [8, 4, 0.2587, 0.005, 4, 0.27, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " scores[d['name']].append(conf_to_percent(d['conf']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L54_C16", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L51_C12", "vector": [14, 4, 0.2687, 0.005, 4, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scores[d['name']] = [conf_to_percent(d['conf'])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L55_C4", "label": "for k", "type": "for", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [6, 1, 0.2761, 0.01, 1, 0.6, 0.1429, 954, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in scores.keys():\n scores[k] = zip(*scores[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L56_C8", "label": " = zip()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L55_C4", "vector": [14, 2, 0.2786, 0.005, 2, 0.54, 0.0, 0, 3, 1, 0, 0, 814, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " scores[k] = zip(*scores[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L58_C4", "label": "if", "type": "if", "loc": [58, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.296, 0.0199, 1, 0.6, 0.1905, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if results.has_key('train_set_statistics'):\n train_neg, train_pos = zip(*[conf_to_percent(d['conf']) for d in results['train_set_statistics']])\n else:\n train_neg = train_pos = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L59_C8", "label": "train_neg, train_pos = zip()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L58_C4", "vector": [14, 2, 0.2935, 0.005, 2, 0.43, 0.0, 709, 3, 1, 0, 0, 814, 10, 2], "semantic": {"name": "train_neg, train_pos", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " train_neg, train_pos = zip(*[conf_to_percent(d['conf']) for d in results['train_set_statistics']])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L61_C8", "label": "train_neg =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L58_C4", "vector": [14, 2, 0.3035, 0.005, 2, 0.43, 1.0, 342, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "train_neg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " train_neg = train_pos = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L63_C4", "label": "if", "type": "if", "loc": [63, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.3234, 0.0249, 1, 0.6, 0.2381, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if results.has_key('current_scan_statistics'):\n pdb.set_trace()\n test_neg, test_pos = zip(*[conf_to_percent(d['conf']) for d in results['current_scan_statistics']])\n else:\n test_neg = test_pos = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L64_C8", "label": "set_trace()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L63_C4", "vector": [8, 2, 0.3184, 0.005, 2, 0.54, 0.0, 796, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "set_trace", "arg_names": [], "import_names": [], "rhs_call_name": "set_trace", "annotation": ""}, "snippet": " pdb.set_trace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L65_C8", "label": "test_neg, test_pos = zip()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L63_C4", "vector": [14, 2, 0.3234, 0.005, 2, 0.54, 0.5, 592, 3, 1, 0, 0, 814, 10, 2], "semantic": {"name": "test_neg, test_pos", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " test_neg, test_pos = zip(*[conf_to_percent(d['conf']) for d in results['current_scan_statistics']])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L67_C8", "label": "test_neg =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L63_C4", "vector": [14, 2, 0.3333, 0.005, 2, 0.54, 1.0, 762, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "test_neg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " test_neg = test_pos = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L69_C4", "label": "n_iterations = array()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [14, 1, 0.3433, 0.005, 1, 0.6, 0.2857, 291, 3, 1, 0, 0, 80, 10, 3], "semantic": {"name": "n_iterations", "arg_names": [], "import_names": [], "rhs_call_name": "array", "annotation": ""}, "snippet": " n_iterations = np.array(range(len(results['train_set_statistics'])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L72_C4", "label": "figure()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [8, 1, 0.3582, 0.005, 1, 0.6, 0.3333, 789, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "figure", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " pb.figure(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L73_C4", "label": "if", "type": "if", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.3657, 0.01, 1, 0.6, 0.381, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if results.has_key('train_set_statistics'):\n pb.plot(n_iterations, train_neg, label='train ' + pname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L74_C8", "label": "plot()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L73_C4", "vector": [8, 2, 0.3682, 0.005, 2, 0.41, 0.0, 929, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot(n_iterations, train_neg, label='train ' + pname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L75_C4", "label": "if", "type": "if", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.3756, 0.01, 1, 0.6, 0.4286, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if test_neg != None:\n pb.plot(n_iterations, test_neg, label='test ' + pname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L76_C8", "label": "plot()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L75_C4", "vector": [8, 2, 0.3781, 0.005, 2, 0.51, 0.0, 929, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot(n_iterations, test_neg, label='test ' + pname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L77_C4", "label": "if", "type": "if", "loc": [77, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.3881, 0.0149, 1, 0.6, 0.4762, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if plot_all:\n for i, k in enumerate(scores.keys()):\n pb.plot(n_iterations, scores[k][0], '--', label=str(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L78_C8", "label": "for i, k", "type": "for", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L77_C4", "vector": [6, 2, 0.3905, 0.01, 2, 0.75, 0.0, 992, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i, k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, k in enumerate(scores.keys()):\n pb.plot(n_iterations, scores[k][0], '--', label=str(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L79_C12", "label": "plot()", "type": "expression", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L78_C8", "vector": [8, 3, 0.393, 0.005, 3, 0.41, 0.0, 929, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot(n_iterations, scores[k][0], '--', label=str(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L81_C4", "label": "if", "type": "if", "loc": [81, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.4055, 0.01, 1, 0.6, 0.5238, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if results.has_key('converged_at_iter'):\n pb.plot([results['converged_at_iter'], results['converged_at_iter']], [0., 1.], 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L82_C8", "label": "plot()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L81_C4", "vector": [8, 2, 0.408, 0.005, 2, 0.19, 0.0, 929, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot([results['converged_at_iter'], results['converged_at_iter']], [0., 1.], 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L84_C4", "label": "title()", "type": "expression", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [8, 1, 0.4179, 0.005, 1, 0.6, 0.5714, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " pb.title('True negatives')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L85_C4", "label": "legend()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [8, 1, 0.4229, 0.005, 1, 0.6, 0.619, 880, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pb.legend()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L88_C4", "label": "figure()", "type": "expression", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [8, 1, 0.4378, 0.005, 1, 0.6, 0.6667, 789, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "figure", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " pb.figure(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L89_C4", "label": "if", "type": "if", "loc": [89, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.4453, 0.01, 1, 0.6, 0.7143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if train_pos != None:\n pb.plot(n_iterations, train_pos, label='train ' + pname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L90_C8", "label": "plot()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L89_C4", "vector": [8, 2, 0.4478, 0.005, 2, 0.36, 0.0, 929, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot(n_iterations, train_pos, label='train ' + pname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L91_C4", "label": "if", "type": "if", "loc": [91, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.4552, 0.01, 1, 0.6, 0.7619, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if test_pos != None:\n pb.plot(n_iterations, test_pos, label='test ' + pname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L92_C8", "label": "plot()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L91_C4", "vector": [8, 2, 0.4577, 0.005, 2, 0.55, 0.0, 929, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot(n_iterations, test_pos, label='test ' + pname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L95_C4", "label": "print()", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [8, 1, 0.4726, 0.005, 1, 0.6, 0.8095, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('mapping from dataset to id')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L96_C4", "label": "if", "type": "if", "loc": [96, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.4851, 0.0199, 1, 0.6, 0.8571, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if plot_all:\n for i, k in enumerate(scores.keys()):\n pb.plot(n_iterations, scores[k][1], '--', label=str(i))\n print('ID', i, 'dataset', k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L97_C8", "label": "for i, k", "type": "for", "loc": [97, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L96_C4", "vector": [6, 2, 0.4876, 0.0149, 2, 0.08, 0.0, 992, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i, k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, k in enumerate(scores.keys()):\n pb.plot(n_iterations, scores[k][1], '--', label=str(i))\n print('ID', i, 'dataset', k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L98_C12", "label": "plot()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L97_C8", "vector": [8, 3, 0.4876, 0.005, 3, 0.22, 0.0, 929, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot(n_iterations, scores[k][1], '--', label=str(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L99_C12", "label": "print()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L97_C8", "vector": [8, 3, 0.4925, 0.005, 3, 0.22, 1.0, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('ID', i, 'dataset', k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L101_C4", "label": "if", "type": "if", "loc": [101, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [4, 1, 0.505, 0.01, 1, 0.6, 0.9048, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if results.has_key('converged_at_iter'):\n pb.plot([results['converged_at_iter'], results['converged_at_iter']], [0., 1.], 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L102_C8", "label": "plot()", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L101_C4", "vector": [8, 2, 0.5075, 0.005, 2, 0.29, 0.0, 929, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot([results['converged_at_iter'], results['converged_at_iter']], [0., 1.], 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L104_C4", "label": "title()", "type": "expression", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [8, 1, 0.5174, 0.005, 1, 0.6, 0.9524, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " pb.title('True positives')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L105_C4", "label": "legend()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "vector": [8, 1, 0.5224, 0.005, 1, 0.6, 1.0, 880, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " pb.legend()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "label": "plot_features_perf", "type": "function", "loc": [107, 167], "level": 0, "parent": null, "vector": [2, 0, 0.6816, 0.3035, 0, 0.66, 0.8889, 364, 0, 2, 0, 0, 0, 0, 41], "semantic": {"name": "plot_features_perf", "arg_names": ["fnames", "pnames"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_features_perf(fnames, pnames):\n\n all_scores = {}\n dset_names = None\n for fname, pname in zip(fnames, pnames):\n results = ut.load_pickle(fname)\n train_neg, train_pos = zip(*[conf_to_percent(d['conf']) for d in results['train_set_statistics']])\n scores = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L109_C4", "label": "all_scores =", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.5423, 0.005, 1, 0.09, 0.0, 771, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "all_scores", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " all_scores = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L110_C4", "label": "dset_names =", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.5473, 0.005, 1, 0.09, 0.0417, 851, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "dset_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dset_names = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "label": "for fname, pname", "type": "for", "loc": [111, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [6, 1, 0.5896, 0.0796, 1, 0.09, 0.0833, 383, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "fname, pname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fname, pname in zip(fnames, pnames):\n results = ut.load_pickle(fname)\n train_neg, train_pos = zip(*[conf_to_percent(d['conf']) for d in results['train_set_statistics']])\n scores = {}\n for rlist in results['perf_on_other_scans']:\n for d in rlist:\n if scores.has_key(d['name']):\n scores[d['name']].append(conf_to_percent(d['conf']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L112_C8", "label": "results = load_pickle()", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "vector": [14, 2, 0.5572, 0.005, 2, 0.95, 0.0, 143, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " results = ut.load_pickle(fname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L113_C8", "label": "train_neg, train_pos = zip()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "vector": [14, 2, 0.5622, 0.005, 2, 0.95, 0.1429, 709, 3, 1, 0, 0, 814, 10, 2], "semantic": {"name": "train_neg, train_pos", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " train_neg, train_pos = zip(*[conf_to_percent(d['conf']) for d in results['train_set_statistics']])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L114_C8", "label": "scores =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "vector": [14, 2, 0.5672, 0.005, 2, 0.95, 0.2857, 50, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "scores", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scores = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L115_C8", "label": "for rlist", "type": "for", "loc": [115, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "vector": [6, 2, 0.5846, 0.0299, 2, 0.95, 0.4286, 501, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "rlist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for rlist in results['perf_on_other_scans']:\n for d in rlist:\n if scores.has_key(d['name']):\n scores[d['name']].append(conf_to_percent(d['conf']))\n else:\n scores[d['name']] = [conf_to_percent(d['conf'])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L116_C12", "label": "for d", "type": "for", "loc": [116, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L115_C8", "vector": [6, 3, 0.5871, 0.0249, 3, 0.59, 0.0, 355, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for d in rlist:\n if scores.has_key(d['name']):\n scores[d['name']].append(conf_to_percent(d['conf']))\n else:\n scores[d['name']] = [conf_to_percent(d['conf'])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L117_C16", "label": "if", "type": "if", "loc": [117, 120], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L116_C12", "vector": [4, 4, 0.5896, 0.0199, 4, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if scores.has_key(d['name']):\n scores[d['name']].append(conf_to_percent(d['conf']))\n else:\n scores[d['name']] = [conf_to_percent(d['conf'])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L118_C20", "label": "append()", "type": "expression", "loc": [118, 118], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L117_C16", "vector": [8, 5, 0.5871, 0.005, 5, 0.59, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " scores[d['name']].append(conf_to_percent(d['conf']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L120_C20", "label": "assign", "type": "assigned_variable", "loc": [120, 120], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L117_C16", "vector": [14, 5, 0.597, 0.005, 5, 0.59, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scores[d['name']] = [conf_to_percent(d['conf'])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L121_C8", "label": "for k", "type": "for", "loc": [121, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "vector": [6, 2, 0.6045, 0.01, 2, 0.95, 0.5714, 954, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in scores.keys():\n scores[k] = zip(*scores[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L122_C12", "label": " = zip()", "type": "assigned_variable", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L121_C8", "vector": [14, 3, 0.607, 0.005, 3, 0.74, 0.0, 0, 3, 1, 0, 0, 814, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " scores[k] = zip(*scores[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L123_C8", "label": "assign", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "vector": [14, 2, 0.6119, 0.005, 2, 0.95, 0.7143, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scores['train'] = [(train_neg), (train_pos)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L124_C8", "label": "assign", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "vector": [14, 2, 0.6169, 0.005, 2, 0.95, 0.8571, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " all_scores[pname] = scores"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L125_C8", "label": "if", "type": "if", "loc": [125, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "vector": [4, 2, 0.6244, 0.01, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dset_names == None:\n dset_names = scores.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L126_C12", "label": "dset_names = keys()", "type": "assigned_variable", "loc": [126, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L125_C8", "vector": [14, 3, 0.6269, 0.005, 3, 0.96, 0.0, 851, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "dset_names", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " dset_names = scores.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L129_C4", "label": "neg_by_dset =", "type": "assigned_variable", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.6418, 0.005, 1, 0.09, 0.125, 409, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "neg_by_dset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " neg_by_dset = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L130_C4", "label": "for n", "type": "for", "loc": [130, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [6, 1, 0.6567, 0.0249, 1, 0.09, 0.1667, 773, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for n in dset_names:\n posn = []\n for pname in pnames:\n posn.append(all_scores[pname][n][0][0])\n neg_by_dset[n] = posn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L131_C8", "label": "posn =", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L130_C4", "vector": [14, 2, 0.6517, 0.005, 2, 0.25, 0.0, 52, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "posn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " posn = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L132_C8", "label": "for pname", "type": "for", "loc": [132, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L130_C4", "vector": [6, 2, 0.6592, 0.01, 2, 0.25, 0.5, 10, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for pname in pnames:\n posn.append(all_scores[pname][n][0][0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L133_C12", "label": "append()", "type": "expression", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L132_C8", "vector": [8, 3, 0.6617, 0.005, 3, 0.58, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " posn.append(all_scores[pname][n][0][0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L134_C8", "label": "assign", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L130_C4", "vector": [14, 2, 0.6667, 0.005, 2, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " neg_by_dset[n] = posn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L136_C4", "label": "pos_by_dset =", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.6766, 0.005, 1, 0.09, 0.2083, 974, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "pos_by_dset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos_by_dset = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L137_C4", "label": "for n", "type": "for", "loc": [137, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [6, 1, 0.6915, 0.0249, 1, 0.09, 0.25, 773, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for n in dset_names:\n posn = []\n for pname in pnames:\n posn.append(all_scores[pname][n][1][0])\n pos_by_dset[n] = posn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L138_C8", "label": "posn =", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L137_C4", "vector": [14, 2, 0.6866, 0.005, 2, 0.49, 0.0, 52, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "posn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " posn = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L139_C8", "label": "for pname", "type": "for", "loc": [139, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L137_C4", "vector": [6, 2, 0.694, 0.01, 2, 0.49, 0.5, 10, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for pname in pnames:\n posn.append(all_scores[pname][n][1][0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L140_C12", "label": "append()", "type": "expression", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L139_C8", "vector": [8, 3, 0.6965, 0.005, 3, 0.25, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " posn.append(all_scores[pname][n][1][0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L141_C8", "label": "assign", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L137_C4", "vector": [14, 2, 0.7015, 0.005, 2, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos_by_dset[n] = posn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L143_C4", "label": "ind = arange()", "type": "assigned_variable", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.7114, 0.005, 1, 0.09, 0.2917, 680, 3, 1, 0, 0, 489, 10, 2], "semantic": {"name": "ind", "arg_names": [], "import_names": [], "rhs_call_name": "arange", "annotation": ""}, "snippet": " ind = np.arange(len(pnames))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L144_C4", "label": "width =", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.7164, 0.005, 1, 0.09, 0.3333, 989, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width = 0.05"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L147_C4", "label": "fig = figure()", "type": "assigned_variable", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.7313, 0.005, 1, 0.09, 0.375, 806, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "fig", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " fig = pb.figure(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L148_C4", "label": "ax = add_subplot()", "type": "assigned_variable", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.7363, 0.005, 1, 0.09, 0.4167, 823, 3, 1, 0, 0, 449, 10, 1], "semantic": {"name": "ax", "arg_names": [], "import_names": [], "rhs_call_name": "add_subplot", "annotation": ""}, "snippet": " ax = fig.add_subplot(111)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L149_C4", "label": "rects =", "type": "assigned_variable", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.7413, 0.005, 1, 0.09, 0.4583, 799, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rects", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rects=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L150_C4", "label": "for i, name", "type": "for", "loc": [150, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [6, 1, 0.7512, 0.0149, 1, 0.09, 0.5, 14, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i, name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, name in enumerate(dset_names):\n rect = ax.bar(ind+(width*i), pos_by_dset[name], width, color=tuple(np.random.rand(3).tolist()))\n rects.append(rect)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L151_C8", "label": "rect = bar()", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L150_C4", "vector": [14, 2, 0.7512, 0.005, 2, 0.79, 0.0, 902, 3, 4, 0, 0, 300, 10, 4], "semantic": {"name": "rect", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": " rect = ax.bar(ind+(width*i), pos_by_dset[name], width, color=tuple(np.random.rand(3).tolist()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L152_C8", "label": "append()", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L150_C4", "vector": [8, 2, 0.7562, 0.005, 2, 0.79, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rects.append(rect)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L153_C4", "label": "set_ylabel()", "type": "expression", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [8, 1, 0.7612, 0.005, 1, 0.09, 0.5417, 408, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "set_ylabel", "annotation": ""}, "snippet": " ax.set_ylabel('accuracy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L154_C4", "label": "set_title()", "type": "expression", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [8, 1, 0.7662, 0.005, 1, 0.09, 0.5833, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_title", "arg_names": [], "import_names": [], "rhs_call_name": "set_title", "annotation": ""}, "snippet": " ax.set_title('True positives by dataset and features used')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L155_C4", "label": "set_xticks()", "type": "expression", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [8, 1, 0.7711, 0.005, 1, 0.09, 0.625, 701, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_xticks", "arg_names": [], "import_names": [], "rhs_call_name": "set_xticks", "annotation": ""}, "snippet": " ax.set_xticks(ind+width)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L156_C4", "label": "set_xticklabels()", "type": "expression", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [8, 1, 0.7761, 0.005, 1, 0.09, 0.6667, 391, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_xticklabels", "arg_names": [], "import_names": [], "rhs_call_name": "set_xticklabels", "annotation": ""}, "snippet": " ax.set_xticklabels(tuple(pnames))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L158_C4", "label": "fig = figure()", "type": "assigned_variable", "loc": [158, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.7861, 0.005, 1, 0.09, 0.7083, 806, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "fig", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " fig = pb.figure(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L159_C4", "label": "ax = add_subplot()", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.791, 0.005, 1, 0.09, 0.75, 823, 3, 1, 0, 0, 449, 10, 1], "semantic": {"name": "ax", "arg_names": [], "import_names": [], "rhs_call_name": "add_subplot", "annotation": ""}, "snippet": " ax = fig.add_subplot(111)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L160_C4", "label": "rects =", "type": "assigned_variable", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [14, 1, 0.796, 0.005, 1, 0.09, 0.7917, 799, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rects", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rects=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L161_C4", "label": "for i, name", "type": "for", "loc": [161, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [6, 1, 0.806, 0.0149, 1, 0.09, 0.8333, 14, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i, name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, name in enumerate(dset_names):\n rect = ax.bar(ind+(width*i), neg_by_dset[name], width, color=tuple(np.random.rand(3).tolist()))\n rects.append(rect)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L162_C8", "label": "rect = bar()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L161_C4", "vector": [14, 2, 0.806, 0.005, 2, 0.5, 0.0, 902, 3, 4, 0, 0, 300, 10, 4], "semantic": {"name": "rect", "arg_names": [], "import_names": [], "rhs_call_name": "bar", "annotation": ""}, "snippet": " rect = ax.bar(ind+(width*i), neg_by_dset[name], width, color=tuple(np.random.rand(3).tolist()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L163_C8", "label": "append()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L161_C4", "vector": [8, 2, 0.8109, 0.005, 2, 0.5, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rects.append(rect)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L164_C4", "label": "set_ylabel()", "type": "expression", "loc": [164, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [8, 1, 0.8159, 0.005, 1, 0.09, 0.875, 408, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "set_ylabel", "annotation": ""}, "snippet": " ax.set_ylabel('accuracy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L165_C4", "label": "set_title()", "type": "expression", "loc": [165, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [8, 1, 0.8209, 0.005, 1, 0.09, 0.9167, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_title", "arg_names": [], "import_names": [], "rhs_call_name": "set_title", "annotation": ""}, "snippet": " ax.set_title('True negatives by dataset and features used')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L166_C4", "label": "set_xticks()", "type": "expression", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [8, 1, 0.8259, 0.005, 1, 0.09, 0.9583, 701, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_xticks", "arg_names": [], "import_names": [], "rhs_call_name": "set_xticks", "annotation": ""}, "snippet": " ax.set_xticks(ind+width)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L167_C4", "label": "set_xticklabels()", "type": "expression", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "vector": [8, 1, 0.8308, 0.005, 1, 0.09, 1.0, 391, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_xticklabels", "arg_names": [], "import_names": [], "rhs_call_name": "set_xticklabels", "annotation": ""}, "snippet": " ax.set_xticklabels(tuple(pnames))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "label": "if", "type": "if", "loc": [169, 190], "level": 0, "parent": null, "vector": [4, 0, 0.893, 0.1095, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import sys\n import optparse\n p = optparse.OptionParser()\n p.add_option(\"-m\", \"--mode\", action=\"store\", type=\"string\")\n p.add_option(\"-f\", \"--file\", action=\"append\", type=\"string\")\n p.add_option('-n', '--name', action=\"append\", type=\"string\")\n opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L170_C4", "label": "sys import sys", "type": "import", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [1, 1, 0.8458, 0.005, 1, 0.55, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L171_C4", "label": "optparse import optparse", "type": "import", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [1, 1, 0.8507, 0.005, 1, 0.55, 0.125, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L172_C4", "label": "p = OptionParser()", "type": "assigned_variable", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [14, 1, 0.8557, 0.005, 1, 0.55, 0.25, 491, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " p = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L173_C4", "label": "add_option()", "type": "expression", "loc": [173, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [8, 1, 0.8607, 0.005, 1, 0.55, 0.375, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option(\"-m\", \"--mode\", action=\"store\", type=\"string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L174_C4", "label": "add_option()", "type": "expression", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [8, 1, 0.8657, 0.005, 1, 0.55, 0.5, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option(\"-f\", \"--file\", action=\"append\", type=\"string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L175_C4", "label": "add_option()", "type": "expression", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [8, 1, 0.8706, 0.005, 1, 0.55, 0.625, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " p.add_option('-n', '--name', action=\"append\", type=\"string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L176_C4", "label": "opt, args = parse_args()", "type": "assigned_variable", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [14, 1, 0.8756, 0.005, 1, 0.55, 0.75, 852, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opt, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " opt, args = p.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L178_C4", "label": "if", "type": "if", "loc": [178, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [4, 1, 0.9055, 0.0448, 1, 0.55, 0.875, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.mode == 'active':\n if len(opt.file) <= 1:\n plot_all = True\n else:\n plot_all = False\n\n for i in range(len(opt.file)):\n plot_classifier_performance(opt.file[i], opt.name[i], plot_all)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L179_C8", "label": "if", "type": "if", "loc": [179, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L178_C4", "vector": [4, 2, 0.898, 0.0199, 2, 0.44, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(opt.file) <= 1:\n plot_all = True\n else:\n plot_all = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L180_C12", "label": "plot_all =", "type": "assigned_variable", "loc": [180, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L179_C8", "vector": [14, 3, 0.8955, 0.005, 3, 0.23, 0.0, 334, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "plot_all", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " plot_all = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L182_C12", "label": "plot_all =", "type": "assigned_variable", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L179_C8", "vector": [14, 3, 0.9055, 0.005, 3, 0.23, 1.0, 334, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "plot_all", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " plot_all = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L184_C8", "label": "for i", "type": "for", "loc": [184, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L178_C4", "vector": [6, 2, 0.9179, 0.01, 2, 0.44, 0.5, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(len(opt.file)):\n plot_classifier_performance(opt.file[i], opt.name[i], plot_all)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L185_C12", "label": "plot_classifier_performance()", "type": "expression", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L184_C8", "vector": [8, 3, 0.9204, 0.005, 3, 0.17, 0.0, 44, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot_classifier_performance", "arg_names": [], "import_names": [], "rhs_call_name": "plot_classifier_performance", "annotation": ""}, "snippet": " plot_classifier_performance(opt.file[i], opt.name[i], plot_all)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L186_C8", "label": "show()", "type": "expression", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L178_C4", "vector": [8, 2, 0.9254, 0.005, 2, 0.44, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " pb.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L188_C4", "label": "if", "type": "if", "loc": [188, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "vector": [4, 1, 0.9403, 0.0149, 1, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt.mode == 'features':\n plot_features_perf(opt.file, opt.name)\n pb.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L189_C8", "label": "plot_features_perf()", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L188_C4", "vector": [8, 2, 0.9403, 0.005, 2, 0.25, 0.0, 364, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "plot_features_perf", "arg_names": [], "import_names": [], "rhs_call_name": "plot_features_perf", "annotation": ""}, "snippet": " plot_features_perf(opt.file, opt.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L190_C8", "label": "show()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L188_C4", "vector": [8, 2, 0.9453, 0.005, 2, 0.25, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " pb.show()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Return_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L54_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L116_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L117_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L117_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L118_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L117_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L120_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L125_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Import_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L179_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L180_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L179_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Assign_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:For_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L169_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99515:If_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99515:Expr_L190_C8"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
| ajibawa-2023/Python-Code-Large/train/row_99519 | 0 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
#!/usr/bin/python
import roslib; roslib.load_manifest('trf_learn')
import trf_learn.recognize_3d as r3d
import hrl_lib.util as ut
import pylab as pb
from PIL import Image
import os.path as pt
import pdb
import numpy as np
import os
def minmax(mat):
return (np.min(mat[0,:]), np.max(mat[0,:]),
np.min(mat[1,:]), np.max(mat[1,:]))
def num_bins(points, bin_size):
minx, maxx, miny, maxy = minmax(points)
rangex = maxx-minx
xbins = np.ceil(rangex/bin_size)
rangey = maxy-miny
ybins = np.ceil(rangey/bin_size)
print 'XBINS', xbins, 'YBINS', ybins
return xbins, ybins
##
# ['neg_pred', 'image', 'pos_pred', 'tried', 'center']
def density_plot(pickle_file_name):
print 'density_plot: processing', pickle_file_name
BIN_SIZE = 20
#PICKLE_FOLDER = 'pickle_files'
data_dict = ut.load_pickle(pickle_file_name)
orig_pickle_folder, _ = pt.split(pickle_file_name)
folder_name, img_name = pt.split(data_dict['image'])
nimg_path = pt.join(orig_pickle_folder, img_name)
img_obj = Image.open(nimg_path)
w, h = img_obj.size
pb.imshow(img_obj, origin='lower')
data_dict['neg_pred'][1,:] = h - data_dict['neg_pred'][1,:]
data_dict['pos_pred'][1,:] = h - data_dict['pos_pred'][1,:]
all_pts = np.column_stack((data_dict['neg_pred'], data_dict['pos_pred']))
Hall, xedges, yedges = np.histogram2d(all_pts[0,:].A1, all_pts[1,:].A1,
bins=num_bins(all_pts, BIN_SIZE))
Hneg, xedges, yedges = np.histogram2d(data_dict['neg_pred'][0,:].A1, data_dict['neg_pred'][1,:].A1,
bins=[xedges, yedges])
extent = [xedges[0], xedges[-1], yedges[-1], yedges[0]]
Himage = (Hall-Hneg).T
max_val, min_val = np.max(Himage), np.min(Himage)
Hrgba = np.zeros((Himage.shape[0], Himage.shape[1], 4), dtype='uint8')
Hrgba[:,:,0] = 0
Hrgba[:,:,1] = 255 #Himage*80
Hrgba[:,:,2] = 0
Hrgba[:,:,3] = 255
r,c = np.where(Himage == 0)
Hrgba[r,c,3] = 0
print 'max', max_val, 'min', min_val
pb.imshow(Hrgba, extent=extent, interpolation='spline36', origin='upper', alpha = .7)
if data_dict['tried'][1] == r3d.NEGATIVE:
pb.plot(data_dict['tried'][0][0,0], h-data_dict['tried'][0][1,0], 'bx')
else:
pb.plot(data_dict['tried'][0][0,0], h-data_dict['tried'][0][1,0], 'bx')
#pdb.set_trace()
#pb.plot(data_dict['neg_pred'][0,:].A1, data_dict['neg_pred'][1,:].A1, 'rx')
#pb.plot(data_dict['pos_pred'][0,:].A1, data_dict['pos_pred'][1,:].A1, 'x')
min_x, max_x, min_y, max_y = minmax(all_pts)
pb.axis([max(min_x-100,0), min(max_x+100,w), max(min_y-100, 0), min(max_y+100, h)])
#pb.axis([0, w, 0, h])
#name, extension = pt.splitext(img_name)
name = pt.splitext(pt.split(pickle_file_name)[1])[0]
if data_dict['tried'][1] == r3d.NEGATIVE:
figname = pt.join(orig_pickle_folder, name + '_plot_FAIL.png')
else:
figname = pt.join(orig_pickle_folder, name + '_plot_SUCC.png')
pb.savefig(figname)
#pb.show()
if __name__ == '__main__':
import sys
import optparse
if len(sys.argv) > 1:
for i in range(1, len(sys.argv)):
density_plot(sys.argv[i])
| ajibawa-2023/Python-Code-Large/train/row_99520 | 63 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L2_C0", "label": "roslib import roslib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0211, 0.0105, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('trf_learn')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L2_C15", "label": "load_manifest()", "type": "expression", "loc": [2, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0105, 0, 0.66, 0.0769, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('trf_learn')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L3_C0", "label": "trf_learn.recognize_3d import r3d", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0316, 0.0105, 0, 0.66, 0.1538, 737, 0, 1, 0, 0, 737, 0, 0], "semantic": {"name": "trf_learn.recognize_3d", "arg_names": [], "import_names": ["r3d"], "rhs_call_name": "", "annotation": ""}, "snippet": "import trf_learn.recognize_3d as r3d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L4_C0", "label": "hrl_lib.util import ut", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0421, 0.0105, 0, 0.66, 0.2308, 775, 0, 1, 0, 0, 775, 0, 0], "semantic": {"name": "hrl_lib.util", "arg_names": [], "import_names": ["ut"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.util as ut"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L5_C0", "label": "pylab import pb", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0105, 0, 0.66, 0.3077, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "pylab", "arg_names": [], "import_names": ["pb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pylab as pb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:ImportFrom_L6_C0", "label": "from PIL import Image", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0632, 0.0105, 0, 0.66, 0.3846, 556, 0, 1, 0, 0, 556, 0, 0], "semantic": {"name": "PIL", "arg_names": [], "import_names": ["Image"], "rhs_call_name": "", "annotation": ""}, "snippet": "from PIL import Image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L7_C0", "label": "os.path import pt", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0737, 0.0105, 0, 0.66, 0.4615, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["pt"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os.path as pt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L8_C0", "label": "pdb import pdb", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0842, 0.0105, 0, 0.66, 0.5385, 91, 0, 1, 0, 0, 91, 0, 0], "semantic": {"name": "pdb", "arg_names": [], "import_names": ["pdb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pdb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L9_C0", "label": "numpy import np", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0947, 0.0105, 0, 0.66, 0.6154, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L10_C0", "label": "os import os", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0105, 0, 0.66, 0.6923, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L12_C0", "label": "minmax", "type": "function", "loc": [12, 14], "level": 0, "parent": null, "vector": [2, 0, 0.1368, 0.0316, 0, 0.66, 0.7692, 644, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "minmax", "arg_names": ["mat"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def minmax(mat):\n return (np.min(mat[0,:]), np.max(mat[0,:]), \n np.min(mat[1,:]), np.max(mat[1,:]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Return_L13_C4", "label": "return", "type": "return", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L12_C0", "vector": [13, 1, 0.1421, 0.0211, 1, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 8, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (np.min(mat[0,:]), np.max(mat[0,:]), \n np.min(mat[1,:]), np.max(mat[1,:]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "label": "num_bins", "type": "function", "loc": [16, 26], "level": 0, "parent": null, "vector": [2, 0, 0.2211, 0.1158, 0, 0.66, 0.8462, 458, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "num_bins", "arg_names": ["points", "bin_size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def num_bins(points, bin_size):\n minx, maxx, miny, maxy = minmax(points)\n\n rangex = maxx-minx\n xbins = np.ceil(rangex/bin_size)\n\n rangey = maxy-miny\n ybins = np.ceil(rangey/bin_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L17_C4", "label": "minx, maxx, miny, maxy = minmax()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "vector": [14, 1, 0.1789, 0.0105, 1, 0.57, 0.0, 776, 3, 1, 0, 0, 644, 10, 1], "semantic": {"name": "minx, maxx, miny, maxy", "arg_names": [], "import_names": [], "rhs_call_name": "minmax", "annotation": ""}, "snippet": " minx, maxx, miny, maxy = minmax(points)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L19_C4", "label": "rangex =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "vector": [14, 1, 0.2, 0.0105, 1, 0.57, 0.1667, 923, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rangex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rangex = maxx-minx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L20_C4", "label": "xbins = ceil()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "vector": [14, 1, 0.2105, 0.0105, 1, 0.57, 0.3333, 227, 3, 1, 0, 0, 211, 10, 1], "semantic": {"name": "xbins", "arg_names": [], "import_names": [], "rhs_call_name": "ceil", "annotation": ""}, "snippet": " xbins = np.ceil(rangex/bin_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L22_C4", "label": "rangey =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "vector": [14, 1, 0.2316, 0.0105, 1, 0.57, 0.5, 787, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rangey", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rangey = maxy-miny"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L23_C4", "label": "ybins = ceil()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "vector": [14, 1, 0.2421, 0.0105, 1, 0.57, 0.6667, 532, 3, 1, 0, 0, 211, 10, 1], "semantic": {"name": "ybins", "arg_names": [], "import_names": [], "rhs_call_name": "ceil", "annotation": ""}, "snippet": " ybins = np.ceil(rangey/bin_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L25_C4", "label": "print()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "vector": [8, 1, 0.2632, 0.0105, 1, 0.57, 0.8333, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('XBINS', xbins, 'YBINS', ybins)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Return_L26_C4", "label": "return", "type": "return", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "vector": [13, 1, 0.2737, 0.0105, 1, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return xbins, ybins"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "label": "density_plot", "type": "function", "loc": [30, 84], "level": 0, "parent": null, "vector": [2, 0, 0.6, 0.5789, 0, 0.66, 0.9231, 349, 0, 1, 0, 0, 0, 0, 30], "semantic": {"name": "density_plot", "arg_names": ["pickle_file_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def density_plot(pickle_file_name):\n print('density_plot: processing', pickle_file_name)\n BIN_SIZE = 20\n #PICKLE_FOLDER = 'pickle_files'\n\n data_dict = ut.load_pickle(pickle_file_name)\n orig_pickle_folder, _ = pt.split(pickle_file_name)\n folder_name, img_name = pt.split(data_dict['image'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L31_C4", "label": "print()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [8, 1, 0.3263, 0.0105, 1, 0.06, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('density_plot: processing', pickle_file_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L32_C4", "label": "BIN_SIZE =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.3368, 0.0105, 1, 0.06, 0.0323, 757, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "BIN_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BIN_SIZE = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L35_C4", "label": "data_dict = load_pickle()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.3684, 0.0105, 1, 0.06, 0.0645, 23, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "data_dict", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": " data_dict = ut.load_pickle(pickle_file_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L36_C4", "label": "orig_pickle_folder, _ = split()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.3789, 0.0105, 1, 0.06, 0.0968, 714, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "orig_pickle_folder, _", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " orig_pickle_folder, _ = pt.split(pickle_file_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L37_C4", "label": "folder_name, img_name = split()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.3895, 0.0105, 1, 0.06, 0.129, 481, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "folder_name, img_name", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " folder_name, img_name = pt.split(data_dict['image'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L38_C4", "label": "nimg_path = join()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.4, 0.0105, 1, 0.06, 0.1613, 564, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "nimg_path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " nimg_path = pt.join(orig_pickle_folder, img_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L39_C4", "label": "img_obj = open()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.4105, 0.0105, 1, 0.06, 0.1935, 782, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "img_obj", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " img_obj = Image.open(nimg_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L40_C4", "label": "w, h =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.4211, 0.0105, 1, 0.06, 0.2258, 806, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w, h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w, h = img_obj.size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L41_C4", "label": "imshow()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [8, 1, 0.4316, 0.0105, 1, 0.06, 0.2581, 851, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "imshow", "arg_names": [], "import_names": [], "rhs_call_name": "imshow", "annotation": ""}, "snippet": " pb.imshow(img_obj, origin='lower')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L43_C4", "label": "assign", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.4526, 0.0105, 1, 0.06, 0.2903, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data_dict['neg_pred'][1,:] = h - data_dict['neg_pred'][1,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L44_C4", "label": "assign", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.4632, 0.0105, 1, 0.06, 0.3226, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data_dict['pos_pred'][1,:] = h - data_dict['pos_pred'][1,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L46_C4", "label": "all_pts = column_stack()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.4842, 0.0105, 1, 0.06, 0.3548, 45, 3, 1, 0, 0, 724, 10, 1], "semantic": {"name": "all_pts", "arg_names": [], "import_names": [], "rhs_call_name": "column_stack", "annotation": ""}, "snippet": " all_pts = np.column_stack((data_dict['neg_pred'], data_dict['pos_pred']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L47_C4", "label": "Hall, xedges, yedges = histogram2d()", "type": "assigned_variable", "loc": [47, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.5, 0.0211, 1, 0.06, 0.3871, 690, 3, 3, 0, 0, 666, 10, 2], "semantic": {"name": "Hall, xedges, yedges", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2d", "annotation": ""}, "snippet": " Hall, xedges, yedges = np.histogram2d(all_pts[0,:].A1, all_pts[1,:].A1, \n bins=num_bins(all_pts, BIN_SIZE))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L49_C4", "label": "Hneg, xedges, yedges = histogram2d()", "type": "assigned_variable", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.5211, 0.0211, 1, 0.06, 0.4194, 308, 3, 3, 0, 0, 666, 10, 1], "semantic": {"name": "Hneg, xedges, yedges", "arg_names": [], "import_names": [], "rhs_call_name": "histogram2d", "annotation": ""}, "snippet": " Hneg, xedges, yedges = np.histogram2d(data_dict['neg_pred'][0,:].A1, data_dict['neg_pred'][1,:].A1, \n bins=[xedges, yedges])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L52_C4", "label": "extent =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.5474, 0.0105, 1, 0.06, 0.4516, 962, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extent = [xedges[0], xedges[-1], yedges[-1], yedges[0]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L53_C4", "label": "Himage =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.5579, 0.0105, 1, 0.06, 0.4839, 705, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Himage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Himage = (Hall-Hneg).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L54_C4", "label": "max_val, min_val =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.5684, 0.0105, 1, 0.06, 0.5161, 683, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "max_val, min_val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_val, min_val = np.max(Himage), np.min(Himage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L55_C4", "label": "Hrgba = zeros()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.5789, 0.0105, 1, 0.06, 0.5484, 227, 3, 2, 0, 0, 213, 10, 1], "semantic": {"name": "Hrgba", "arg_names": [], "import_names": [], "rhs_call_name": "zeros", "annotation": ""}, "snippet": " Hrgba = np.zeros((Himage.shape[0], Himage.shape[1], 4), dtype='uint8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L56_C4", "label": "assign", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.5895, 0.0105, 1, 0.06, 0.5806, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Hrgba[:,:,0] = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L57_C4", "label": "assign", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.6, 0.0105, 1, 0.06, 0.6129, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Hrgba[:,:,1] = 255 #Himage*80"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L58_C4", "label": "assign", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.6105, 0.0105, 1, 0.06, 0.6452, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Hrgba[:,:,2] = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L59_C4", "label": "assign", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.6211, 0.0105, 1, 0.06, 0.6774, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Hrgba[:,:,3] = 255"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L60_C4", "label": "r, c = where()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.6316, 0.0105, 1, 0.06, 0.7097, 385, 3, 1, 0, 0, 169, 10, 1], "semantic": {"name": "r, c", "arg_names": [], "import_names": [], "rhs_call_name": "where", "annotation": ""}, "snippet": " r,c = np.where(Himage == 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L61_C4", "label": "assign", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.6421, 0.0105, 1, 0.06, 0.7419, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Hrgba[r,c,3] = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L63_C4", "label": "print()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [8, 1, 0.6632, 0.0105, 1, 0.06, 0.7742, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('max', max_val, 'min', min_val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L64_C4", "label": "imshow()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [8, 1, 0.6737, 0.0105, 1, 0.06, 0.8065, 851, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "imshow", "arg_names": [], "import_names": [], "rhs_call_name": "imshow", "annotation": ""}, "snippet": " pb.imshow(Hrgba, extent=extent, interpolation='spline36', origin='upper', alpha = .7)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L65_C4", "label": "if", "type": "if", "loc": [65, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [4, 1, 0.7, 0.0421, 1, 0.06, 0.8387, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data_dict['tried'][1] == r3d.NEGATIVE:\n pb.plot(data_dict['tried'][0][0,0], h-data_dict['tried'][0][1,0], 'bx')\n else:\n pb.plot(data_dict['tried'][0][0,0], h-data_dict['tried'][0][1,0], 'bx')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L66_C8", "label": "plot()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L65_C4", "vector": [8, 2, 0.6947, 0.0105, 2, 0.37, 0.0, 929, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot(data_dict['tried'][0][0,0], h-data_dict['tried'][0][1,0], 'bx')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L68_C8", "label": "plot()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L65_C4", "vector": [8, 2, 0.7158, 0.0105, 2, 0.37, 1.0, 929, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " pb.plot(data_dict['tried'][0][0,0], h-data_dict['tried'][0][1,0], 'bx')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L73_C4", "label": "min_x, max_x, min_y, max_y = minmax()", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.7684, 0.0105, 1, 0.06, 0.871, 529, 3, 1, 0, 0, 644, 10, 1], "semantic": {"name": "min_x, max_x, min_y, max_y", "arg_names": [], "import_names": [], "rhs_call_name": "minmax", "annotation": ""}, "snippet": " min_x, max_x, min_y, max_y = minmax(all_pts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L74_C4", "label": "axis()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [8, 1, 0.7789, 0.0105, 1, 0.06, 0.9032, 860, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "axis", "arg_names": [], "import_names": [], "rhs_call_name": "axis", "annotation": ""}, "snippet": " pb.axis([max(min_x-100,0), min(max_x+100,w), max(min_y-100, 0), min(max_y+100, h)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L77_C4", "label": "name =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [14, 1, 0.8105, 0.0105, 1, 0.06, 0.9355, 57, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = pt.splitext(pt.split(pickle_file_name)[1])[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L79_C4", "label": "if", "type": "if", "loc": [79, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [4, 1, 0.8474, 0.0421, 1, 0.06, 0.9677, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data_dict['tried'][1] == r3d.NEGATIVE:\n figname = pt.join(orig_pickle_folder, name + '_plot_FAIL.png')\n else:\n figname = pt.join(orig_pickle_folder, name + '_plot_SUCC.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L80_C8", "label": "figname = join()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L79_C4", "vector": [14, 2, 0.8421, 0.0105, 2, 0.14, 0.0, 76, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "figname", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " figname = pt.join(orig_pickle_folder, name + '_plot_FAIL.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L82_C8", "label": "figname = join()", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L79_C4", "vector": [14, 2, 0.8632, 0.0105, 2, 0.14, 1.0, 76, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "figname", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " figname = pt.join(orig_pickle_folder, name + '_plot_SUCC.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L84_C4", "label": "savefig()", "type": "expression", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "vector": [8, 1, 0.8842, 0.0105, 1, 0.06, 1.0, 677, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " pb.savefig(figname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L88_C0", "label": "if", "type": "if", "loc": [88, 93], "level": 0, "parent": null, "vector": [4, 0, 0.9526, 0.0632, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import sys\n import optparse\n if len(sys.argv) > 1:\n for i in range(1, len(sys.argv)):\n density_plot(sys.argv[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L89_C4", "label": "sys import sys", "type": "import", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L88_C0", "vector": [1, 1, 0.9368, 0.0105, 1, 0.05, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L90_C4", "label": "optparse import optparse", "type": "import", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L88_C0", "vector": [1, 1, 0.9474, 0.0105, 1, 0.05, 0.5, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": " import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L91_C4", "label": "if", "type": "if", "loc": [91, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L88_C0", "vector": [4, 1, 0.9684, 0.0316, 1, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) > 1:\n for i in range(1, len(sys.argv)):\n density_plot(sys.argv[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:For_L92_C8", "label": "for i", "type": "for", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L91_C4", "vector": [6, 2, 0.9737, 0.0211, 2, 0.07, 0.0, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(1, len(sys.argv)):\n density_plot(sys.argv[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L93_C12", "label": "density_plot()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99520:For_L92_C8", "vector": [8, 3, 0.9789, 0.0105, 3, 0.06, 0.0, 349, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "density_plot", "arg_names": [], "import_names": [], "rhs_call_name": "density_plot", "annotation": ""}, "snippet": " density_plot(sys.argv[i])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Return_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Import_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:If_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:For_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99520:For_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99520:Expr_L93_C12"}] |
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import roslib; roslib.load_manifest('trf_learn')
import rospy
import cv
import numpy as np
import feature_extractor_fpfh.srv as fsrv
import hrl_opencv.image3d as i3d
import hrl_lib.rutils as ru
import hrl_lib.prob as pr
import hrl_lib.tf_utils as tfu
##
# Generalized from Probabilistic robotics for N != weights.shape[0]
def sample_points(weights, N):
assert(weights.shape[0] >= N)
M = weights.shape[0]
weights = weights / np.sum(weights)
r = np.random.rand() * (1.0/M)
c = weights[0,0]
i = 0
Xt = []
indices = np.sort(np.random.permutation(np.arange(1, M+1))[0:N]).tolist()
for m in indices:
U = r + (m - 1) * (1.0/M)
while U > c:
i = i + 1
c = c + weights[i,0]
Xt.append(i)
return Xt
def test_sample_points():
w = np.matrix([.1,.4,.5]).T
count = [0., 0., 0.]
for i in range(6000.):
idx = sample_points(w, 2)
for x in idx:
count[x] += 1
print np.matrix(count) / np.sum(count)
def intensity_pyramid_feature(point2d_image, np_image_arr, win_size, multipliers, flatten=True):
invalid_location = False
local_intensity = []
for multiplier in multipliers:
if multiplier == 1:
features = i3d.local_window(point2d_image, np_image_arr, win_size, flatten=flatten)
else:
features = i3d.local_window(point2d_image, np_image_arr, win_size*multiplier,
resize_to=win_size, flatten=flatten)
if features == None:
invalid_location = True
break
else:
local_intensity.append(features)
if invalid_location:
return None
else:
if flatten:
return np.row_stack(local_intensity)
else:
return local_intensity
class Subsampler:
def __init__(self):
self.proxy = rospy.ServiceProxy('subsample', fsrv.SubsampleCalc)
def subsample(self, points3d, frame='base_link'):
req = fsrv.SubsampleCalcRequest()
req.input = ru.np_to_pointcloud(points3d, frame)
res = self.proxy(req)
return ru.pointcloud_to_np(res.output)
class IntensityCloudFeatureExtractor:
def __init__(self, pointcloud_bl, cvimage_mat, expected_loc_bl, distance_feature_points,
image_T_bl, camera_calibration, params):
self.pointcloud_bl = pointcloud_bl
self.cvimage_mat = cvimage_mat
self.expected_loc_bl = expected_loc_bl
self.distance_feature_points = distance_feature_points
self.image_T_bl = image_T_bl
self.camera_calibration = camera_calibration
self.params = params
self.subsampler_service = Subsampler()
self.sizes = None #Important but access should be limited to decouple code
def get_sizes(self):
return self.sizes
def _subsample(self):
rospy.loginfo('Subsampling using PCL')
rospy.loginfo('before %s' % str(self.pointcloud_bl.shape))
self.pc_sub_samp_bl = self.subsampler_service.subsample(self.pointcloud_bl)
rospy.loginfo('after %s' % str(self.pc_sub_samp_bl.shape))
def _sample_points(self):
rospy.loginfo('Sampling points')
#evaluate all points
gaussian = pr.Gaussian(self.expected_loc_bl, \
np.matrix([[self.params.uncertainty_x**2, 0, 0], \
[0, self.params.uncertainty_y**2, 0], \
[0, 0, self.params.uncertainty_z**2]]))
pdf = gaussian.pdf_mat()
probs = np.matrix(pdf(self.pc_sub_samp_bl))
#sample unique points
n_samples = min(self.params.n_samples, self.pc_sub_samp_bl.shape[1])
pt_indices = list(set(sample_points(probs.T, n_samples)))
#only keep those that are in bound of points
sampled_pts3d_bl = self.pc_sub_samp_bl[:, pt_indices]
sampled_pts3d_image = tfu.transform_points(self.image_T_bl, sampled_pts3d_bl)
sampled_pts2d = self.camera_calibration.project(sampled_pts3d_image)
sampled_pix2d = np.matrix(np.round(sampled_pts2d))
#throw away points that are outside of bounds
x = sampled_pix2d[0,:]
y = sampled_pix2d[1,:]
good_pts = np.where((x >= 0) + (x < self.camera_calibration.w) \
+ (y >= 0) + (y < self.camera_calibration.h))[1].A1
sampled_pts3d_bl = sampled_pts3d_bl[:, good_pts]
sampled_pix2d = sampled_pix2d[:, good_pts]
rospy.loginfo('got %s good points' % str(sampled_pix2d.shape[1]))
return sampled_pts3d_bl, sampled_pix2d
def feature_vec_at(self, point3d_bl, point2d_image):
fea_calculated = []
#Get synthetic distance points
distance_feas = None
if self.distance_feature_points != None:
distance_feas = np.power(np.sum(np.power(self.distance_feature_points - point3d_bl, 2), 0), .5).T
fea_calculated.append(distance_feas)
#Get intensity features
intensity = intensity_pyramid_feature(point2d_image, np.asarray(self.cvimage_mat),
self.params.win_size, self.params.win_multipliers, True)
#pdb.set_trace()
if intensity == None:
return None
else:
fea_calculated.append(intensity)
if self.sizes == None:
self.sizes = {}
if distance_feas != None:
self.sizes['distance'] = distance_feas.shape[0]
self.sizes['intensity'] = intensity.shape[0]
return fea_calculated
def extract_features(self):
self._subsample()
sampled_pts3d_bl, sampled_pix2d = self._sample_points()
features_l = []
pts_with_features = []
rospy.loginfo('Extracting features')
for i in range(sampled_pts3d_bl.shape[1]):
features = self.feature_vec_at(sampled_pts3d_bl[:,i], sampled_pix2d[:,i])
if features != None:
features_l.append(features)
pts_with_features.append(i)
if i % 500 == 0:
rospy.loginfo(i)
features_by_type = zip(*features_l)
xs = np.row_stack([np.column_stack(f) for f in features_by_type])
rospy.loginfo('Finished feature extraction.')
return xs, sampled_pix2d[:, pts_with_features], sampled_pts3d_bl[:, pts_with_features]
| ajibawa-2023/Python-Code-Large/train/row_99521 | 124 | 209 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L28_C0", "label": "roslib import roslib", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.134, 0.0048, 0, 0.66, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "roslib", "arg_names": [], "import_names": ["roslib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('trf_learn')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L28_C15", "label": "load_manifest()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.134, 0.0048, 0, 0.66, 0.0714, 630, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_manifest", "arg_names": [], "import_names": [], "rhs_call_name": "load_manifest", "annotation": ""}, "snippet": "import roslib; roslib.load_manifest('trf_learn')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L29_C0", "label": "rospy import rospy", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.1388, 0.0048, 0, 0.66, 0.1429, 164, 0, 1, 0, 0, 164, 0, 0], "semantic": {"name": "rospy", "arg_names": [], "import_names": ["rospy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import rospy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L30_C0", "label": "cv import cv", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.1435, 0.0048, 0, 0.66, 0.2143, 492, 0, 1, 0, 0, 492, 0, 0], "semantic": {"name": "cv", "arg_names": [], "import_names": ["cv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L31_C0", "label": "numpy import np", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.1483, 0.0048, 0, 0.66, 0.2857, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L32_C0", "label": "feature_extractor_fpfh.srv import fsrv", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.1531, 0.0048, 0, 0.66, 0.3571, 300, 0, 1, 0, 0, 300, 0, 0], "semantic": {"name": "feature_extractor_fpfh.srv", "arg_names": [], "import_names": ["fsrv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import feature_extractor_fpfh.srv as fsrv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L33_C0", "label": "hrl_opencv.image3d import i3d", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0048, 0, 0.66, 0.4286, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "hrl_opencv.image3d", "arg_names": [], "import_names": ["i3d"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_opencv.image3d as i3d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L34_C0", "label": "hrl_lib.rutils import ru", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.1627, 0.0048, 0, 0.66, 0.5, 847, 0, 1, 0, 0, 847, 0, 0], "semantic": {"name": "hrl_lib.rutils", "arg_names": [], "import_names": ["ru"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.rutils as ru"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L35_C0", "label": "hrl_lib.prob import pr", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.1675, 0.0048, 0, 0.66, 0.5714, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "hrl_lib.prob", "arg_names": [], "import_names": ["pr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.prob as pr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Import_L36_C0", "label": "hrl_lib.tf_utils import tfu", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.1722, 0.0048, 0, 0.66, 0.6429, 5, 0, 1, 0, 0, 5, 0, 0], "semantic": {"name": "hrl_lib.tf_utils", "arg_names": [], "import_names": ["tfu"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.tf_utils as tfu"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "label": "sample_points", "type": "function", "loc": [41, 58], "level": 0, "parent": null, "vector": [2, 0, 0.2368, 0.0861, 0, 0.66, 0.7143, 500, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "sample_points", "arg_names": ["weights", "N"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sample_points(weights, N):\n assert(weights.shape[0] >= N)\n\n M = weights.shape[0]\n weights = weights / np.sum(weights)\n r = np.random.rand() * (1.0/M)\n c = weights[0,0]\n i = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L44_C4", "label": "M =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [14, 1, 0.2105, 0.0048, 1, 0.24, 0.0, 727, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "M", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " M = weights.shape[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L45_C4", "label": "weights =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [14, 1, 0.2153, 0.0048, 1, 0.24, 0.125, 362, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "weights", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " weights = weights / np.sum(weights)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L46_C4", "label": "r =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [14, 1, 0.2201, 0.0048, 1, 0.24, 0.25, 436, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = np.random.rand() * (1.0/M)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L47_C4", "label": "c =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [14, 1, 0.2249, 0.0048, 1, 0.24, 0.375, 411, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = weights[0,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L48_C4", "label": "i =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [14, 1, 0.2297, 0.0048, 1, 0.24, 0.5, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L49_C4", "label": "Xt =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [14, 1, 0.2344, 0.0048, 1, 0.24, 0.625, 150, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "Xt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Xt = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L51_C4", "label": "indices = tolist()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [14, 1, 0.244, 0.0048, 1, 0.24, 0.75, 478, 3, 0, 0, 0, 185, 10, 4], "semantic": {"name": "indices", "arg_names": [], "import_names": [], "rhs_call_name": "tolist", "annotation": ""}, "snippet": " indices = np.sort(np.random.permutation(np.arange(1, M+1))[0:N]).tolist()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L52_C4", "label": "for m", "type": "for", "loc": [52, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [6, 1, 0.2608, 0.0287, 1, 0.24, 0.875, 711, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in indices:\n U = r + (m - 1) * (1.0/M)\n while U > c:\n i = i + 1\n c = c + weights[i,0]\n Xt.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L53_C8", "label": "U =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L52_C4", "vector": [14, 2, 0.2536, 0.0048, 2, 0.68, 0.0, 643, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "U", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " U = r + (m - 1) * (1.0/M)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:While_L54_C8", "label": "while", "type": "while", "loc": [54, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L52_C4", "vector": [5, 2, 0.2632, 0.0144, 2, 0.68, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while U > c:\n i = i + 1\n c = c + weights[i,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L55_C12", "label": "i =", "type": "assigned_variable", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:While_L54_C8", "vector": [14, 3, 0.2632, 0.0048, 3, 0.1, 0.0, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = i + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L56_C12", "label": "c =", "type": "assigned_variable", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:While_L54_C8", "vector": [14, 3, 0.2679, 0.0048, 3, 0.1, 1.0, 411, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = c + weights[i,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L57_C8", "label": "append()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L52_C4", "vector": [8, 2, 0.2727, 0.0048, 2, 0.68, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " Xt.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "vector": [13, 1, 0.2775, 0.0048, 1, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Xt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "label": "test_sample_points", "type": "function", "loc": [61, 69], "level": 0, "parent": null, "vector": [2, 0, 0.311, 0.0431, 0, 0.66, 0.7857, 160, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "test_sample_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test_sample_points():\n w = np.matrix([.1,.4,.5]).T\n count = [0., 0., 0.]\n\n for i in range(6000.):\n idx = sample_points(w, 2)\n for x in idx:\n count[x] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L62_C4", "label": "w =", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "vector": [14, 1, 0.2967, 0.0048, 1, 0.13, 0.0, 549, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = np.matrix([.1,.4,.5]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L63_C4", "label": "count =", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "vector": [14, 1, 0.3014, 0.0048, 1, 0.13, 0.3333, 778, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = [0., 0., 0.]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L65_C4", "label": "for i", "type": "for", "loc": [65, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "vector": [6, 1, 0.3182, 0.0191, 1, 0.13, 0.6667, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(6000.):\n idx = sample_points(w, 2)\n for x in idx:\n count[x] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L66_C8", "label": "idx = sample_points()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L65_C4", "vector": [14, 2, 0.3158, 0.0048, 2, 0.03, 0.0, 187, 3, 2, 0, 0, 500, 10, 1], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "sample_points", "annotation": ""}, "snippet": " idx = sample_points(w, 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L67_C8", "label": "for x", "type": "for", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L65_C4", "vector": [6, 2, 0.323, 0.0096, 2, 0.03, 1.0, 190, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in idx:\n count[x] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L69_C4", "label": "print()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "vector": [8, 1, 0.3301, 0.0048, 1, 0.13, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(np.matrix(count) / np.sum(count))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "label": "intensity_pyramid_feature", "type": "function", "loc": [72, 92], "level": 0, "parent": null, "vector": [2, 0, 0.3923, 0.1005, 0, 0.66, 0.8571, 258, 0, 5, 1, 0, 0, 0, 4], "semantic": {"name": "intensity_pyramid_feature", "arg_names": ["point2d_image", "np_image_arr", "win_size", "multipliers", "flatten"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def intensity_pyramid_feature(point2d_image, np_image_arr, win_size, multipliers, flatten=True):\n invalid_location = False\n local_intensity = []\n for multiplier in multipliers:\n if multiplier == 1:\n features = i3d.local_window(point2d_image, np_image_arr, win_size, flatten=flatten)\n else:\n features = i3d.local_window(point2d_image, np_image_arr, win_size*multiplier, "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L73_C4", "label": "invalid_location =", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "vector": [14, 1, 0.3493, 0.0048, 1, 0.58, 0.0, 325, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "invalid_location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " invalid_location = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L74_C4", "label": "local_intensity =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "vector": [14, 1, 0.3541, 0.0048, 1, 0.58, 0.3333, 891, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "local_intensity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local_intensity = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L75_C4", "label": "for multiplier", "type": "for", "loc": [75, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "vector": [6, 1, 0.3828, 0.0526, 1, 0.58, 0.6667, 108, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "multiplier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for multiplier in multipliers:\n if multiplier == 1:\n features = i3d.local_window(point2d_image, np_image_arr, win_size, flatten=flatten)\n else:\n features = i3d.local_window(point2d_image, np_image_arr, win_size*multiplier, \n resize_to=win_size, flatten=flatten)\n if features == None:\n invalid_location = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L76_C8", "label": "if", "type": "if", "loc": [76, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L75_C4", "vector": [4, 2, 0.3732, 0.0239, 2, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if multiplier == 1:\n features = i3d.local_window(point2d_image, np_image_arr, win_size, flatten=flatten)\n else:\n features = i3d.local_window(point2d_image, np_image_arr, win_size*multiplier, \n resize_to=win_size, flatten=flatten)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L77_C12", "label": "features = local_window()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L76_C8", "vector": [14, 3, 0.3684, 0.0048, 3, 0.55, 0.0, 479, 3, 4, 0, 0, 354, 10, 1], "semantic": {"name": "features", "arg_names": [], "import_names": [], "rhs_call_name": "local_window", "annotation": ""}, "snippet": " features = i3d.local_window(point2d_image, np_image_arr, win_size, flatten=flatten)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L79_C12", "label": "features = local_window()", "type": "assigned_variable", "loc": [79, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L76_C8", "vector": [14, 3, 0.3804, 0.0096, 3, 0.55, 1.0, 479, 3, 5, 0, 0, 354, 10, 1], "semantic": {"name": "features", "arg_names": [], "import_names": [], "rhs_call_name": "local_window", "annotation": ""}, "snippet": " features = i3d.local_window(point2d_image, np_image_arr, win_size*multiplier, \n resize_to=win_size, flatten=flatten)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L81_C8", "label": "if", "type": "if", "loc": [81, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L75_C4", "vector": [4, 2, 0.3971, 0.0239, 2, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if features == None:\n invalid_location = True\n break\n else:\n local_intensity.append(features)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L82_C12", "label": "invalid_location =", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L81_C8", "vector": [14, 3, 0.3923, 0.0048, 3, 0.31, 0.0, 325, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "invalid_location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " invalid_location = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L85_C12", "label": "append()", "type": "expression", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L81_C8", "vector": [8, 3, 0.4067, 0.0048, 3, 0.31, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " local_intensity.append(features)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L86_C4", "label": "if", "type": "if", "loc": [86, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "vector": [4, 1, 0.4258, 0.0335, 1, 0.58, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if invalid_location:\n return None\n else:\n if flatten:\n return np.row_stack(local_intensity)\n else:\n return local_intensity"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L87_C8", "label": "return", "type": "return", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L86_C4", "vector": [13, 2, 0.4163, 0.0048, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L89_C8", "label": "if", "type": "if", "loc": [89, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L86_C4", "vector": [4, 2, 0.433, 0.0191, 2, 0.12, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flatten:\n return np.row_stack(local_intensity)\n else:\n return local_intensity"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L90_C12", "label": "return", "type": "return", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L89_C8", "vector": [13, 3, 0.4306, 0.0048, 3, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return np.row_stack(local_intensity)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L92_C12", "label": "return", "type": "return", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L89_C8", "vector": [13, 3, 0.4402, 0.0048, 3, 0.34, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return local_intensity"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L94_C0", "label": "Subsampler", "type": "class", "loc": [94, 102], "level": 0, "parent": null, "vector": [3, 0, 0.4689, 0.0431, 0, 0.66, 0.9286, 139, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "Subsampler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Subsampler:\n def __init__(self):\n self.proxy = rospy.ServiceProxy('subsample', fsrv.SubsampleCalc)\n\n def subsample(self, points3d, frame='base_link'):\n req = fsrv.SubsampleCalcRequest()\n req.input = ru.np_to_pointcloud(points3d, frame)\n res = self.proxy(req)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L95_C4", "label": "__init__", "type": "function", "loc": [95, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L94_C0", "vector": [2, 1, 0.4569, 0.0096, 1, 0.08, 0.0, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.proxy = rospy.ServiceProxy('subsample', fsrv.SubsampleCalc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L96_C8", "label": "self.proxy = ServiceProxy()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L95_C4", "vector": [14, 2, 0.4593, 0.0048, 2, 0.07, 0.0, 837, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "self.proxy", "arg_names": [], "import_names": [], "rhs_call_name": "ServiceProxy", "annotation": ""}, "snippet": " self.proxy = rospy.ServiceProxy('subsample', fsrv.SubsampleCalc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "label": "subsample", "type": "function", "loc": [98, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L94_C0", "vector": [2, 1, 0.4785, 0.0239, 1, 0.08, 1.0, 938, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "subsample", "arg_names": ["self", "points3d", "frame"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def subsample(self, points3d, frame='base_link'):\n req = fsrv.SubsampleCalcRequest()\n req.input = ru.np_to_pointcloud(points3d, frame)\n res = self.proxy(req)\n return ru.pointcloud_to_np(res.output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L99_C8", "label": "req = SubsampleCalcRequest()", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "vector": [14, 2, 0.4737, 0.0048, 2, 0.33, 0.0, 233, 3, 0, 0, 0, 913, 10, 1], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "SubsampleCalcRequest", "annotation": ""}, "snippet": " req = fsrv.SubsampleCalcRequest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L100_C8", "label": "req.input = np_to_pointcloud()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "vector": [14, 2, 0.4785, 0.0048, 2, 0.33, 0.3333, 699, 3, 2, 0, 0, 712, 10, 1], "semantic": {"name": "req.input", "arg_names": [], "import_names": [], "rhs_call_name": "np_to_pointcloud", "annotation": ""}, "snippet": " req.input = ru.np_to_pointcloud(points3d, frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L101_C8", "label": "res = proxy()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "vector": [14, 2, 0.4833, 0.0048, 2, 0.33, 0.6667, 413, 3, 1, 0, 0, 916, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "proxy", "annotation": ""}, "snippet": " res = self.proxy(req)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L102_C8", "label": "return", "type": "return", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "vector": [13, 2, 0.488, 0.0048, 2, 0.33, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ru.pointcloud_to_np(res.output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "label": "IntensityCloudFeatureExtractor", "type": "class", "loc": [105, 207], "level": 0, "parent": null, "vector": [3, 0, 0.7464, 0.4928, 0, 0.66, 1.0, 142, 0, 6, 0, 0, 0, 0, 43], "semantic": {"name": "IntensityCloudFeatureExtractor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IntensityCloudFeatureExtractor:\n\n def __init__(self, pointcloud_bl, cvimage_mat, expected_loc_bl, distance_feature_points, \n image_T_bl, camera_calibration, params):\n\n self.pointcloud_bl = pointcloud_bl\n self.cvimage_mat = cvimage_mat\n self.expected_loc_bl = expected_loc_bl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "label": "__init__", "type": "function", "loc": [107, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "vector": [2, 1, 0.5407, 0.0622, 1, 0.52, 0.0, 555, 0, 8, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "pointcloud_bl", "cvimage_mat", "expected_loc_bl", "distance_feature_points", "image_T_bl", "camera_calibration", "params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, pointcloud_bl, cvimage_mat, expected_loc_bl, distance_feature_points, \n image_T_bl, camera_calibration, params):\n\n self.pointcloud_bl = pointcloud_bl\n self.cvimage_mat = cvimage_mat\n self.expected_loc_bl = expected_loc_bl\n self.distance_feature_points = distance_feature_points\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L110_C8", "label": "self.pointcloud_bl =", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.5263, 0.0048, 2, 0.65, 0.0, 304, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pointcloud_bl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pointcloud_bl = pointcloud_bl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L111_C8", "label": "self.cvimage_mat =", "type": "assigned_variable", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.5311, 0.0048, 2, 0.65, 0.125, 335, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cvimage_mat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cvimage_mat = cvimage_mat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L112_C8", "label": "self.expected_loc_bl =", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.5359, 0.0048, 2, 0.65, 0.25, 86, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.expected_loc_bl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.expected_loc_bl = expected_loc_bl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L113_C8", "label": "self.distance_feature_points =", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.5407, 0.0048, 2, 0.65, 0.375, 341, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.distance_feature_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.distance_feature_points = distance_feature_points"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L115_C8", "label": "self.image_T_bl =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.5502, 0.0048, 2, 0.65, 0.5, 834, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.image_T_bl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.image_T_bl = image_T_bl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L116_C8", "label": "self.camera_calibration =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.555, 0.0048, 2, 0.65, 0.625, 552, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.camera_calibration", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.camera_calibration = camera_calibration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L117_C8", "label": "self.params =", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.5598, 0.0048, 2, 0.65, 0.75, 402, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params = params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L118_C8", "label": "self.subsampler_service = Subsampler()", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.5646, 0.0048, 2, 0.65, 0.875, 404, 3, 0, 0, 0, 139, 10, 1], "semantic": {"name": "self.subsampler_service", "arg_names": [], "import_names": [], "rhs_call_name": "Subsampler", "annotation": ""}, "snippet": " self.subsampler_service = Subsampler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L119_C8", "label": "self.sizes =", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "vector": [14, 2, 0.5694, 0.0048, 2, 0.65, 1.0, 719, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.sizes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sizes = None #Important but access should be limited to decouple code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L121_C4", "label": "get_sizes", "type": "function", "loc": [121, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "vector": [2, 1, 0.5813, 0.0096, 1, 0.52, 0.2, 378, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_sizes", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_sizes(self):\n return self.sizes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L122_C8", "label": "return", "type": "return", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L121_C4", "vector": [13, 2, 0.5837, 0.0048, 2, 0.22, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.sizes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "label": "_subsample", "type": "function", "loc": [124, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "vector": [2, 1, 0.6029, 0.0239, 1, 0.52, 0.4, 110, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "_subsample", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _subsample(self):\n rospy.loginfo('Subsampling using PCL')\n rospy.loginfo('before %s' % str(self.pointcloud_bl.shape))\n self.pc_sub_samp_bl = self.subsampler_service.subsample(self.pointcloud_bl)\n rospy.loginfo('after %s' % str(self.pc_sub_samp_bl.shape))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L125_C8", "label": "loginfo()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "vector": [8, 2, 0.5981, 0.0048, 2, 0.79, 0.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo('Subsampling using PCL')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L126_C8", "label": "loginfo()", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "vector": [8, 2, 0.6029, 0.0048, 2, 0.79, 0.3333, 607, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo('before %s' % str(self.pointcloud_bl.shape))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L127_C8", "label": "self.pc_sub_samp_bl = subsample()", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "vector": [14, 2, 0.6077, 0.0048, 2, 0.79, 0.6667, 305, 3, 1, 0, 0, 938, 10, 1], "semantic": {"name": "self.pc_sub_samp_bl", "arg_names": [], "import_names": [], "rhs_call_name": "subsample", "annotation": ""}, "snippet": " self.pc_sub_samp_bl = self.subsampler_service.subsample(self.pointcloud_bl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L128_C8", "label": "loginfo()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "vector": [8, 2, 0.6124, 0.0048, 2, 0.79, 1.0, 607, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo('after %s' % str(self.pc_sub_samp_bl.shape))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "label": "_sample_points", "type": "function", "loc": [130, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "vector": [2, 1, 0.6962, 0.1531, 1, 0.52, 0.6, 874, 0, 1, 1, 0, 0, 0, 17], "semantic": {"name": "_sample_points", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _sample_points(self):\n rospy.loginfo('Sampling points')\n #evaluate all points\n gaussian = pr.Gaussian(self.expected_loc_bl, \\\n np.matrix([[self.params.uncertainty_x**2, 0, 0], \\\n [0, self.params.uncertainty_y**2, 0], \\\n [0, 0, self.params.uncertainty_z**2]]))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L131_C8", "label": "loginfo()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [8, 2, 0.6268, 0.0048, 2, 0.4, 0.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo('Sampling points')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L133_C8", "label": "gaussian = Gaussian()", "type": "assigned_variable", "loc": [133, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.6435, 0.0191, 2, 0.4, 0.0625, 78, 3, 2, 0, 0, 408, 10, 2], "semantic": {"name": "gaussian", "arg_names": [], "import_names": [], "rhs_call_name": "Gaussian", "annotation": ""}, "snippet": " gaussian = pr.Gaussian(self.expected_loc_bl, \\\n np.matrix([[self.params.uncertainty_x**2, 0, 0], \\\n [0, self.params.uncertainty_y**2, 0], \\\n [0, 0, self.params.uncertainty_z**2]]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L138_C8", "label": "pdf = pdf_mat()", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.6603, 0.0048, 2, 0.4, 0.125, 298, 3, 0, 0, 0, 929, 10, 1], "semantic": {"name": "pdf", "arg_names": [], "import_names": [], "rhs_call_name": "pdf_mat", "annotation": ""}, "snippet": " pdf = gaussian.pdf_mat()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L139_C8", "label": "probs = matrix()", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.6651, 0.0048, 2, 0.4, 0.1875, 0, 3, 1, 0, 0, 162, 10, 2], "semantic": {"name": "probs", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " probs = np.matrix(pdf(self.pc_sub_samp_bl))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L142_C8", "label": "n_samples = min()", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.6794, 0.0048, 2, 0.4, 0.25, 812, 3, 2, 0, 0, 867, 10, 1], "semantic": {"name": "n_samples", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " n_samples = min(self.params.n_samples, self.pc_sub_samp_bl.shape[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L143_C8", "label": "pt_indices = list()", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.6842, 0.0048, 2, 0.4, 0.3125, 435, 3, 1, 0, 0, 430, 10, 3], "semantic": {"name": "pt_indices", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " pt_indices = list(set(sample_points(probs.T, n_samples)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L146_C8", "label": "sampled_pts3d_bl =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.6986, 0.0048, 2, 0.4, 0.375, 726, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sampled_pts3d_bl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sampled_pts3d_bl = self.pc_sub_samp_bl[:, pt_indices]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L147_C8", "label": "sampled_pts3d_image = transform_points()", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.7033, 0.0048, 2, 0.4, 0.4375, 542, 3, 2, 0, 0, 725, 10, 1], "semantic": {"name": "sampled_pts3d_image", "arg_names": [], "import_names": [], "rhs_call_name": "transform_points", "annotation": ""}, "snippet": " sampled_pts3d_image = tfu.transform_points(self.image_T_bl, sampled_pts3d_bl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L148_C8", "label": "sampled_pts2d = project()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.7081, 0.0048, 2, 0.4, 0.5, 303, 3, 1, 0, 0, 841, 10, 1], "semantic": {"name": "sampled_pts2d", "arg_names": [], "import_names": [], "rhs_call_name": "project", "annotation": ""}, "snippet": " sampled_pts2d = self.camera_calibration.project(sampled_pts3d_image)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L149_C8", "label": "sampled_pix2d = matrix()", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.7129, 0.0048, 2, 0.4, 0.5625, 771, 3, 1, 0, 0, 162, 10, 2], "semantic": {"name": "sampled_pix2d", "arg_names": [], "import_names": [], "rhs_call_name": "matrix", "annotation": ""}, "snippet": " sampled_pix2d = np.matrix(np.round(sampled_pts2d))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L152_C8", "label": "x =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.7273, 0.0048, 2, 0.4, 0.625, 190, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = sampled_pix2d[0,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L153_C8", "label": "y =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.7321, 0.0048, 2, 0.4, 0.6875, 304, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " y = sampled_pix2d[1,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L154_C8", "label": "good_pts =", "type": "assigned_variable", "loc": [154, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.7392, 0.0096, 2, 0.4, 0.75, 54, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "good_pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " good_pts = np.where((x >= 0) + (x < self.camera_calibration.w) \\\n + (y >= 0) + (y < self.camera_calibration.h))[1].A1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L157_C8", "label": "sampled_pts3d_bl =", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.7512, 0.0048, 2, 0.4, 0.8125, 726, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sampled_pts3d_bl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sampled_pts3d_bl = sampled_pts3d_bl[:, good_pts]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L158_C8", "label": "sampled_pix2d =", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [14, 2, 0.756, 0.0048, 2, 0.4, 0.875, 771, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sampled_pix2d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sampled_pix2d = sampled_pix2d[:, good_pts]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L160_C8", "label": "loginfo()", "type": "expression", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [8, 2, 0.7656, 0.0048, 2, 0.4, 0.9375, 607, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo('got %s good points' % str(sampled_pix2d.shape[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L161_C8", "label": "return", "type": "return", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "vector": [13, 2, 0.7703, 0.0048, 2, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sampled_pts3d_bl, sampled_pix2d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "label": "feature_vec_at", "type": "function", "loc": [163, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "vector": [2, 1, 0.8373, 0.1196, 1, 0.52, 0.8, 453, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "feature_vec_at", "arg_names": ["self", "point3d_bl", "point2d_image"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def feature_vec_at(self, point3d_bl, point2d_image):\n fea_calculated = []\n\n #Get synthetic distance points\n distance_feas = None\n if self.distance_feature_points != None:\n distance_feas = np.power(np.sum(np.power(self.distance_feature_points - point3d_bl, 2), 0), .5).T\n fea_calculated.append(distance_feas)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L164_C8", "label": "fea_calculated =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "vector": [14, 2, 0.7847, 0.0048, 2, 0.7, 0.0, 667, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "fea_calculated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fea_calculated = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L167_C8", "label": "distance_feas =", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "vector": [14, 2, 0.799, 0.0048, 2, 0.7, 0.1667, 931, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "distance_feas", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " distance_feas = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L168_C8", "label": "if", "type": "if", "loc": [168, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "vector": [4, 2, 0.8086, 0.0144, 2, 0.7, 0.3333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.distance_feature_points != None:\n distance_feas = np.power(np.sum(np.power(self.distance_feature_points - point3d_bl, 2), 0), .5).T\n fea_calculated.append(distance_feas)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L169_C12", "label": "distance_feas =", "type": "assigned_variable", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L168_C8", "vector": [14, 3, 0.8086, 0.0048, 3, 0.07, 0.0, 931, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "distance_feas", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " distance_feas = np.power(np.sum(np.power(self.distance_feature_points - point3d_bl, 2), 0), .5).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L170_C12", "label": "append()", "type": "expression", "loc": [170, 170], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L168_C8", "vector": [8, 3, 0.8134, 0.0048, 3, 0.07, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " fea_calculated.append(distance_feas)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L173_C8", "label": "intensity = intensity_pyramid_feature()", "type": "assigned_variable", "loc": [173, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "vector": [14, 2, 0.8301, 0.0096, 2, 0.7, 0.5, 845, 3, 5, 0, 0, 258, 10, 2], "semantic": {"name": "intensity", "arg_names": [], "import_names": [], "rhs_call_name": "intensity_pyramid_feature", "annotation": ""}, "snippet": " intensity = intensity_pyramid_feature(point2d_image, np.asarray(self.cvimage_mat), \n self.params.win_size, self.params.win_multipliers, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L176_C8", "label": "if", "type": "if", "loc": [176, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "vector": [4, 2, 0.8493, 0.0191, 2, 0.7, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if intensity == None:\n return None\n else:\n fea_calculated.append(intensity)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L177_C12", "label": "return", "type": "return", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L176_C8", "vector": [13, 3, 0.8469, 0.0048, 3, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L179_C12", "label": "append()", "type": "expression", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L176_C8", "vector": [8, 3, 0.8565, 0.0048, 3, 0.2, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " fea_calculated.append(intensity)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L181_C8", "label": "if", "type": "if", "loc": [181, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "vector": [4, 2, 0.8756, 0.0239, 2, 0.7, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.sizes == None:\n self.sizes = {}\n if distance_feas != None:\n self.sizes['distance'] = distance_feas.shape[0]\n self.sizes['intensity'] = intensity.shape[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L182_C12", "label": "self.sizes =", "type": "assigned_variable", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L181_C8", "vector": [14, 3, 0.8708, 0.0048, 3, 0.6, 0.0, 719, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.sizes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sizes = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L183_C12", "label": "if", "type": "if", "loc": [183, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L181_C8", "vector": [4, 3, 0.878, 0.0096, 3, 0.6, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if distance_feas != None:\n self.sizes['distance'] = distance_feas.shape[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L184_C16", "label": "assign", "type": "assigned_variable", "loc": [184, 184], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L183_C12", "vector": [14, 4, 0.8804, 0.0048, 4, 0.07, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sizes['distance'] = distance_feas.shape[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L185_C12", "label": "assign", "type": "assigned_variable", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L181_C8", "vector": [14, 3, 0.8852, 0.0048, 3, 0.6, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sizes['intensity'] = intensity.shape[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L187_C8", "label": "return", "type": "return", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "vector": [13, 2, 0.8947, 0.0048, 2, 0.7, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fea_calculated"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "label": "extract_features", "type": "function", "loc": [189, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "vector": [2, 1, 0.9474, 0.0909, 1, 0.52, 1.0, 763, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "extract_features", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extract_features(self):\n self._subsample()\n sampled_pts3d_bl, sampled_pix2d = self._sample_points()\n features_l = []\n pts_with_features = []\n\n rospy.loginfo('Extracting features')\n for i in range(sampled_pts3d_bl.shape[1]):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L190_C8", "label": "_subsample()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [8, 2, 0.9091, 0.0048, 2, 0.05, 0.0, 110, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_subsample", "arg_names": [], "import_names": [], "rhs_call_name": "_subsample", "annotation": ""}, "snippet": " self._subsample()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L191_C8", "label": "sampled_pts3d_bl, sampled_pix2d = _sample_points()", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [14, 2, 0.9139, 0.0048, 2, 0.05, 0.1111, 320, 3, 0, 0, 0, 874, 10, 1], "semantic": {"name": "sampled_pts3d_bl, sampled_pix2d", "arg_names": [], "import_names": [], "rhs_call_name": "_sample_points", "annotation": ""}, "snippet": " sampled_pts3d_bl, sampled_pix2d = self._sample_points()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L192_C8", "label": "features_l =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [14, 2, 0.9187, 0.0048, 2, 0.05, 0.2222, 288, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "features_l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " features_l = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L193_C8", "label": "pts_with_features =", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [14, 2, 0.9234, 0.0048, 2, 0.05, 0.3333, 635, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pts_with_features", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_with_features = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L195_C8", "label": "loginfo()", "type": "expression", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [8, 2, 0.933, 0.0048, 2, 0.05, 0.4444, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo('Extracting features')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L196_C8", "label": "for i", "type": "for", "loc": [196, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [6, 2, 0.9522, 0.0335, 2, 0.05, 0.5556, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(sampled_pts3d_bl.shape[1]):\n features = self.feature_vec_at(sampled_pts3d_bl[:,i], sampled_pix2d[:,i])\n if features != None:\n features_l.append(features)\n pts_with_features.append(i)\n if i % 500 == 0:\n rospy.loginfo(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L197_C12", "label": "features = feature_vec_at()", "type": "assigned_variable", "loc": [197, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L196_C8", "vector": [14, 3, 0.9426, 0.0048, 3, 0.41, 0.0, 479, 3, 2, 0, 0, 453, 10, 1], "semantic": {"name": "features", "arg_names": [], "import_names": [], "rhs_call_name": "feature_vec_at", "annotation": ""}, "snippet": " features = self.feature_vec_at(sampled_pts3d_bl[:,i], sampled_pix2d[:,i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L198_C12", "label": "if", "type": "if", "loc": [198, 200], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L196_C8", "vector": [4, 3, 0.9522, 0.0144, 3, 0.41, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if features != None:\n features_l.append(features)\n pts_with_features.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L199_C16", "label": "append()", "type": "expression", "loc": [199, 199], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L198_C12", "vector": [8, 4, 0.9522, 0.0048, 4, 0.68, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " features_l.append(features)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L200_C16", "label": "append()", "type": "expression", "loc": [200, 200], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L198_C12", "vector": [8, 4, 0.9569, 0.0048, 4, 0.68, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " pts_with_features.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L201_C12", "label": "if", "type": "if", "loc": [201, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L196_C8", "vector": [4, 3, 0.9641, 0.0096, 3, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i % 500 == 0:\n rospy.loginfo(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L202_C16", "label": "loginfo()", "type": "expression", "loc": [202, 202], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L201_C12", "vector": [8, 4, 0.9665, 0.0048, 4, 0.27, 0.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L204_C8", "label": "features_by_type = zip()", "type": "assigned_variable", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [14, 2, 0.9761, 0.0048, 2, 0.05, 0.6667, 677, 3, 1, 0, 0, 814, 10, 1], "semantic": {"name": "features_by_type", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " features_by_type = zip(*features_l)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L205_C8", "label": "xs = row_stack()", "type": "assigned_variable", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [14, 2, 0.9809, 0.0048, 2, 0.05, 0.7778, 928, 3, 1, 0, 0, 612, 10, 2], "semantic": {"name": "xs", "arg_names": [], "import_names": [], "rhs_call_name": "row_stack", "annotation": ""}, "snippet": " xs = np.row_stack([np.column_stack(f) for f in features_by_type])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L206_C8", "label": "loginfo()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [8, 2, 0.9856, 0.0048, 2, 0.05, 0.8889, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loginfo", "arg_names": [], "import_names": [], "rhs_call_name": "loginfo", "annotation": ""}, "snippet": " rospy.loginfo('Finished feature extraction.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L207_C8", "label": "return", "type": "return", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "vector": [13, 2, 0.9904, 0.0048, 2, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return xs, sampled_pix2d[:, pts_with_features], sampled_pts3d_bl[:, pts_with_features]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:While_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:While_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:While_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L181_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L181_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L183_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L184_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L181_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L198_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L198_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L199_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L198_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L200_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:For_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L201_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:If_L201_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L202_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Assign_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99521:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99521:Return_L207_C8"}] |
#
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Advait Jain (Healthcare Robotics Lab, Georgia Tech.)
import sys,time
import hrl_lib.util as ut, hrl_lib.transforms as tr
import matplotlib_util.util as mpu
import numpy as np, math
sys.path.append('../')
import segway_motion_calc as smc
import arm_trajectories as at
def plot_hook_translation(curr_pos_tl,cx_tl,cy_tl,cy_ts,
start_pos_ts,eq_pt_tl,bndry,wrkspc_pts):
vt,a = smc.segway_motion_repulse(curr_pos_tl,cx_tl,cy_tl,cy_ts,
start_pos_ts,eq_pt_tl,bndry,wrkspc_pts)
mpu.plot_yx(eq_pt_tl[1,:].A1, eq_pt_tl[0,:].A1, linewidth=2,
color='g', scatter_size=15, label='Eq Pt')
mpu.plot_yx(curr_pos_tl[1,:].A1, curr_pos_tl[0,:].A1, linewidth=0,
color='b', scatter_size = 15, label = 'FK')
mpu.plot_yx(bndry[1,:].A1, bndry[0,:].A1, linewidth=0, color='y',
scatter_size=8)
mpu.plot_yx([-0.2], [0.], linewidth=0, color='b', scatter_size=2)
bndry_dist_eq = smc.dist_from_boundary(eq_pt_tl, bndry, wrkspc_pts) # signed
bndry_dist_ee = smc.dist_from_boundary(curr_pos_tl, bndry, wrkspc_pts) # signed
if bndry_dist_ee < bndry_dist_eq:
p = curr_pos_tl
else:
p = eq_pt_tl
pts_close = smc.pts_within_dist(p[0:2,:],bndry,0.01,0.1)
mpu.plot_yx(pts_close[1,:].A1, pts_close[0,:].A1, linewidth=0,
color='r', scatter_size = 8)
nrm = np.linalg.norm(vt)
vt = vt/nrm
mpu.plot_quiver_yxv(p[1,:].A1, p[0,:].A1, vt, scale=12)
mpu.show()
# only interested in the translation. so junk values for circle
# params are ok.
def plot_eq_pt_motion_tl():
vec_list = []
for i in range(len(ee_tl.p_list)):
# for i in range(5):
curr_pos_tl = np.matrix(ee_tl.p_list[i]).T
eq_pt_tl = np.matrix(eq_tl.p_list[i]).T
pts_ts = np.matrix(ee_ts.p_list[0:i+1]).T
pts_2d_ts = pts_ts[0:2,:]
# rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,
# method='fmin_bfgs',verbose=False)
rad_opt = 1.0
cx_ts,cy_ts = 0.5,-1.3
c_ts = np.matrix([cx_ts,cy_ts,0.]).T
x,y,a = st.x_list[i],st.y_list[i],st.a_list[i]
c_tl = smc.tlTts(c_ts,x,y,a)
cx_tl,cy_tl = c_tl[0,0],c_tl[1,0]
t0 = time.time()
vt,a = smc.segway_motion_repulse(curr_pos_tl,cx_tl,cy_tl,cy_ts,
start_pos_ts,eq_pt_tl,bndry,wrkspc_pts)
t1 = time.time()
# print 'time to segway_motion_repulse:',t1-t0
nrm = np.linalg.norm(vt)
# if nrm > 0.005:
vt = vt/nrm
vec_list.append(vt.A1.tolist())
v = np.matrix(vec_list).T
eq_pts = np.matrix(eq_tl.p_list).T
ee_pts = np.matrix(ee_tl.p_list).T
mpu.plot_yx(eq_pts[1,:].A1,eq_pts[0,:].A1,linewidth=1,color='g',label='eq')
mpu.plot_yx(ee_pts[1,:].A1,ee_pts[0,:].A1,linewidth=1,color='b',label='FK')
mpu.plot_yx(bndry[1,:].A1,bndry[0,:].A1,linewidth=0,color='y')
mpu.plot_quiver_yxv(eq_pts[1,:].A1,eq_pts[0,:].A1,v,scale=30)
mpu.legend()
mpu.show()
def plot_single_point():
n_pts = 115
pts_ts = np.matrix(ee_ts.p_list[0:n_pts]).T
pts_2d_ts = pts_ts[0:2,:]
rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,
method='fmin_bfgs',verbose=False)
print 'rad_opt,cx_ts,cy_ts:',rad_opt,cx_ts,cy_ts
c_ts = np.matrix([cx_ts,cy_ts,0.]).T
x,y,a = st.x_list[n_pts-1],st.y_list[n_pts-1],st.a_list[n_pts-1]
c_tl = smc.tlTts(c_ts,x,y,a)
cx_tl,cy_tl = c_tl[0,0],c_tl[1,0]
curr_pos_tl = np.matrix(ee_tl.p_list[n_pts-1]).T
eqpt_tl = np.matrix(eq_tl.p_list[n_pts-1]).T
plot_hook_translation(curr_pos_tl,cx_tl,cy_tl,cy_ts,start_pos_ts,
eqpt_tl,bndry,wrkspc_pts)
def calc_motion_all():
for i in range(len(ee_tl.p_list)):
curr_pos_tl = np.matrix(ee_tl.p_list[i]).T
eq_pt_tl = np.matrix(eq_tl.p_list[i]).T
pts_ts = np.matrix(ee_ts.p_list[0:i+1]).T
pts_2d_ts = pts_ts[0:2,:]
rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,
method='fmin_bfgs',verbose=False)
c_ts = np.matrix([cx_ts,cy_ts,0.]).T
x,y,a = st.x_list[i],st.y_list[i],st.a_list[i]
c_tl = smc.tlTts(c_ts,x,y,a)
cx_tl,cy_tl = c_tl[0,0],c_tl[1,0]
vt,a = smc.segway_motion_repulse(curr_pos_tl,cx_tl,cy_tl,cy_ts,
start_pos_ts,eq_pt_tl,bndry)
print 'angle:',math.degrees(a)
argv = sys.argv
fname = argv[1]
d = ut.load_pickle(fname)
st = d['segway']
ee_tl = at.joint_to_cartesian(d['actual'])
ee_ts = at.account_segway_motion(ee_tl,st)
eq_tl = at.joint_to_cartesian(d['eq_pt'])
eq_ts = at.account_segway_motion(eq_tl,st)
bndry = d['bndry']
wrkspc_pts = d['wrkspc']
rad_guess = 1.0
start_pos_ts = np.matrix(ee_ts.p_list[0]).T
x_guess = start_pos_ts[0,0]
y_guess = start_pos_ts[1,0] - rad_guess
plot_single_point()
#calc_motion_all()
#plot_eq_pt_motion_tl()
| ajibawa-2023/Python-Code-Large/train/row_99522 | 93 | 174 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Import_L32_C0", "label": "sys import sys, time", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.1839, 0.0057, 0, 0.66, 0.0, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys,time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Import_L33_C0", "label": "hrl_lib.util import ut, tr", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.1897, 0.0057, 0, 0.66, 0.04, 775, 0, 2, 0, 0, 775, 0, 0], "semantic": {"name": "hrl_lib.util", "arg_names": [], "import_names": ["ut", "tr"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hrl_lib.util as ut, hrl_lib.transforms as tr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Import_L34_C0", "label": "matplotlib_util.util import mpu", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.1954, 0.0057, 0, 0.66, 0.08, 781, 0, 1, 0, 0, 781, 0, 0], "semantic": {"name": "matplotlib_util.util", "arg_names": [], "import_names": ["mpu"], "rhs_call_name": "", "annotation": ""}, "snippet": "import matplotlib_util.util as mpu"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Import_L35_C0", "label": "numpy import np, math", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.2011, 0.0057, 0, 0.66, 0.12, 954, 0, 2, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["np", "math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import numpy as np, math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L37_C0", "label": "append()", "type": "expression", "loc": [37, 37], "level": 0, "parent": null, "vector": [8, 0, 0.2126, 0.0057, 0, 0.66, 0.16, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append('../')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Import_L38_C0", "label": "segway_motion_calc import smc", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.2184, 0.0057, 0, 0.66, 0.2, 870, 0, 1, 0, 0, 870, 0, 0], "semantic": {"name": "segway_motion_calc", "arg_names": [], "import_names": ["smc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import segway_motion_calc as smc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Import_L39_C0", "label": "arm_trajectories import at", "type": "import", "loc": [39, 39], "level": 0, "parent": null, "vector": [1, 0, 0.2241, 0.0057, 0, 0.66, 0.24, 34, 0, 1, 0, 0, 34, 0, 0], "semantic": {"name": "arm_trajectories", "arg_names": [], "import_names": ["at"], "rhs_call_name": "", "annotation": ""}, "snippet": "import arm_trajectories as at"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "label": "plot_hook_translation", "type": "function", "loc": [41, 69], "level": 0, "parent": null, "vector": [2, 0, 0.3161, 0.1667, 0, 0.66, 0.28, 714, 0, 8, 0, 0, 0, 0, 12], "semantic": {"name": "plot_hook_translation", "arg_names": ["curr_pos_tl", "cx_tl", "cy_tl", "cy_ts", "start_pos_ts", "eq_pt_tl", "bndry", "wrkspc_pts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_hook_translation(curr_pos_tl,cx_tl,cy_tl,cy_ts,\n start_pos_ts,eq_pt_tl,bndry,wrkspc_pts):\n vt,a = smc.segway_motion_repulse(curr_pos_tl,cx_tl,cy_tl,cy_ts,\n start_pos_ts,eq_pt_tl,bndry,wrkspc_pts)\n\n\n mpu.plot_yx(eq_pt_tl[1,:].A1, eq_pt_tl[0,:].A1, linewidth=2,\n color='g', scatter_size=15, label='Eq Pt')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L43_C4", "label": "vt, a = segway_motion_repulse()", "type": "assigned_variable", "loc": [43, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [14, 1, 0.25, 0.0115, 1, 0.14, 0.0, 854, 3, 8, 0, 0, 681, 10, 1], "semantic": {"name": "vt, a", "arg_names": [], "import_names": [], "rhs_call_name": "segway_motion_repulse", "annotation": ""}, "snippet": " vt,a = smc.segway_motion_repulse(curr_pos_tl,cx_tl,cy_tl,cy_ts,\n start_pos_ts,eq_pt_tl,bndry,wrkspc_pts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L47_C4", "label": "plot_yx()", "type": "expression", "loc": [47, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [8, 1, 0.273, 0.0115, 1, 0.14, 0.0769, 112, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "plot_yx", "arg_names": [], "import_names": [], "rhs_call_name": "plot_yx", "annotation": ""}, "snippet": " mpu.plot_yx(eq_pt_tl[1,:].A1, eq_pt_tl[0,:].A1, linewidth=2,\n color='g', scatter_size=15, label='Eq Pt')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L49_C4", "label": "plot_yx()", "type": "expression", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [8, 1, 0.2845, 0.0115, 1, 0.14, 0.1538, 112, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "plot_yx", "arg_names": [], "import_names": [], "rhs_call_name": "plot_yx", "annotation": ""}, "snippet": " mpu.plot_yx(curr_pos_tl[1,:].A1, curr_pos_tl[0,:].A1, linewidth=0,\n color='b', scatter_size = 15, label = 'FK')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L51_C4", "label": "plot_yx()", "type": "expression", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [8, 1, 0.296, 0.0115, 1, 0.14, 0.2308, 112, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "plot_yx", "arg_names": [], "import_names": [], "rhs_call_name": "plot_yx", "annotation": ""}, "snippet": " mpu.plot_yx(bndry[1,:].A1, bndry[0,:].A1, linewidth=0, color='y',\n scatter_size=8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L53_C4", "label": "plot_yx()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [8, 1, 0.3046, 0.0057, 1, 0.14, 0.3077, 112, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "plot_yx", "arg_names": [], "import_names": [], "rhs_call_name": "plot_yx", "annotation": ""}, "snippet": " mpu.plot_yx([-0.2], [0.], linewidth=0, color='b', scatter_size=2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L55_C4", "label": "bndry_dist_eq = dist_from_boundary()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [14, 1, 0.3161, 0.0057, 1, 0.14, 0.3846, 145, 3, 3, 0, 0, 447, 10, 1], "semantic": {"name": "bndry_dist_eq", "arg_names": [], "import_names": [], "rhs_call_name": "dist_from_boundary", "annotation": ""}, "snippet": " bndry_dist_eq = smc.dist_from_boundary(eq_pt_tl, bndry, wrkspc_pts) # signed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L56_C4", "label": "bndry_dist_ee = dist_from_boundary()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [14, 1, 0.3218, 0.0057, 1, 0.14, 0.4615, 95, 3, 3, 0, 0, 447, 10, 1], "semantic": {"name": "bndry_dist_ee", "arg_names": [], "import_names": [], "rhs_call_name": "dist_from_boundary", "annotation": ""}, "snippet": " bndry_dist_ee = smc.dist_from_boundary(curr_pos_tl, bndry, wrkspc_pts) # signed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:If_L57_C4", "label": "if", "type": "if", "loc": [57, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [4, 1, 0.3362, 0.023, 1, 0.14, 0.5385, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bndry_dist_ee < bndry_dist_eq:\n p = curr_pos_tl\n else:\n p = eq_pt_tl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L58_C8", "label": "p =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:If_L57_C4", "vector": [14, 2, 0.3333, 0.0057, 2, 0.26, 0.0, 491, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p = curr_pos_tl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L60_C8", "label": "p =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:If_L57_C4", "vector": [14, 2, 0.3448, 0.0057, 2, 0.26, 1.0, 491, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p = eq_pt_tl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L61_C4", "label": "pts_close = pts_within_dist()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [14, 1, 0.3506, 0.0057, 1, 0.14, 0.6154, 664, 3, 4, 0, 0, 414, 10, 1], "semantic": {"name": "pts_close", "arg_names": [], "import_names": [], "rhs_call_name": "pts_within_dist", "annotation": ""}, "snippet": " pts_close = smc.pts_within_dist(p[0:2,:],bndry,0.01,0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L62_C4", "label": "plot_yx()", "type": "expression", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [8, 1, 0.3592, 0.0115, 1, 0.14, 0.6923, 112, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "plot_yx", "arg_names": [], "import_names": [], "rhs_call_name": "plot_yx", "annotation": ""}, "snippet": " mpu.plot_yx(pts_close[1,:].A1, pts_close[0,:].A1, linewidth=0,\n color='r', scatter_size = 8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L65_C4", "label": "nrm = norm()", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [14, 1, 0.3736, 0.0057, 1, 0.14, 0.7692, 422, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "nrm", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " nrm = np.linalg.norm(vt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L66_C4", "label": "vt =", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [14, 1, 0.3793, 0.0057, 1, 0.14, 0.8462, 360, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vt = vt/nrm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L67_C4", "label": "plot_quiver_yxv()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [8, 1, 0.3851, 0.0057, 1, 0.14, 0.9231, 776, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot_quiver_yxv", "arg_names": [], "import_names": [], "rhs_call_name": "plot_quiver_yxv", "annotation": ""}, "snippet": " mpu.plot_quiver_yxv(p[1,:].A1, p[0,:].A1, vt, scale=12)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L69_C4", "label": "show()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "vector": [8, 1, 0.3966, 0.0057, 1, 0.14, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " mpu.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "label": "plot_eq_pt_motion_tl", "type": "function", "loc": [73, 109], "level": 0, "parent": null, "vector": [2, 0, 0.523, 0.2126, 0, 0.66, 0.32, 305, 0, 0, 0, 0, 0, 0, 22], "semantic": {"name": "plot_eq_pt_motion_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_eq_pt_motion_tl():\n vec_list = []\n for i in range(len(ee_tl.p_list)):\n# for i in range(5):\n curr_pos_tl = np.matrix(ee_tl.p_list[i]).T\n eq_pt_tl = np.matrix(eq_tl.p_list[i]).T\n\n pts_ts = np.matrix(ee_ts.p_list[0:i+1]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L74_C4", "label": "vec_list =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [14, 1, 0.4253, 0.0057, 1, 0.69, 0.0, 708, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "vec_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vec_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "label": "for i", "type": "for", "loc": [75, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [6, 1, 0.4971, 0.1379, 1, 0.69, 0.1, 826, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(len(ee_tl.p_list)):\n# for i in range(5):\n curr_pos_tl = np.matrix(ee_tl.p_list[i]).T\n eq_pt_tl = np.matrix(eq_tl.p_list[i]).T\n\n pts_ts = np.matrix(ee_ts.p_list[0:i+1]).T\n pts_2d_ts = pts_ts[0:2,:]\n# rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L77_C8", "label": "curr_pos_tl =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.4425, 0.0057, 2, 0.45, 0.0, 229, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "curr_pos_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr_pos_tl = np.matrix(ee_tl.p_list[i]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L78_C8", "label": "eq_pt_tl =", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.4483, 0.0057, 2, 0.45, 0.0667, 373, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "eq_pt_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " eq_pt_tl = np.matrix(eq_tl.p_list[i]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L80_C8", "label": "pts_ts =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.4598, 0.0057, 2, 0.45, 0.1333, 837, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pts_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_ts = np.matrix(ee_ts.p_list[0:i+1]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L81_C8", "label": "pts_2d_ts =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.4655, 0.0057, 2, 0.45, 0.2, 333, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts_2d_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_2d_ts = pts_ts[0:2,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L84_C8", "label": "rad_opt =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.4828, 0.0057, 2, 0.45, 0.2667, 291, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "rad_opt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rad_opt = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L85_C8", "label": "cx_ts, cy_ts =", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.4885, 0.0057, 2, 0.45, 0.3333, 2, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "cx_ts, cy_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cx_ts,cy_ts = 0.5,-1.3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L86_C8", "label": "c_ts =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.4943, 0.0057, 2, 0.45, 0.4, 123, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_ts = np.matrix([cx_ts,cy_ts,0.]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L87_C8", "label": "x, y, a =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.5, 0.0057, 2, 0.45, 0.4667, 465, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "x, y, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x,y,a = st.x_list[i],st.y_list[i],st.a_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L88_C8", "label": "c_tl = tlTts()", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.5057, 0.0057, 2, 0.45, 0.5333, 318, 3, 4, 0, 0, 23, 10, 1], "semantic": {"name": "c_tl", "arg_names": [], "import_names": [], "rhs_call_name": "tlTts", "annotation": ""}, "snippet": " c_tl = smc.tlTts(c_ts,x,y,a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L89_C8", "label": "cx_tl, cy_tl =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.5115, 0.0057, 2, 0.45, 0.6, 421, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "cx_tl, cy_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cx_tl,cy_tl = c_tl[0,0],c_tl[1,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L90_C8", "label": "t0 = time()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.5172, 0.0057, 2, 0.45, 0.6667, 573, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t0", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t0 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L91_C8", "label": "vt, a = segway_motion_repulse()", "type": "assigned_variable", "loc": [91, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.5259, 0.0115, 2, 0.45, 0.7333, 854, 3, 8, 0, 0, 681, 10, 1], "semantic": {"name": "vt, a", "arg_names": [], "import_names": [], "rhs_call_name": "segway_motion_repulse", "annotation": ""}, "snippet": " vt,a = smc.segway_motion_repulse(curr_pos_tl,cx_tl,cy_tl,cy_ts,\n start_pos_ts,eq_pt_tl,bndry,wrkspc_pts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L93_C8", "label": "t1 = time()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.5345, 0.0057, 2, 0.45, 0.8, 329, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t1", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t1 = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L95_C8", "label": "nrm = norm()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.546, 0.0057, 2, 0.45, 0.8667, 422, 3, 1, 0, 0, 902, 10, 1], "semantic": {"name": "nrm", "arg_names": [], "import_names": [], "rhs_call_name": "norm", "annotation": ""}, "snippet": " nrm = np.linalg.norm(vt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L97_C8", "label": "vt =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [14, 2, 0.5575, 0.0057, 2, 0.45, 0.9333, 360, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vt = vt/nrm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L98_C8", "label": "append()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "vector": [8, 2, 0.5632, 0.0057, 2, 0.45, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " vec_list.append(vt.A1.tolist())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L100_C4", "label": "v =", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [14, 1, 0.5747, 0.0057, 1, 0.69, 0.2, 553, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " v = np.matrix(vec_list).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L102_C4", "label": "eq_pts =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [14, 1, 0.5862, 0.0057, 1, 0.69, 0.3, 409, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "eq_pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " eq_pts = np.matrix(eq_tl.p_list).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L103_C4", "label": "ee_pts =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [14, 1, 0.592, 0.0057, 1, 0.69, 0.4, 86, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ee_pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ee_pts = np.matrix(ee_tl.p_list).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L104_C4", "label": "plot_yx()", "type": "expression", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [8, 1, 0.5977, 0.0057, 1, 0.69, 0.5, 112, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "plot_yx", "arg_names": [], "import_names": [], "rhs_call_name": "plot_yx", "annotation": ""}, "snippet": " mpu.plot_yx(eq_pts[1,:].A1,eq_pts[0,:].A1,linewidth=1,color='g',label='eq')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L105_C4", "label": "plot_yx()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [8, 1, 0.6034, 0.0057, 1, 0.69, 0.6, 112, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "plot_yx", "arg_names": [], "import_names": [], "rhs_call_name": "plot_yx", "annotation": ""}, "snippet": " mpu.plot_yx(ee_pts[1,:].A1,ee_pts[0,:].A1,linewidth=1,color='b',label='FK')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L106_C4", "label": "plot_yx()", "type": "expression", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [8, 1, 0.6092, 0.0057, 1, 0.69, 0.7, 112, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot_yx", "arg_names": [], "import_names": [], "rhs_call_name": "plot_yx", "annotation": ""}, "snippet": " mpu.plot_yx(bndry[1,:].A1,bndry[0,:].A1,linewidth=0,color='y')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L107_C4", "label": "plot_quiver_yxv()", "type": "expression", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [8, 1, 0.6149, 0.0057, 1, 0.69, 0.8, 776, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "plot_quiver_yxv", "arg_names": [], "import_names": [], "rhs_call_name": "plot_quiver_yxv", "annotation": ""}, "snippet": " mpu.plot_quiver_yxv(eq_pts[1,:].A1,eq_pts[0,:].A1,v,scale=30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L108_C4", "label": "legend()", "type": "expression", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [8, 1, 0.6207, 0.0057, 1, 0.69, 0.9, 880, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " mpu.legend()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L109_C4", "label": "show()", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "vector": [8, 1, 0.6264, 0.0057, 1, 0.69, 1.0, 497, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "show", "annotation": ""}, "snippet": " mpu.show()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "label": "plot_single_point", "type": "function", "loc": [111, 128], "level": 0, "parent": null, "vector": [2, 0, 0.6868, 0.1034, 0, 0.66, 0.36, 710, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "plot_single_point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def plot_single_point():\n n_pts = 115\n pts_ts = np.matrix(ee_ts.p_list[0:n_pts]).T\n pts_2d_ts = pts_ts[0:2,:]\n rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,\n method='fmin_bfgs',verbose=False)\n print('rad_opt,cx_ts,cy_ts:',rad_opt,cx_ts,cy_ts)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L112_C4", "label": "n_pts =", "type": "assigned_variable", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.6437, 0.0057, 1, 0.23, 0.0, 156, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n_pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_pts = 115"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L113_C4", "label": "pts_ts =", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.6494, 0.0057, 1, 0.23, 0.0909, 837, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pts_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_ts = np.matrix(ee_ts.p_list[0:n_pts]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L114_C4", "label": "pts_2d_ts =", "type": "assigned_variable", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.6552, 0.0057, 1, 0.23, 0.1818, 333, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts_2d_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_2d_ts = pts_ts[0:2,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L115_C4", "label": "rad_opt, cx_ts, cy_ts = fit_circle()", "type": "assigned_variable", "loc": [115, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.6638, 0.0115, 1, 0.23, 0.2727, 548, 3, 6, 0, 0, 441, 10, 1], "semantic": {"name": "rad_opt, cx_ts, cy_ts", "arg_names": [], "import_names": [], "rhs_call_name": "fit_circle", "annotation": ""}, "snippet": " rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,\n method='fmin_bfgs',verbose=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L117_C4", "label": "print()", "type": "expression", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [8, 1, 0.6724, 0.0057, 1, 0.23, 0.3636, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('rad_opt,cx_ts,cy_ts:',rad_opt,cx_ts,cy_ts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L119_C4", "label": "c_ts =", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.6839, 0.0057, 1, 0.23, 0.4545, 123, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_ts = np.matrix([cx_ts,cy_ts,0.]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L120_C4", "label": "x, y, a =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.6897, 0.0057, 1, 0.23, 0.5455, 465, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "x, y, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x,y,a = st.x_list[n_pts-1],st.y_list[n_pts-1],st.a_list[n_pts-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L121_C4", "label": "c_tl = tlTts()", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.6954, 0.0057, 1, 0.23, 0.6364, 318, 3, 4, 0, 0, 23, 10, 1], "semantic": {"name": "c_tl", "arg_names": [], "import_names": [], "rhs_call_name": "tlTts", "annotation": ""}, "snippet": " c_tl = smc.tlTts(c_ts,x,y,a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L122_C4", "label": "cx_tl, cy_tl =", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.7011, 0.0057, 1, 0.23, 0.7273, 421, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "cx_tl, cy_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cx_tl,cy_tl = c_tl[0,0],c_tl[1,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L124_C4", "label": "curr_pos_tl =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.7126, 0.0057, 1, 0.23, 0.8182, 229, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "curr_pos_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr_pos_tl = np.matrix(ee_tl.p_list[n_pts-1]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L125_C4", "label": "eqpt_tl =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [14, 1, 0.7184, 0.0057, 1, 0.23, 0.9091, 485, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "eqpt_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " eqpt_tl = np.matrix(eq_tl.p_list[n_pts-1]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L127_C4", "label": "plot_hook_translation()", "type": "expression", "loc": [127, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "vector": [8, 1, 0.7328, 0.0115, 1, 0.23, 1.0, 714, 3, 8, 0, 0, 0, 0, 1], "semantic": {"name": "plot_hook_translation", "arg_names": [], "import_names": [], "rhs_call_name": "plot_hook_translation", "annotation": ""}, "snippet": " plot_hook_translation(curr_pos_tl,cx_tl,cy_tl,cy_ts,start_pos_ts,\n eqpt_tl,bndry,wrkspc_pts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L131_C0", "label": "calc_motion_all", "type": "function", "loc": [131, 146], "level": 0, "parent": null, "vector": [2, 0, 0.796, 0.092, 0, 0.66, 0.4, 793, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "calc_motion_all", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def calc_motion_all():\n for i in range(len(ee_tl.p_list)):\n curr_pos_tl = np.matrix(ee_tl.p_list[i]).T\n eq_pt_tl = np.matrix(eq_tl.p_list[i]).T\n\n pts_ts = np.matrix(ee_ts.p_list[0:i+1]).T\n pts_2d_ts = pts_ts[0:2,:]\n rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "label": "for i", "type": "for", "loc": [132, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L131_C0", "vector": [6, 1, 0.7989, 0.0862, 1, 0.3, 0.0, 826, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(len(ee_tl.p_list)):\n curr_pos_tl = np.matrix(ee_tl.p_list[i]).T\n eq_pt_tl = np.matrix(eq_tl.p_list[i]).T\n\n pts_ts = np.matrix(ee_ts.p_list[0:i+1]).T\n pts_2d_ts = pts_ts[0:2,:]\n rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,\n method='fmin_bfgs',verbose=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L133_C8", "label": "curr_pos_tl =", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.7644, 0.0057, 2, 0.0, 0.0, 229, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "curr_pos_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr_pos_tl = np.matrix(ee_tl.p_list[i]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L134_C8", "label": "eq_pt_tl =", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.7701, 0.0057, 2, 0.0, 0.1, 373, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "eq_pt_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " eq_pt_tl = np.matrix(eq_tl.p_list[i]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L136_C8", "label": "pts_ts =", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.7816, 0.0057, 2, 0.0, 0.2, 837, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pts_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_ts = np.matrix(ee_ts.p_list[0:i+1]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L137_C8", "label": "pts_2d_ts =", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.7874, 0.0057, 2, 0.0, 0.3, 333, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pts_2d_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pts_2d_ts = pts_ts[0:2,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L138_C8", "label": "rad_opt, cx_ts, cy_ts = fit_circle()", "type": "assigned_variable", "loc": [138, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.796, 0.0115, 2, 0.0, 0.4, 548, 3, 6, 0, 0, 441, 10, 1], "semantic": {"name": "rad_opt, cx_ts, cy_ts", "arg_names": [], "import_names": [], "rhs_call_name": "fit_circle", "annotation": ""}, "snippet": " rad_opt,cx_ts,cy_ts = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d_ts,\n method='fmin_bfgs',verbose=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L140_C8", "label": "c_ts =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.8046, 0.0057, 2, 0.0, 0.5, 123, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_ts = np.matrix([cx_ts,cy_ts,0.]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L141_C8", "label": "x, y, a =", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.8103, 0.0057, 2, 0.0, 0.6, 465, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "x, y, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x,y,a = st.x_list[i],st.y_list[i],st.a_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L142_C8", "label": "c_tl = tlTts()", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.8161, 0.0057, 2, 0.0, 0.7, 318, 3, 4, 0, 0, 23, 10, 1], "semantic": {"name": "c_tl", "arg_names": [], "import_names": [], "rhs_call_name": "tlTts", "annotation": ""}, "snippet": " c_tl = smc.tlTts(c_ts,x,y,a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L143_C8", "label": "cx_tl, cy_tl =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.8218, 0.0057, 2, 0.0, 0.8, 421, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "cx_tl, cy_tl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cx_tl,cy_tl = c_tl[0,0],c_tl[1,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L144_C8", "label": "vt, a = segway_motion_repulse()", "type": "assigned_variable", "loc": [144, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [14, 2, 0.8305, 0.0115, 2, 0.0, 0.9, 854, 3, 7, 0, 0, 681, 10, 1], "semantic": {"name": "vt, a", "arg_names": [], "import_names": [], "rhs_call_name": "segway_motion_repulse", "annotation": ""}, "snippet": " vt,a = smc.segway_motion_repulse(curr_pos_tl,cx_tl,cy_tl,cy_ts,\n start_pos_ts,eq_pt_tl,bndry)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L146_C8", "label": "print()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "vector": [8, 2, 0.8391, 0.0057, 2, 0.0, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('angle:',math.degrees(a))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L150_C0", "label": "argv =", "type": "assigned_variable", "loc": [150, 150], "level": 0, "parent": null, "vector": [14, 0, 0.8621, 0.0057, 0, 0.66, 0.44, 612, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "argv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "argv = sys.argv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L152_C0", "label": "fname =", "type": "assigned_variable", "loc": [152, 152], "level": 0, "parent": null, "vector": [14, 0, 0.8736, 0.0057, 0, 0.66, 0.48, 190, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "fname = argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L153_C0", "label": "d = load_pickle()", "type": "assigned_variable", "loc": [153, 153], "level": 0, "parent": null, "vector": [14, 0, 0.8793, 0.0057, 0, 0.66, 0.52, 355, 3, 1, 0, 0, 65, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "load_pickle", "annotation": ""}, "snippet": "d = ut.load_pickle(fname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L155_C0", "label": "st =", "type": "assigned_variable", "loc": [155, 155], "level": 0, "parent": null, "vector": [14, 0, 0.8908, 0.0057, 0, 0.66, 0.56, 93, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "st", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "st = d['segway']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L157_C0", "label": "ee_tl = joint_to_cartesian()", "type": "assigned_variable", "loc": [157, 157], "level": 0, "parent": null, "vector": [14, 0, 0.9023, 0.0057, 0, 0.66, 0.6, 121, 3, 1, 0, 0, 202, 10, 1], "semantic": {"name": "ee_tl", "arg_names": [], "import_names": [], "rhs_call_name": "joint_to_cartesian", "annotation": ""}, "snippet": "ee_tl = at.joint_to_cartesian(d['actual'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L158_C0", "label": "ee_ts = account_segway_motion()", "type": "assigned_variable", "loc": [158, 158], "level": 0, "parent": null, "vector": [14, 0, 0.908, 0.0057, 0, 0.66, 0.64, 748, 3, 2, 0, 0, 119, 10, 1], "semantic": {"name": "ee_ts", "arg_names": [], "import_names": [], "rhs_call_name": "account_segway_motion", "annotation": ""}, "snippet": "ee_ts = at.account_segway_motion(ee_tl,st)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L160_C0", "label": "eq_tl = joint_to_cartesian()", "type": "assigned_variable", "loc": [160, 160], "level": 0, "parent": null, "vector": [14, 0, 0.9195, 0.0057, 0, 0.66, 0.68, 450, 3, 1, 0, 0, 202, 10, 1], "semantic": {"name": "eq_tl", "arg_names": [], "import_names": [], "rhs_call_name": "joint_to_cartesian", "annotation": ""}, "snippet": "eq_tl = at.joint_to_cartesian(d['eq_pt'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L161_C0", "label": "eq_ts = account_segway_motion()", "type": "assigned_variable", "loc": [161, 161], "level": 0, "parent": null, "vector": [14, 0, 0.9253, 0.0057, 0, 0.66, 0.72, 310, 3, 2, 0, 0, 119, 10, 1], "semantic": {"name": "eq_ts", "arg_names": [], "import_names": [], "rhs_call_name": "account_segway_motion", "annotation": ""}, "snippet": "eq_ts = at.account_segway_motion(eq_tl,st)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L163_C0", "label": "bndry =", "type": "assigned_variable", "loc": [163, 163], "level": 0, "parent": null, "vector": [14, 0, 0.9368, 0.0057, 0, 0.66, 0.76, 913, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bndry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "bndry = d['bndry']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L164_C0", "label": "wrkspc_pts =", "type": "assigned_variable", "loc": [164, 164], "level": 0, "parent": null, "vector": [14, 0, 0.9425, 0.0057, 0, 0.66, 0.8, 547, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wrkspc_pts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wrkspc_pts = d['wrkspc']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L166_C0", "label": "rad_guess =", "type": "assigned_variable", "loc": [166, 166], "level": 0, "parent": null, "vector": [14, 0, 0.954, 0.0057, 0, 0.66, 0.84, 590, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "rad_guess", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "rad_guess = 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L167_C0", "label": "start_pos_ts =", "type": "assigned_variable", "loc": [167, 167], "level": 0, "parent": null, "vector": [14, 0, 0.9598, 0.0057, 0, 0.66, 0.88, 729, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start_pos_ts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "start_pos_ts = np.matrix(ee_ts.p_list[0]).T"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L168_C0", "label": "x_guess =", "type": "assigned_variable", "loc": [168, 168], "level": 0, "parent": null, "vector": [14, 0, 0.9655, 0.0057, 0, 0.66, 0.92, 547, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x_guess", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "x_guess = start_pos_ts[0,0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L169_C0", "label": "y_guess =", "type": "assigned_variable", "loc": [169, 169], "level": 0, "parent": null, "vector": [14, 0, 0.9713, 0.0057, 0, 0.66, 0.96, 583, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "y_guess", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "y_guess = start_pos_ts[1,0] - rad_guess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L171_C0", "label": "plot_single_point()", "type": "expression", "loc": [171, 171], "level": 0, "parent": null, "vector": [8, 0, 0.9828, 0.0057, 0, 0.66, 1.0, 710, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "plot_single_point", "arg_names": [], "import_names": [], "rhs_call_name": "plot_single_point", "annotation": ""}, "snippet": "plot_single_point()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:FunctionDef_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_99522:For_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_99522:Expr_L146_C8"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.