query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Another way of writing sumRangeTree(). | def sumRangeTree2(self, i, j, cur):
if i > j:
return 0
start, end = cur.start, cur.end
if i == start and j == end:
return cur.val
mid = start+(end-start)/2
return self.sumRangeTree(i, min(j, mid), cur.left) + self.sumRangeTree(max(mid+1, i), j, cur.right) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(self, start=0, end=None):\n return super(SumSegmentTree, self).reduce(start, end)",
"def sum(self, start=0, end=None):\n return super(SumSegmentTree, self).reduce(start, end)",
"def sum(self, start=0, end=None):\n return super(SumSegmentTree, self).reduce(start, end)",
"def sum(s... | [
"0.71868426",
"0.71868426",
"0.71868426",
"0.71868426",
"0.71868426",
"0.705735",
"0.6975686",
"0.64400923",
"0.6120142",
"0.6017725",
"0.6000797",
"0.5973236",
"0.59677756",
"0.59659654",
"0.5935009",
"0.5927427",
"0.59237933",
"0.590301",
"0.58825874",
"0.58753747",
"0.5873... | 0.7222721 | 0 |
Create commandline interface for bepasty server | def server_cli():
import argparse
parser = argparse.ArgumentParser(
description="The free and open-source paste bin and trash can "
"for your stuff.")
parser.add_argument('--host', help='Host to listen on')
parser.add_argument('--port', type=int, help='Port to listen on')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():",
"def cli():"... | [
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"0.7818622",
"... | 0.81359065 | 0 |
Build tweet per template | def build_tweet():
verb = conjugate(random.choice(verbs)['present'], tense=PARTICIPLE, parse=True).title()
animal = random.choice(animals).title()
food = random.choice(foods).title()
noun = random.choice(nouns).title()
band = food + " " + noun
track = verb + " " + animal
feature1 = clean_feature... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tweet(model):\n return model.make_short_sentence(140, init_state=None)",
"def command_tweet(self, bot, update):\n\n bot.sendChatAction(update.message.chat_id, action='typing')\n\n tweet = ext.get_last_tweet(self.config['twitter'])\n\n for url in tweet.get('images', []):\n ... | [
"0.60948175",
"0.60248387",
"0.6014052",
"0.5947185",
"0.5913232",
"0.5833311",
"0.57701683",
"0.5744864",
"0.5738893",
"0.5674448",
"0.5633637",
"0.5622764",
"0.5598165",
"0.55805904",
"0.55738026",
"0.5554688",
"0.5526183",
"0.5512599",
"0.5498815",
"0.549273",
"0.54506344"... | 0.6732809 | 0 |
Determines the angle between two vectors in radians. | def angleBetweenVectors(v1, v2):
v2Size = vectorLength(v2)
if not v2Size:
theta = 0.0
else:
theta = math.acos(dotProduct(v1, v2) / v2Size)
return theta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(v1: Vector, v2: Vector) -> float:\n return math.degrees(math.acos((v1 * v2) / (v1.length() * v2.length())))",
"def angle_between_vectors(a, b):\n return math.acos(dot_product(a, b) / (length(a) * length(b)))",
"def angle_between_vectors(vec1, vec2):\n vec = vec1 - vec2\n vec = vec.perpend... | [
"0.8463289",
"0.83694464",
"0.82129395",
"0.81972927",
"0.8167791",
"0.81210136",
"0.8113447",
"0.8101175",
"0.7991682",
"0.7979343",
"0.79449207",
"0.7923217",
"0.7904075",
"0.7887052",
"0.78713197",
"0.78628737",
"0.7862128",
"0.7843442",
"0.7840248",
"0.7828428",
"0.779511... | 0.8370501 | 1 |
Axial index used to be a letter A_Z but is now a number 0 through N. When axial index has to be represented as a single character (e.g. in some global flux solvers), ASCII characters listed in ``locations.AXIAL_CHARS`` are valid. | def setAxial(self, axialIndexOrChar):
if axialIndexOrChar is None:
axial = None
elif isinstance(axialIndexOrChar, int):
axial = axialIndexOrChar
elif isinstance(axialIndexOrChar, str):
# convert A to 0, B to 1, etc.
axial = AXIAL_CHARS.index(axialI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_letter_string(self, index):\n\t\treturn \"(\" + ALPHABET[index] + \")\"",
"def index_letter(self, index):\n\t\treturn ALPHABET[index]",
"def index_to_letter(index):\r\n return chr(index + CHAR_A)",
"def index_to_letter(index):\r\n return chr(index + CHAR_A)",
"def index_to_letter(idx):\r\n ... | [
"0.6998738",
"0.65743136",
"0.6407321",
"0.6407321",
"0.6346203",
"0.63291353",
"0.607212",
"0.5998704",
"0.595478",
"0.58217907",
"0.57854813",
"0.57854813",
"0.5782809",
"0.5766376",
"0.5766376",
"0.57074416",
"0.5702222",
"0.56296057",
"0.56263477",
"0.55768174",
"0.557623... | 0.70365703 | 0 |
Creates a label based on the location. Something in ring 3, position 10, axial slab 3 will get A3010C The original purpose of these labels to name DIF3D regions | def makeLabel(self):
self.setIndexNames()
if self.isInCore():
self.getFirstChar()
else:
# stick with what we have. (default:ExCore)
return
self.label = self.firstChar + "{0:03d}".format(self.i2)
if self.axial is not None:
# add ax... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_label(self, org, name):\n pass",
"def label(self, location, *args, **kwargs):\n\n if isinstance(location, fslimage.Image):\n return self.maskLabel(location, *args, **kwargs)\n else:\n return self.coordLabel(location, *args, **kwargs)",
"def _createLabel(ele... | [
"0.67211246",
"0.6673973",
"0.633395",
"0.6331166",
"0.63128114",
"0.6297906",
"0.6259464",
"0.62476516",
"0.6220286",
"0.6198769",
"0.6124117",
"0.60998416",
"0.60612845",
"0.6035275",
"0.60243773",
"0.59539634",
"0.59469193",
"0.594157",
"0.5931903",
"0.58967704",
"0.589548... | 0.6719417 | 1 |
Determines if another location is stacked with this one (for equivalence testing). | def isInSameStackAs(self, loc):
if self.i1 == loc.i1 and self.i2 == loc.i2:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def altloc_match(self, other: AtomKey) -> bool:\n ...",
"def is_standalone(self, prev_locations):\n if self._locations != prev_locations:\n return True\n elif self.size:\n return True\n elif self._count:\n return True\n return False",
"def is_... | [
"0.6210208",
"0.6191093",
"0.6158436",
"0.61319274",
"0.6059272",
"0.6009066",
"0.5975616",
"0.5886521",
"0.58241713",
"0.5813602",
"0.57885575",
"0.57864624",
"0.5772882",
"0.5749183",
"0.5728331",
"0.570694",
"0.5688356",
"0.5680987",
"0.5679803",
"0.5677977",
"0.5656998",
... | 0.7433343 | 0 |
Create a unique integer based on the location. Good for adding to SQL databases. | def uniqueInt(self):
# handle empty locations too
i1 = self.i1 or 0 # converts None to 0
i2 = self.i2 or 0
axial = self.axial or 0
return 100000 * i1 + i2 * 100 + axial | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unique_integer() -> int:\n return int(time.time())",
"def get_unique_id():\n global unique_id_increment\n if unique_id_increment is None:\n unique_id_increment = 0\n unique_id_increment += 1\n return '%d%d' % (int(time.time()), unique_id_increment)",
"def get_unique_id():\n global unique_i... | [
"0.7024165",
"0.6791223",
"0.6783102",
"0.6775156",
"0.66924566",
"0.65799814",
"0.65566194",
"0.6543326",
"0.64879113",
"0.64459807",
"0.64067906",
"0.6395806",
"0.638597",
"0.63709396",
"0.6355355",
"0.6352785",
"0.633911",
"0.633911",
"0.63278925",
"0.6318369",
"0.62925005... | 0.67935175 | 1 |
Set location parameters from a string label. given a label like A2034B, create a location. This allows the reverse of makeLabel to occur. Given a region name in REBUS, this can figure out where in the core it is. That's assuming someone set up the REBUS file according to our standards, of course. A "location label" is ... | def fromLabel(self, label):
indices = grids.ringPosFromRingLabel(label)
if indices is None:
# arbitrary label. excore.
# set it up as if it's a freshly initialized one
self.axial = None
self.i1 = None
self.i2 = None
self.label = la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromLabel(self, label):\n super(ThetaRZLocation, self).fromLabel(label)\n self.setIndexNames()",
"def parse_label(label):\n res = {}\n clazz, instance_num, room_type, room_num, area_num = label.split(\"_\")\n res['instance_class'] = clazz\n res['instance_num'] = int(instance_num)\n ... | [
"0.59817827",
"0.56128526",
"0.5599395",
"0.5440439",
"0.5334368",
"0.52304715",
"0.52238023",
"0.5210954",
"0.51974535",
"0.51771206",
"0.51623267",
"0.51530945",
"0.5145454",
"0.5141808",
"0.5139974",
"0.509622",
"0.5093017",
"0.5093017",
"0.5093017",
"0.5093017",
"0.509301... | 0.60761195 | 0 |
Determines the angle of this location compared to a targetPoint using a vector intersection point. The location object coordinates and targetPoint are used with the pointOfVectorIntersection to produce vectors. Using these vectors, the angle between them can be calculated | def getAngle(
self, targetPoint=None, pointOfVectorIntersection=None, pitch=1.0, degrees=False
):
if targetPoint is None:
targetPoint = (1, 0)
if pointOfVectorIntersection is None:
pointOfVectorIntersection = (0.0, 0.0)
# auto detect what the input is for au... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self, vector):\n\n return (math.degrees(math.acos((self.dot(vector) / (self.magnitude() *\n vector.magnitude())))))",
"def compute_magnitude_angle(target_location, current_location, orientation):\n target_vector = np.array([target_location.x - current_location.x, target_locatio... | [
"0.64799136",
"0.647734",
"0.647734",
"0.6443284",
"0.64311385",
"0.64204854",
"0.6387093",
"0.62500197",
"0.613536",
"0.6130012",
"0.61135167",
"0.6096707",
"0.6095966",
"0.60931104",
"0.60492647",
"0.6046155",
"0.60459244",
"0.6004682",
"0.5999813",
"0.59945816",
"0.5988180... | 0.711148 | 0 |
Return flag for which symmetry line this location is on. See Also armi.reactor.locations.HexLocation.isOnWhichSymmetryLine | def isOnWhichSymmetryLine(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isOnWhichSymmetryLine(self):\n\n if self.ring is None:\n return None\n else:\n if not self.ring % 2:\n # only odd numbered rings can cut lines of symmetry\n return None\n\n r = self.ring\n if self.pos == 1 and self.ring == ... | [
"0.7121941",
"0.581894",
"0.56253314",
"0.5582378",
"0.55553347",
"0.5417393",
"0.5401889",
"0.53997284",
"0.5375206",
"0.535163",
"0.527001",
"0.526488",
"0.5204078",
"0.51727873",
"0.5094293",
"0.5073102",
"0.5059118",
"0.5059118",
"0.50546885",
"0.5036034",
"0.50148326",
... | 0.8180103 | 0 |
Returns a list of what lines of symmetry this is on. If none, returns [] If on a line of symmetry in 1/6 geometry, returns a list containing a 6. If on a line of symmetry in 1/3 geometry, returns a list containing a 3. It seems that only the 1/3 core view geometry is actually coded in here right now. Ring Edge1 Edge2 E... | def isOnWhichSymmetryLine(self):
if self.ring is None:
return None
else:
if not self.ring % 2:
# only odd numbered rings can cut lines of symmetry
return None
r = self.ring
if self.pos == 1 and self.ring == 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isOnWhichSymmetryLine(self):\n return False",
"def box_line_coords(self):\n not_visited = set()\n for shape in self.shapes:\n for r, c in shape:\n # get points next to the numbers in one shape\n # and check which of them are inside the same shape too\n neighbors = [(r-1... | [
"0.55184925",
"0.5494297",
"0.5458612",
"0.5355712",
"0.53467077",
"0.53209454",
"0.5306617",
"0.52966756",
"0.52575386",
"0.5241793",
"0.52010435",
"0.5196177",
"0.5194133",
"0.5182174",
"0.51457137",
"0.5141249",
"0.51403695",
"0.5129814",
"0.5117967",
"0.5103351",
"0.50722... | 0.6415877 | 0 |
r""" Find the locations that are symmetric to this one in 1/3 geometry | def getSymmetricIdenticalsThird(self, ring=None, pos=None, locClass=None):
if not locClass:
locClass = HexLocation
if ring is None:
ring = self.ring
pos = self.pos
if ring == 1:
# nothing symmetric in the center.
return []
locs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSymmetricIdenticalsSixth(self, locClass=None):\n if not locClass:\n locClass = HexLocation\n if self.ring == 1:\n # nothing symmetric in the center.\n return []\n numInRing = (self.ring - 1) * 6\n locs = []\n pos = self.pos\n for oth... | [
"0.62458146",
"0.6060942",
"0.58728343",
"0.58118385",
"0.5767891",
"0.5737745",
"0.57198846",
"0.57054806",
"0.5698972",
"0.56779516",
"0.5644392",
"0.56243014",
"0.56172836",
"0.55952394",
"0.55813205",
"0.55694973",
"0.55663943",
"0.5552839",
"0.5523272",
"0.55181015",
"0.... | 0.6283957 | 0 |
Returns locations that are identical in 1/6 symmetry | def getSymmetricIdenticalsSixth(self, locClass=None):
if not locClass:
locClass = HexLocation
if self.ring == 1:
# nothing symmetric in the center.
return []
numInRing = (self.ring - 1) * 6
locs = []
pos = self.pos
for others_ in range(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSymmetricIdenticalsThird(self, ring=None, pos=None, locClass=None):\n\n if not locClass:\n locClass = HexLocation\n if ring is None:\n ring = self.ring\n pos = self.pos\n if ring == 1:\n # nothing symmetric in the center.\n return [... | [
"0.62497365",
"0.62153757",
"0.61411697",
"0.5895766",
"0.5860251",
"0.58532953",
"0.5850387",
"0.58068556",
"0.5788738",
"0.5746685",
"0.5743419",
"0.5695615",
"0.56498927",
"0.56372935",
"0.5614839",
"0.5592481",
"0.55778277",
"0.5570625",
"0.5544845",
"0.5539036",
"0.55261... | 0.6912941 | 0 |
Return The total number of positions in the specified number of rings. Notes a single pin counts as 1 ring. | def getNumPositions(self, rings=None):
if rings is None:
rings = self.ring
if rings == 0:
return 0
else:
return 1 + sum([6 * n for n in range(rings)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumPositions(self, rings=None):\n if rings is None:\n rings = self.i1\n return sum(self.getNumPosInRing(ringNum) for ringNum in range(rings + 1))",
"def getNumRings(self, nPins, silent=False):\n numPositions = 0\n for nRings in itertools.count(0):\n numPos... | [
"0.78359944",
"0.72448283",
"0.703219",
"0.6982429",
"0.67126626",
"0.6570651",
"0.64970434",
"0.6483523",
"0.62990856",
"0.6290666",
"0.61671436",
"0.61543256",
"0.61224073",
"0.6110513",
"0.6020392",
"0.5976255",
"0.59602314",
"0.5941542",
"0.5895465",
"0.5866224",
"0.58632... | 0.833412 | 0 |
Return number of positions in a ring. | def getNumPosInRing(self, ring=None):
ring = self.ring if ring is None else ring
return hexagon.numPositionsInRing(ring) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumPositions(self, rings=None):\n if rings is None:\n rings = self.ring\n\n if rings == 0:\n return 0\n else:\n return 1 + sum([6 * n for n in range(rings)])",
"def getNumPosInRing(self, ring=None):\n if ring is None:\n ring = self.i1... | [
"0.8357659",
"0.8136525",
"0.7998619",
"0.69955456",
"0.69430995",
"0.6908517",
"0.6795392",
"0.6793342",
"0.67530996",
"0.65375024",
"0.65120876",
"0.6493284",
"0.6392651",
"0.62449586",
"0.6241219",
"0.6127749",
"0.6121241",
"0.61179084",
"0.6058858",
"0.60364157",
"0.60056... | 0.8304132 | 1 |
Return how many pins in a line fit in the center of a hex w/ this many rings. | def getNumPinsInLine(self, rings=None):
if rings is None:
if self.ring < 1:
raise RuntimeError(
(
"Cannot determine number of pins in a hex "
"bundle of {0} (or no) rings"
).format(rings)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumPositions(self, rings=None):\n if rings is None:\n rings = self.ring\n\n if rings == 0:\n return 0\n else:\n return 1 + sum([6 * n for n in range(rings)])",
"def getNumHexRings(self):\n maxRing = 0\n for a in self.getAssemblies():\n ... | [
"0.66699535",
"0.6558768",
"0.6435356",
"0.6270405",
"0.62543476",
"0.6247514",
"0.6226219",
"0.61840016",
"0.61136687",
"0.61055857",
"0.6058961",
"0.5999586",
"0.599443",
"0.5987476",
"0.5986504",
"0.59715647",
"0.5971116",
"0.59693515",
"0.5941027",
"0.59054136",
"0.589764... | 0.76124454 | 0 |
Return The total number of positions in the specified number of rings. | def getNumPositions(self, rings=None):
if rings is None:
rings = self.i1
return sum(self.getNumPosInRing(ringNum) for ringNum in range(rings + 1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumPositions(self, rings=None):\n if rings is None:\n rings = self.ring\n\n if rings == 0:\n return 0\n else:\n return 1 + sum([6 * n for n in range(rings)])",
"def getNumRings(self, nPins, silent=False):\n numPositions = 0\n for nRings i... | [
"0.8152565",
"0.71420854",
"0.65844667",
"0.6574018",
"0.65679413",
"0.65298283",
"0.6493558",
"0.6441105",
"0.6432648",
"0.63853705",
"0.635927",
"0.6328833",
"0.61894596",
"0.617098",
"0.6140464",
"0.6115529",
"0.6115338",
"0.61119765",
"0.61049306",
"0.6093112",
"0.6089695... | 0.77500206 | 1 |
Return the number of rings required to hold a specific number of items, rounding up. | def getNumRings(self, nPins, silent=False):
numPositions = 0
for nRings in itertools.count(0):
numPositions += self.getNumPosInRing(nRings)
if not silent and numPositions > nPins:
runLog.warning(
"{0} does not fit exactly into a cartisian grid ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_rings(self) -> ir.IntegerValue:\n return ops.GeoNRings(self).to_expr()",
"def getNumAssembliesWithAllRingsFilledOut(self, nRings):\n if self.powerMultiplier == 1:\n return 3 * nRings * (nRings - 1) + 1\n else:\n return nRings * (nRings - 1) + (nRings + 1) // 2",
... | [
"0.6785125",
"0.6604789",
"0.64047396",
"0.63566506",
"0.63359237",
"0.6318129",
"0.63005334",
"0.6284139",
"0.62828654",
"0.61459106",
"0.6122018",
"0.60899526",
"0.60887045",
"0.608699",
"0.60788417",
"0.60709727",
"0.60583264",
"0.6051968",
"0.605083",
"0.605083",
"0.60508... | 0.661598 | 1 |
r""" use the general location method plus add mesh and Theta RZ specific labels | def __init__(self, i1=None, i2=None, axial=None, label=None, ThRZmesh=None):
Location.__init__(self, i1=i1, i2=i2, axial=axial, label=label)
if ThRZmesh is None:
ThRZmesh = Mesh()
self.ThRZmesh = ThRZmesh
self.setIndexNames() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromLabel(self, label):\n super(ThetaRZLocation, self).fromLabel(label)\n self.setIndexNames()",
"def main():\r\n location = gen_Location(\"0.856901647439813,14.08447265625\")\r\n add_location(location)",
"def _add_labels(self):\n coords = self['pore.coords']\n self['pore.... | [
"0.6317649",
"0.585874",
"0.57467073",
"0.5647766",
"0.55803794",
"0.54590195",
"0.5397135",
"0.53916276",
"0.5345478",
"0.530976",
"0.53041756",
"0.53031415",
"0.5296866",
"0.5258767",
"0.5255394",
"0.5248804",
"0.5224826",
"0.5224822",
"0.52057266",
"0.5200528",
"0.52001476... | 0.660631 | 0 |
Set ThetaRZ specific index labels. | def setIndexNames(self):
self.theta = self.i1
self.radial = self.i2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromLabel(self, label):\n super(ThetaRZLocation, self).fromLabel(label)\n self.setIndexNames()",
"def setIndexNames(self):\n self.xi = self.i1\n self.yi = self.i2",
"def set_varlabels(self, labels):\n self.set_thetagrids(np.degrees(theta) % FULL_CIRCLE_DEG, labels)",
... | [
"0.6511088",
"0.5818272",
"0.576118",
"0.55603635",
"0.5436589",
"0.53700703",
"0.5289422",
"0.52518785",
"0.52518785",
"0.52106553",
"0.51942176",
"0.5110152",
"0.50934106",
"0.50843704",
"0.50632054",
"0.5038733",
"0.5009693",
"0.49935243",
"0.49654624",
"0.49608228",
"0.49... | 0.6253748 | 1 |
This method returns the inner radial position of a ThetaRZ voxel given a ThetaR mesh object. | def radialInner(self):
if self.radial in range(1, len(self.ThRZmesh.getPositions(label="R"))):
R = self.ThRZmesh.getUpper(label="R", n=(self.radial - 1))
else:
runLog.warning(
"Error: Radial Index ({0}) location not INSIDE mesh ".format(
self.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Rcoords(self):\n if self.radial > 0 and self.radial < len(self.ThRZmesh.getPositions(label=\"R\")):\n R = (self.radialInner() + self.radialOuter()) / 2.0\n else:\n # n = 0\n runLog.warning(\n \"Error: Radial Index ({}) location not INSIDE mesh \".fo... | [
"0.7282279",
"0.7201485",
"0.61831576",
"0.60813785",
"0.6028813",
"0.5815439",
"0.5781952",
"0.5761667",
"0.57165694",
"0.5687706",
"0.56699616",
"0.5665975",
"0.5663215",
"0.56455314",
"0.5627842",
"0.56211036",
"0.5589331",
"0.5588282",
"0.5581857",
"0.55490565",
"0.554019... | 0.74131745 | 0 |
This method returns the outer radial position of a ThetaRZ voxel given a ThetaR mesh object. | def radialOuter(self):
if self.radial in range(1, len(self.ThRZmesh.getPositions(label="R"))):
R = self.ThRZmesh.getUpper(label="R", n=(self.radial))
else:
runLog.warning(
"Error: Radial Index ({0}) location not INSIDE mesh ".format(
self.radia... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Rcoords(self):\n if self.radial > 0 and self.radial < len(self.ThRZmesh.getPositions(label=\"R\")):\n R = (self.radialInner() + self.radialOuter()) / 2.0\n else:\n # n = 0\n runLog.warning(\n \"Error: Radial Index ({}) location not INSIDE mesh \".fo... | [
"0.7125406",
"0.71002066",
"0.62747943",
"0.6120533",
"0.6097724",
"0.607654",
"0.59881234",
"0.58473873",
"0.57180834",
"0.5704827",
"0.566809",
"0.5636048",
"0.5629548",
"0.5613639",
"0.557644",
"0.54943687",
"0.5480546",
"0.54482675",
"0.5424394",
"0.5413129",
"0.53982836"... | 0.7560898 | 0 |
This method returns the inner theta position of a ThetaRZ voxel given a ThetaR mesh object. | def thetaInner(self):
if self.theta in range(1, len(self.ThRZmesh.getPositions(label="Th"))):
Th = self.ThRZmesh.getUpper(label="Th", n=(self.theta - 1))
else:
runLog.warning(
"Error: Azimuthal Index ({0}) location not INSIDE mesh ".format(
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thetaOuter(self):\n if self.theta in range(1, len(self.ThRZmesh.getPositions(label=\"Th\"))):\n Th = self.ThRZmesh.getUpper(label=\"Th\", n=(self.theta))\n else:\n runLog.warning(\n \"Error: Azimuthal Index ({}) location not INSIDE mesh \".format(\n ... | [
"0.6630596",
"0.6424146",
"0.6071748",
"0.6050471",
"0.600254",
"0.5967101",
"0.59149945",
"0.59070295",
"0.58497214",
"0.58067834",
"0.57926005",
"0.57720226",
"0.56903493",
"0.5669455",
"0.56661713",
"0.56590486",
"0.5624296",
"0.56221735",
"0.56156856",
"0.56049436",
"0.55... | 0.6993555 | 0 |
r""" This method returns the outer axial position of a ThetaRZ voxel given a ThetaR mesh object. | def axialOuter(self):
if (self.axial + 1) in range(1, len(self.ThRZmesh.getPositions(label="Z"))):
Z = self.ThRZmesh.getUpper(label="Z", n=(self.axial + 1))
else:
Z = None
return Z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thetaOuter(self):\n if self.theta in range(1, len(self.ThRZmesh.getPositions(label=\"Th\"))):\n Th = self.ThRZmesh.getUpper(label=\"Th\", n=(self.theta))\n else:\n runLog.warning(\n \"Error: Azimuthal Index ({}) location not INSIDE mesh \".format(\n ... | [
"0.68936497",
"0.6560676",
"0.6394544",
"0.63219684",
"0.62390727",
"0.58117783",
"0.5798798",
"0.5795946",
"0.5742741",
"0.5741311",
"0.5704633",
"0.5686745",
"0.568073",
"0.56681323",
"0.55657804",
"0.5525685",
"0.55239004",
"0.55157137",
"0.5465294",
"0.54573554",
"0.54339... | 0.68375695 | 1 |
Returns the labels of the dimensions in the mesh. | def getLabelDimensions(self):
return self.di.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names(self):\n labels = [\n \"$X_{%i}$\" % i if d.name is None else d.name\n for i, d in enumerate(self.dimensions)\n ]\n return labels",
"def dimensions(self):\n return self.index.names",
"def get_labels_dim(self):\n return self._labels_dim",
"def... | [
"0.72637033",
"0.68515235",
"0.6682234",
"0.6613478",
"0.6604454",
"0.6381695",
"0.6367715",
"0.63247997",
"0.6315191",
"0.62962365",
"0.6281614",
"0.62760186",
"0.627592",
"0.6243439",
"0.6237088",
"0.62207276",
"0.620294",
"0.6191751",
"0.6182558",
"0.6182558",
"0.6182558",... | 0.7873832 | 0 |
Get the upper and lower interface indexes for a given position in a given direction. p is the position in the direction labeled label is the string name of the target directions label. | def getUpperLowerFromPosition(self, p=None, label=None, sigma=1e-7):
if p in self.getPositions(label=label):
return self.i[label].index(p), self.i[label].index(p)
elif p < self.i[label][0]:
# print "Warning: position %1.5E is less than lowest interface %1.5E" % (p, self.i[label]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getHints(self, p):\n st = bisect.bisect_left(self.index, (p[:self.ln], -1)) # binary search\n en = bisect.bisect_right(self.index, (p[:self.ln], sys.maxsize)) # binary search\n hits = self.index[st:en] # this range of elements corresponds to the hits\n return [h[1] for h in hit... | [
"0.6324813",
"0.6253533",
"0.5891413",
"0.5788384",
"0.57837796",
"0.57529134",
"0.5609169",
"0.5490516",
"0.54635316",
"0.5432897",
"0.54275876",
"0.5405196",
"0.53873837",
"0.53132135",
"0.52961534",
"0.52618384",
"0.5260172",
"0.52562886",
"0.52412254",
"0.5230476",
"0.521... | 0.6967462 | 0 |
Returns the closest position in the mesh in the direction labeled, label. | def getClosestUpperFromPosition(self, p=None, label=None):
if p in self.i[label]:
return self.i[label].index(p)
else:
"""
i = 0
self.i[label][i]-p
self.di[label][i]
len(self.i[label])
while math.fabs(self.i[label][i]-p) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest(self, x, y):\n if self.direction == 'horizontal':\n p_pts = np.array([\n self.ax.transData.transform((p, 0))[0] for p in self.positions\n ])\n dist = abs(p_pts - x)\n else:\n p_pts = np.array([\n self.ax.transDa... | [
"0.65582526",
"0.65224594",
"0.6244395",
"0.6199202",
"0.6145905",
"0.6081921",
"0.606061",
"0.6050791",
"0.60445505",
"0.60442203",
"0.60038483",
"0.59851193",
"0.59771705",
"0.59656155",
"0.59408677",
"0.5915831",
"0.5915236",
"0.5867023",
"0.5846827",
"0.58420783",
"0.5822... | 0.69311005 | 0 |
This ensures that 0 is included in the mesh. Notes If the mesh includes both negative and positive values it doesn't need to have a 0 position, otherwise its inferred that you need a 0 position and this helps you generated it | def checkMesh(self, label=None):
if (
(self.i[label][0] > 0 and self.i[label][-1] > 0)
or (self.i[label][0] < 0 and self.i[label][-1] < 0)
and (0 not in self.i[label])
):
# the mesh is entirely on one side of 0
# these meshes should include 0 s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self):\n return -0.0001 <= self.l2_norm() <= 0.0001",
"def is_zero(self):\n return self._x == 0 and self._y == 0",
"def fill_inversion_params_with_zeroes(self, mesh: str):\n self.print(\"Filling inversion parameters with zeros before interpolation\")\n m = UnstructuredMe... | [
"0.6254785",
"0.6186705",
"0.6138065",
"0.60941976",
"0.6073013",
"0.60097027",
"0.5987608",
"0.5926205",
"0.5853711",
"0.58208245",
"0.5761038",
"0.5748615",
"0.5727632",
"0.5721085",
"0.5668829",
"0.5668325",
"0.564378",
"0.56428957",
"0.56372184",
"0.5633147",
"0.5608266",... | 0.6728365 | 0 |
r""" This method returns a list of location objects for each node bound by the positions in the mesh. I['R'][r+1] | | | | I['Th'][t]| Location | I['Theta'][t+1] |[t+1][r+1]| | | I['R'][r] | def getThRLocations(self):
# check directions for see there is an R and Th direction
if not self.checkThR():
runLog.warning(
"Warning both R and Th are not present in mesh object with dimensions:"
)
runLog.warning(self.getLabelDimensions())
lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_locations(self):\n nodes = self.tree.xpath(self.pattern.xpath_locations)\n seq_num = 0\n\n locations = []\n for node in nodes:\n content = self.create_content(node)\n\n if content:\n location = self.create_location(content, seq_num, node)\... | [
"0.6618079",
"0.6527927",
"0.6109717",
"0.61025333",
"0.60694295",
"0.6053455",
"0.6053455",
"0.6053455",
"0.6053455",
"0.6053455",
"0.6053455",
"0.6053455",
"0.60492766",
"0.603168",
"0.6012175",
"0.6000774",
"0.59812146",
"0.59701073",
"0.59687734",
"0.5960518",
"0.595469",... | 0.6940613 | 0 |
This method returns the 'sense' of a cartesian point (x, y) with respect to the line. The sense of a point is useful in establishing whethor or not a point is within a defined area or volume. | def sense(self, cartesian):
s = self.coefficients["c"]
s += (
self.coefficients["x1"] * cartesian[0]
+ self.coefficients["x2"] * cartesian[0] ** 2
)
s += (
self.coefficients["y1"] * cartesian[1]
+ self.coefficients["y2"] * cartesian[1] ** 2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_point_on_same_line(self, x, y = None):\n x, y = y is not None and (x, y) or (x[0], x[1])\n\n if self.is_vertical():\n return Point(x, 0) == Point(self.x_value, 0)\n else:\n return Point(0, y) == Point(0, (self.slope * x + self.y_intercept))",
"def get_line_to(self, point):\n... | [
"0.6265008",
"0.6254346",
"0.62422544",
"0.6135268",
"0.60971963",
"0.60836",
"0.59429014",
"0.59167194",
"0.5840409",
"0.5839907",
"0.5788277",
"0.57632977",
"0.5640327",
"0.5615897",
"0.5610789",
"0.5569186",
"0.55678105",
"0.5563124",
"0.55512923",
"0.5525684",
"0.55169255... | 0.685466 | 0 |
This method returns the a list of yvalues that satisfy the polynomial equation of this line by using the quadratic formula. | def getY(self, x=0):
if x is not None:
a = self.coefficients["y2"]
b = self.coefficients["y1"]
c = (
self.coefficients["c"]
+ self.coefficients["x2"] * x ** 2.0
+ self.coefficients["x1"] * x
)
return sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(self):\n return np.array([f.y for f in self])",
"def _evalPoly(self,a,x):\n y = a[0]\n for i in range(1,len(a)):\n y = self.F.Multiply(y, x)\n y = self.F.Add(y, a[i])\n return y",
"def _get_y_data(self):\n return self.y(self.xs)",
"def findCurveP... | [
"0.6556135",
"0.6517135",
"0.6504373",
"0.64845735",
"0.6423199",
"0.64126337",
"0.62985796",
"0.6206773",
"0.61390865",
"0.6117417",
"0.60555995",
"0.60376716",
"0.6018107",
"0.60169095",
"0.5979119",
"0.5953779",
"0.5949011",
"0.59465456",
"0.59437364",
"0.5935174",
"0.5913... | 0.72871864 | 0 |
This method solves the quadratic equation (ax2 + bx + c = 0). | def quadratic(self, a, b, c):
if a == 0 and b == 0:
return ["inf"]
elif a == 0 and b != 0:
# form b*y + c = 0
return [-c / b]
elif (b ** 2 - 4 * a * c) > 0:
# standard quadradic formula
return [
(-b + (b ** 2 - 4.0 * a *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve_quadratic_equation(a,b,c):\r\n delta = b**2 - 4 * a * c\r\n if delta < 0:\r\n raise ValueError(\"No real solution...that shouldn't happen!\")\r\n return (-b + math.sqrt(delta)) / (2*a)",
"def quadratic(x, a, b, c):\n y = a*(x**2)+b*x+c\n return y",
"def solve_qua... | [
"0.72369456",
"0.70616657",
"0.67198884",
"0.65623784",
"0.6488663",
"0.64569885",
"0.6435781",
"0.6256174",
"0.6213656",
"0.61620814",
"0.6144481",
"0.60154337",
"0.60110354",
"0.5966011",
"0.5963172",
"0.5883623",
"0.58819634",
"0.58721876",
"0.58536726",
"0.5849846",
"0.58... | 0.7332248 | 0 |
Choose a location class. | def locationFactory(geomType):
options = {
geometry.CARTESIAN: CartesianLocation,
geometry.RZT: ThetaRZLocation,
geometry.HEX: HexLocation,
geometry.DODECAGON: HexLocation, # yes, it's same as hex. That's what we want.
geometry.RZ: ThetaRZLocation,
# database names..... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locate(cls):",
"def choose_class(self, *args, **kwargs):",
"def chose_location(locations):\n from x84.bbs import getterminal, getsession, echo\n session, term = getsession(), getterminal()\n assert len(locations) > 0, (\n u'Cannot chose from empty list')\n msg_chosecity = (\n term... | [
"0.5996128",
"0.5883574",
"0.58471626",
"0.56989455",
"0.5609373",
"0.55592173",
"0.5501813",
"0.54509795",
"0.5449028",
"0.5448276",
"0.53725255",
"0.53585374",
"0.53317344",
"0.52982783",
"0.5295488",
"0.5286329",
"0.5261022",
"0.52430373",
"0.52430373",
"0.5215791",
"0.520... | 0.6361395 | 0 |
Replace a column with noise to assess the strength of contribution of the column to label prediction. The noise is emulated by shuffling the entries for that column among the training examples. | def __replace_by_noise(self, c):
n = self.X_train_raw.shape[0]
temp = []
for r in xrange(0, n):
temp.append(self.X_train_raw[r][c])
shuffle(temp)
for r in xrange(0, n):
self.X_train_raw[r][c] = temp[r] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random(self):\n self.img[:, :] = np.random.random(\n (self.l_i, self.l_i)).astype('float32')\n self.img_name = 'white_noise'",
"def noise_data(self, x):\n return x + np.random.normal(size=x.shape)",
"def add_noise(self, noise):\n if noise > 0.0:\n for key in self.cou... | [
"0.5988903",
"0.59598",
"0.590609",
"0.57277614",
"0.57145876",
"0.5714144",
"0.5711432",
"0.5634764",
"0.56272036",
"0.5507284",
"0.55022585",
"0.54810095",
"0.5469157",
"0.54663897",
"0.54596573",
"0.54058903",
"0.53850126",
"0.5377809",
"0.5366829",
"0.5341979",
"0.5324725... | 0.711703 | 0 |
Trains the model on supplied training matrix and labels, writes prediction probabilities on the supplied test matrix to csv, and the prediction probabilities on the supplied train matrix to csv. | def __train_and_predict(self, X_train, y, X_test):
self.model.fit(X_train, y, eval_metric='auc')
prediction_probs = self.model.predict_proba(X_train)[:, 1]
print "Training auc = %f" % roc_auc_score(y, prediction_probs)
self.__write_csv(prediction_probs,
X_train.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export(self, output_dir, config, train_ratio=0.7, delimiter=\",\"):\n model_dir = os.path.join(output_dir, self.model_id)\n if not os.path.exists(model_dir):\n os.makedirs(model_dir)\n X_tr, X_te = self.get_train_test_embeddings(config, train_ratio)\n #save text feature m... | [
"0.65510637",
"0.63779694",
"0.62342954",
"0.61135745",
"0.6075837",
"0.6062978",
"0.5990648",
"0.59453905",
"0.5926214",
"0.59246117",
"0.5884959",
"0.58760256",
"0.585197",
"0.5836809",
"0.5830251",
"0.58029145",
"0.57644784",
"0.5763364",
"0.5762627",
"0.57573175",
"0.5750... | 0.6449975 | 1 |
Write ID, Action to csv file. The Action field contains probability of being assigned label 1 (resource allocated). | def __write_csv(self, prediction_probs, n, filename):
d = {'Id': pd.Series([i for i in xrange(1, n + 1)]),
'Action': pd.Series(prediction_probs)}
df = pd.DataFrame(d)
df = df[['Id', 'Action']]
df.to_csv(filename, sep=',', encoding='utf-8',
index=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_csv_submission(ids, y_pred, name):\n # negative class has to be labelled -1 on AIcrowd\n y_pred[y_pred == 0] = -1\n\n with open(name, 'w') as csvfile:\n fieldnames = ['Id', 'Prediction']\n writer = csv.DictWriter(csvfile, delimiter=\",\", fieldnames=fieldnames)\n writer.wri... | [
"0.68681693",
"0.6816269",
"0.67624056",
"0.67624056",
"0.67624056",
"0.67624056",
"0.67624056",
"0.67624056",
"0.67370194",
"0.64254487",
"0.6161451",
"0.61238325",
"0.6109003",
"0.6069585",
"0.6030102",
"0.5964162",
"0.5964162",
"0.5964162",
"0.5938529",
"0.59271914",
"0.58... | 0.709905 | 0 |
Show status and info of the site | def status():
header(title="Site Status", domain_name=domain_name)
if not client.site_exists:
site_404_message(config.get("domain"))
footer()
return
print("---")
print("URL : %s " % client.domain_url)
print("---")
print("S3"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_status():\n\n pass",
"def status():\n _request('worklog/status/')",
"def status(ctx):\n return show_network_status()",
"def show_site_info(site_name):\n\n site = Site.query.filter_by(route_name=site_name).first()\n site_url = site.url\n sites = Site.query.all()\n return render_t... | [
"0.73023087",
"0.67248327",
"0.6704658",
"0.64546615",
"0.6453813",
"0.6376519",
"0.6359933",
"0.6337041",
"0.6296282",
"0.62759244",
"0.6192674",
"0.61913586",
"0.6190519",
"0.6175519",
"0.6174978",
"0.6163833",
"0.61583126",
"0.61315286",
"0.61184186",
"0.6109961",
"0.60995... | 0.77343816 | 0 |
_useSystemRandomSeeds_ Initiate RandomNumberServiceHelper seed using random.SystemRandom to have different seeds every time one runs cmsRun. | def useSystemRandomSeeds(process):
from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
randSvc.populate()
return process | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Randomize(seed=None):\n random.seed()",
"def fix_seeds(\n seed=90,\n set_system=True,\n set_torch=True,\n set_torch_cudnn=True):\n # set system seed\n if set_system:\n np.random.seed(seed)\n random.seed(seed)\n\n # set torch seed\n if set_torch:\n torch.manual_... | [
"0.6733194",
"0.6593241",
"0.657669",
"0.65404934",
"0.6516633",
"0.65164447",
"0.6451129",
"0.64149135",
"0.6390287",
"0.6385595",
"0.63583344",
"0.63481086",
"0.6323737",
"0.63221604",
"0.63139325",
"0.6270637",
"0.6264015",
"0.62521476",
"0.62347686",
"0.62287563",
"0.6201... | 0.81655914 | 0 |
_registerAndParseArgument_ Register and parse a new command line argument. Return VarParsing object. | def registerAndParseArgument(name):
from FWCore.ParameterSet.VarParsing import VarParsing
options = VarParsing ('analysis')
options.register(name, 0, VarParsing.multiplicity.singleton,VarParsing.varType.int,name)
options.parseArguments()
return options | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseCommandLine_(self):\n\n self.ensureNotCreated()\n\n import sys\n\n parseCommandLine = False\n for argv in sys.argv:\n if 'globalTag' in argv or 'era' in argv or 'process' in argv:\n parseCommandLine = True\n break\n\n if parseComm... | [
"0.61728984",
"0.6039481",
"0.60203767",
"0.595231",
"0.5830286",
"0.58095735",
"0.57876027",
"0.5778621",
"0.5761353",
"0.57371855",
"0.56799173",
"0.56612575",
"0.5622618",
"0.5615951",
"0.5581082",
"0.55726534",
"0.5553292",
"0.5553292",
"0.5552925",
"0.5537481",
"0.551956... | 0.70281136 | 0 |
Whether this batch system supports hot deployment of the user script and toil itself. If it does, | def supportsHotDeployment():
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_only_when_stable(self):\n return os.getenv(\"CONAN_UPLOAD_ONLY_WHEN_STABLE\", \"True\").lower() in [\"true\", \"1\", \"yes\"]",
"def in_runtime(self):\n\n return self.is_valid_platform() and self['ENVIRONMENT']",
"def can_tag(self):\n try:\n self.cork.require(role='be... | [
"0.59080213",
"0.59014416",
"0.58744884",
"0.583592",
"0.58353484",
"0.5770853",
"0.57476896",
"0.5713006",
"0.56976587",
"0.5685558",
"0.5679075",
"0.56761354",
"0.5657924",
"0.56475234",
"0.5641038",
"0.56297976",
"0.5614099",
"0.5551707",
"0.5551392",
"0.55467737",
"0.5542... | 0.7684038 | 0 |
Kills the given job IDs. | def killBatchJobs(self, jobIDs):
raise NotImplementedError('Abstract method: killBatchJobs') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def killall(self):\n\n for job_id, job in self.jobs:\n backend.kill( job )",
"def terminateJobs(self, ids):\n #WARNING: terminateJobs modifies the running queue, which\n # fillJobQueue assumes can't happen\n queues = [self.__queue, self.__clientQueue, self.__running, self.__clientRunni... | [
"0.71423835",
"0.70896417",
"0.6958512",
"0.6607421",
"0.65567875",
"0.63717175",
"0.634498",
"0.6316935",
"0.63062066",
"0.62952507",
"0.6210749",
"0.6210224",
"0.6130301",
"0.61195964",
"0.6089505",
"0.60764474",
"0.60468537",
"0.60391694",
"0.60391694",
"0.6034868",
"0.602... | 0.77569884 | 0 |
Gets a job that has updated its status, according to the job manager. Max wait gives the number of seconds to pause waiting for a result. If a result is available returns (jobID, exitValue) else it returns None. Does not return anything for jobs that were killed. | def getUpdatedBatchJob(self, maxWait):
raise NotImplementedError('Abstract method: getUpdatedBatchJob') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_job_status(jobid, wait=30):\n cmd = \"scontrol show job {0}\".format(jobid)\n try:\n output = subprocess.check_output(cmd, shell=True)\n m = re.search(\"JobState=(\\w+)\", output)\n except subprocess.CalledProcessError:\n m = False\n\n status = None\n if m:\n stat... | [
"0.7061948",
"0.64877015",
"0.6281469",
"0.6281305",
"0.62647986",
"0.61325854",
"0.6069798",
"0.6040532",
"0.6026728",
"0.6021482",
"0.5993392",
"0.59638715",
"0.5939754",
"0.5939131",
"0.5922706",
"0.58912677",
"0.578576",
"0.57589465",
"0.57437074",
"0.5733509",
"0.5724052... | 0.6496207 | 1 |
Indicates whether the batch system supports the cleanup of workers on shutdown | def supportsWorkerCleanup():
raise NotImplementedError('Abstract method') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutting_down(self):\n return self._shutdown.is_set()",
"def _in_multi_worker_mode(self):\n return False",
"def shutdown(self):\n\n raise NotImplementedError",
"def on_shutdown():\n\n dependency.shutdown = True # Send shutdown signal to threads\n pool.shutdown() # Clear any non-proce... | [
"0.64880085",
"0.6321251",
"0.62147343",
"0.615483",
"0.6056144",
"0.60121",
"0.5967699",
"0.5894933",
"0.5865676",
"0.5861183",
"0.58568704",
"0.5841655",
"0.58318484",
"0.58307207",
"0.58307207",
"0.5826173",
"0.58243054",
"0.58243054",
"0.5785461",
"0.5784891",
"0.5750325"... | 0.7566826 | 0 |
Add new options to a chart (method merges current options dictionary with the new one) To see what options you can add see Chart.js reference | def add_options(self, options):
self.options = merge_dicts(self.options, options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_options(self):\n self.add_option_save()\n self.add_option_enable()",
"def set_options(self, options):\n self.options = options",
"def set_options(self, options):\n self.options = options",
"def options(self, options):\n\n self._options = options",
"def options(self, o... | [
"0.62127596",
"0.6206315",
"0.6120101",
"0.6055289",
"0.6055289",
"0.60318744",
"0.5998325",
"0.5915124",
"0.5797642",
"0.5778926",
"0.56731147",
"0.56369275",
"0.56278706",
"0.5510768",
"0.5476411",
"0.5449409",
"0.54406136",
"0.54177994",
"0.5390977",
"0.53765523",
"0.53680... | 0.7116716 | 0 |
Create Dataset object out of JSON. | def dataset_from_json(json_data, label='', border_color=Color.DEFAULT_COLOR, settings=None):
if settings is None or not isinstance(settings, dict):
settings = {}
json_data = json.loads(json_data)
try:
return Dataset(
label=label,
arguments=json_data['arguments'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_json(url: URL, data: JsonDict) -> UnifiedDataset:\n cp = deepcopy(data)\n return UnifiedDataset(\n url,\n name=cp[\"name\"],\n description=cp.get(\"description\"),\n key_attribute_names=tuple(cp[\"keyAttributeNames\"]),\n )",
"def from_json(data: Dict[str, Any]) -> ... | [
"0.76634896",
"0.67382026",
"0.65945363",
"0.6544209",
"0.6420733",
"0.64172965",
"0.6387566",
"0.6356376",
"0.6267794",
"0.624005",
"0.6219303",
"0.6147498",
"0.6137764",
"0.61078167",
"0.6095902",
"0.6086496",
"0.60748947",
"0.60668117",
"0.6061267",
"0.605603",
"0.60260636... | 0.75412256 | 1 |
Checks, if the path of a figure to its target position is clear. | def path_clear(self, board, move, target_row, target_col):
if not (target_row > 7 or target_row < 0 or target_col > 7 or target_col < 0):
row_step = np.sign(move[0])
col_step = np.sign(move[1])
sq_cov = not any(board.status[self.field_row + i * row_step,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wall_cleared(self):\n\n # Did we make progress?\n if self.distance_from_goal >= self.best_distance:\n return False\n \n #self.best_distance = self.distance_from_goal\n\n # Are we far enough from the wall,\n # so that we don't switch back immediately\n ... | [
"0.60310495",
"0.5940462",
"0.5855814",
"0.5840895",
"0.5771076",
"0.5756367",
"0.5753545",
"0.574017",
"0.5731048",
"0.572563",
"0.5681641",
"0.56763905",
"0.56761026",
"0.5662323",
"0.5650444",
"0.5630062",
"0.5579302",
"0.5577852",
"0.5577646",
"0.5575347",
"0.55417365",
... | 0.6286603 | 0 |
Set up a document object, which takes SAX events and outputs an XML log file | def __init__(self, output, encoding='utf-8'):
document = XMLGenerator(output, encoding)
document.startDocument()
self._document = document
self._output = output
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, source, log_dir):\n\n # This just waits until the XML comes through\n self.xml = {}\n self.xml['text'] = source.readline()\n self.xml['dom'] = minidom.parseString(self.xml['text'])\n\n # Parse into packet data - element names are unique in child nodes\n ... | [
"0.5888466",
"0.57663083",
"0.57663083",
"0.56682104",
"0.5654016",
"0.5493169",
"0.54837483",
"0.54823536",
"0.5439083",
"0.543009",
"0.5423934",
"0.54202414",
"0.5371418",
"0.53513527",
"0.5340369",
"0.5305417",
"0.528152",
"0.5279575",
"0.5266488",
"0.526221",
"0.52445966"... | 0.5995555 | 0 |
Do greenery analysis. Returns | def green_analysis(self, pbar=None):
green_dict = {
'green': [],
'lat': [],
'long': [],
}
# print("Doing greenery analysis..")
for panorama in self.panoramas:
green_frac = panorama.green_analysis(seg_model=self.seg_model,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analysis(self, game_info):\n pass",
"def analyze(self, event):\n jets = Collection(event, self.jetBranchName )\n genJets = Collection(event, self.genJetBranchName )\n rho = getattr(event, self.rhoBranchName )\n if not self.hasMass:\n backupJ... | [
"0.597375",
"0.5893538",
"0.5887358",
"0.58862436",
"0.582039",
"0.58140844",
"0.58028257",
"0.58003294",
"0.57060623",
"0.5657604",
"0.56512094",
"0.55669314",
"0.55543363",
"0.55528617",
"0.5526435",
"0.5524408",
"0.5516431",
"0.5506277",
"0.54833543",
"0.54607606",
"0.5458... | 0.60110736 | 0 |
calculateCoefficients3 (x_logs, derivatives, coefficients) Takes a 4 n by d numpy arrays x_logs, z_logs x_derivatives and z_derivatives and an n by 1 arrays x_log_eigenval calculate the sum of the elementwise products of the pairs of differences for each array (mutliplied by the log eigenvector for the derivatives), wr... | def calculateCoefficientsTrainExp(np.ndarray[double, ndim=2, mode="c"] x_logs not None, np.ndarray[double, ndim=2, mode="c"] derivatives not None, np.ndarray[double, ndim=1] x_log_eigenvals not None, np.ndarray[double, ndim=2, mode="c"] coefficients not None):
cdef int n, dd, d
n, dd = x_logs.shape[0], x_logs.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def d_coefficients(x1,x2,x3,CCoefficients):\n\tDCoefficients = np.array([\t(CCoefficients[1]-CCoefficients[0])/(3*(x2-x1)), \\\n\t\t\t\t\t\t\t\t(CCoefficients[2]-CCoefficients[1])/(3*(x3-x2))\t], \\\n\t\t\t\t\t\t\t\tfloat)\n\treturn(DCoefficients)",
"def formula_3(x: np.ndarray) -> np.ndarray:\n logx = ... | [
"0.64648616",
"0.58611566",
"0.5490139",
"0.54560053",
"0.54490906",
"0.5435314",
"0.5421935",
"0.5414191",
"0.53015965",
"0.53014183",
"0.52694964",
"0.5241518",
"0.5229148",
"0.5213135",
"0.5170937",
"0.5141193",
"0.51295483",
"0.5104361",
"0.5061877",
"0.50323045",
"0.4996... | 0.69780946 | 0 |
Expand a matrix to a list, columnmajor order | def matrix_to_column_list(m):
return np.ravel(m, order='F').tolist() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toList(self, rowmajor=0):\r\n if rowmajor:\r\n return copy.copy(self.mlist)\r\n else:\r\n return self.transpose().mlist",
"def transpose(matrix: List[List[float]]) -> List[List[float]]:\n return [[row[i] for row in matrix] for i in range(len(matrix[0]))]",
"def as... | [
"0.70554304",
"0.7006818",
"0.6980326",
"0.6864629",
"0.68487316",
"0.6762847",
"0.6762687",
"0.6647433",
"0.6642187",
"0.66243964",
"0.6624076",
"0.6613602",
"0.6612342",
"0.6540967",
"0.6506698",
"0.6475164",
"0.6453326",
"0.6416239",
"0.6409073",
"0.6401994",
"0.63960433",... | 0.7527268 | 0 |
Return the 3x3 rotation matrix around the specified axis (0, 1, or 2) | def rotation_matrix3(axis, theta):
R = np.eye(3)
c = math.cos(theta)
s = math.sin(theta)
a1 = (axis + 1) % 3
a2 = (axis + 2) % 3
R[a1, a1] = c
R[a1, a2] = -s
R[a2, a1] = s
R[a2, a2] = c
return np.matrix(R) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix_3x3_axis(angle, axis):\n assert axis.lower() in ['x','y','z']\n assert -180.0 <= angle <= 180.0\n angle_r = angle * (np.pi / 180.0)\n sa = np.sin(angle_r)\n ca = np.cos(angle_r)\n\n if axis == 'x':\n R = np.array([ [1, 0, 0],\n [0, ca, -sa],\n... | [
"0.8405892",
"0.80142015",
"0.80082905",
"0.7910554",
"0.7863072",
"0.77934295",
"0.7754999",
"0.759178",
"0.7467054",
"0.74107707",
"0.73978674",
"0.7268829",
"0.72499263",
"0.7171435",
"0.70944816",
"0.70641387",
"0.70350474",
"0.6999859",
"0.6960819",
"0.69501597",
"0.6948... | 0.81351817 | 1 |
Return the homogenous equation of a line passing through a and b, i.e. [ax, ay, 1] cross [bx, by, 1] | def homo_line(a, b):
return (a[1] - b[1], b[0] - a[0], a[0] * b[1] - a[1] * b[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_equation(x1, y1, x2, y2):\n \n a = y2 - y1\n b = x1 - x2\n c = x2*y1 - x1*y2\n return a, b, c",
"def line_equation_ap(angle, (x1, y1)):\n \n # get second point on the line\n x2 = float(x1) + cos(angle)\n y2 = float(y1) + sin(angle)\n \n # return A, B and C coefficients\n... | [
"0.777192",
"0.7146663",
"0.7076748",
"0.6732991",
"0.67144316",
"0.6585918",
"0.648618",
"0.63435245",
"0.63301736",
"0.62468535",
"0.6166858",
"0.61655104",
"0.60787904",
"0.6066258",
"0.60494155",
"0.60408294",
"0.60364074",
"0.6025432",
"0.60175955",
"0.6004877",
"0.59829... | 0.7446203 | 1 |
Returns the closest orthogonal matrix to m (closest as measured by Frobenius norm) | def orthogonalize_matrix(m):
U, __, VT = np.linalg.svd(np.matrix(m))
return np.dot(U, VT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def near_orthog(m):\n w = np.linalg.svd(m)\n return(w[0].dot(w[2]))",
"def _orthonormalize_matrix(m, tol=1.0e-12):\n U, s, _ = linalg.svd(m, full_matrices=False)\n n_eig = np.count_nonzero(s > tol)\n return np.ascontiguousarray(U[:, :n_eig])",
"def orthonormalize_matrix(m, tol=1.e-12):\n U, s... | [
"0.77767456",
"0.6731712",
"0.6652642",
"0.6421101",
"0.62515134",
"0.60407734",
"0.60164875",
"0.5884548",
"0.58717716",
"0.5776818",
"0.57625395",
"0.567006",
"0.56655455",
"0.56310695",
"0.55886936",
"0.5588333",
"0.55631244",
"0.55291814",
"0.5509131",
"0.54576945",
"0.54... | 0.7224864 | 1 |
Return whether line p0,p1 intersects triangle t0,t1,t2. Containment counts as intersection. | def triangle_segment_intersects(t0, t1, t2, p0, p1):
# if all 3 vertices are on the same side of the line, there is no
# intersection
s = line_ccw(p0, p1, t0)
if s == line_ccw(p0, p1, t1) and s == line_ccw(p0, p1, t2):
return False
# if the line is outside one of the triangle half-planes, t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle_point_intersects(a, b, c, s):\n return (\n line_ccw(a, b, c) == line_ccw(a, b, s) and\n line_ccw(b, c, a) == line_ccw(b, c, s) and\n line_ccw(c, a, b) == line_ccw(c, a, s)\n )",
"def intersects(self, other_line):\n intpt= self.intersection(other_line)\n retur... | [
"0.7306243",
"0.72227615",
"0.7161451",
"0.71520704",
"0.70743865",
"0.70308924",
"0.7012665",
"0.6979272",
"0.69551086",
"0.68963045",
"0.6870862",
"0.6832165",
"0.68220353",
"0.6649794",
"0.66347224",
"0.6630576",
"0.65994567",
"0.6586173",
"0.6536912",
"0.65100837",
"0.650... | 0.8177159 | 0 |
Return whether point s intersects triangle a,b,c. | def triangle_point_intersects(a, b, c, s):
return (
line_ccw(a, b, c) == line_ccw(a, b, s) and
line_ccw(b, c, a) == line_ccw(b, c, s) and
line_ccw(c, a, b) == line_ccw(c, a, s)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def where_points_in_triangle(pts, v1, v2, v3):\n b1 = cross_pts_triangle(pts, v1, v2) < 0.0\n b2 = cross_pts_triangle(pts, v2, v3) < 0.0\n b3 = cross_pts_triangle(pts, v3, v1) < 0.0\n\n return np.logical_and((b1 == b2), (b2 == b3))",
"def is_triangle(a, b, c):\n a, b, c = sorted([a, b, c])\n re... | [
"0.7345902",
"0.72236496",
"0.7217699",
"0.7139119",
"0.71018434",
"0.70482326",
"0.70330894",
"0.6771672",
"0.66973406",
"0.6659407",
"0.6651804",
"0.6645966",
"0.6528279",
"0.64862823",
"0.6458506",
"0.64554816",
"0.64136153",
"0.6383226",
"0.63754004",
"0.6373912",
"0.6353... | 0.89081365 | 0 |
Return whether segment ab intersects cd where a, b, c, d are point tuples. | def segment_segment_intersects(a, b, c, d):
return (line_ccw(a, c, d) != line_ccw(b, c, d) and
line_ccw(a, b, c) != line_ccw(a, b, d)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersects_segment(\n self, a: Tuple[float, float], b: Tuple[float, float]\n ) -> bool:\n assert len(a) == 2\n assert len(b) == 2\n return bool(lib.cpBBIntersectsSegment(self, a, b))",
"def intersects(a, b, c, d):\n return ccw(a, c, d) != ccw(b, c, d) and ccw(a, b, c) != ccw... | [
"0.75393575",
"0.7391978",
"0.7128614",
"0.6865891",
"0.6748342",
"0.6744874",
"0.6556149",
"0.6550652",
"0.6538529",
"0.65320754",
"0.6440685",
"0.6399224",
"0.6391955",
"0.6376926",
"0.6367248",
"0.63279766",
"0.6293335",
"0.6287129",
"0.62630624",
"0.6201244",
"0.6192818",... | 0.77020717 | 0 |
Return the distance from segment (x1, y1, x2, y2) to point (px, py) | def segment_point_distance_sq(x1, y1, x2, y2, px, py):
pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)
if pd2 == 0:
# Points are coincident.
x = x1
y = y2
else:
# parameter of closest point on the line
u = ((px - x1) * (x2 - x1) + (py - y1) * (y2 - y1)) / pd2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distance(pt1,pt2):\r\n x1 = pt1[1]\r\n y1 = pt1[0]\r\n x2 = pt2[1]\r\n y2 = pt2[0]\r\n d = np.sqrt((x2-x1)**2 + (y2-y1)**2)\r\n return d",
"def distance_to(self, point1, point2):\n delta_x = self.x_points[point1] - self.x_points[point2]\n delta_y = self.y_points[point1] - ... | [
"0.74034303",
"0.73640394",
"0.73103666",
"0.7294698",
"0.7283167",
"0.72539985",
"0.7240832",
"0.7202821",
"0.71799296",
"0.71412796",
"0.71334606",
"0.71322614",
"0.71294546",
"0.71276414",
"0.7082285",
"0.7061353",
"0.7038455",
"0.7029878",
"0.7022735",
"0.6959474",
"0.693... | 0.7446288 | 0 |
Return true if the bbox contains or partially intersects segment a. | def bbox_segment_intersects(bbox, a, b):
# check whether the line is completely left/right/above/below the bbox
if ((a[0] < bbox[0] and b[0] < bbox[0]) or
(a[0] > bbox[2] and b[0] > bbox[2]) or
(a[1] < bbox[1] and b[1] < bbox[1]) or
(a[1] > bbox[3] and b[1] > bbox[2])):
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersects_segment(\n self, a: Tuple[float, float], b: Tuple[float, float]\n ) -> bool:\n assert len(a) == 2\n assert len(b) == 2\n return bool(lib.cpBBIntersectsSegment(self, a, b))",
"def has_intersection(bboxa, bboxb):\n yamin, xamin, ha, wa = bboxa\n ybmin, xbmin, hb,... | [
"0.75345826",
"0.684739",
"0.6468728",
"0.6411044",
"0.63948536",
"0.63697517",
"0.6360881",
"0.6358078",
"0.6333877",
"0.6333793",
"0.6324441",
"0.6304301",
"0.6261146",
"0.6251937",
"0.6216856",
"0.61753935",
"0.6174581",
"0.615982",
"0.6148548",
"0.6109364",
"0.6099023",
... | 0.7556597 | 0 |
Return the indices of the query segments that intersect any of the triangles, but none of the segments. vertices are a list of point tuples, segments are lists of tuples of indices into vertices, and triangles are lists of tuples of indices into vertices. query_segments are a list of point tuples [((x1, y1), (x2, y2)),... | def triangles_segments_intersections_only(
vertices, segments, triangles, query_segments):
from shapes.utils import bbox_vertices
bbox = bbox_vertices(vertices)
ret = []
for (idx, (a, b)) in enumerate(query_segments):
if not bbox_segment_intersects(bbox, a, b):
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundary_vertices(points: np.ndarray, triangles: np.ndarray) -> np.ndarray:\n tri = Triangulation(points[:, 0], points[:, 1], triangles)\n boundary_edges = set()\n for i, neighbors in enumerate(tri.neighbors):\n for k in range(3):\n if neighbors[k] == -1:\n boundary_ed... | [
"0.5972745",
"0.543406",
"0.5326901",
"0.526298",
"0.51526606",
"0.5126452",
"0.5099092",
"0.5095259",
"0.507421",
"0.5058259",
"0.50499004",
"0.50402725",
"0.50085044",
"0.49585858",
"0.48946553",
"0.4889193",
"0.48876017",
"0.48748028",
"0.48681682",
"0.48640105",
"0.485326... | 0.8313237 | 0 |
Return the area of the triangle defined by ``[a, b, c]``, where each vertex contains floats ``[x, y]`` | def triangle_area(a, b, c):
return 0.5 * abs(
a[0] * (b[1] - c[1]) +
b[0] * (c[1] - a[1]) +
c[0] * (a[1] - b[1])
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangleArea(a: Vec3, b: Vec3, c: Vec3) -> float:\n return cross3(b - a, c - a).length() / 2.0",
"def compute_triangle_area(a,b,c):\n ab = np.sqrt( ((a-b)**2).sum() )\n ac = np.sqrt( ((a-c)**2).sum() )\n bc = np.sqrt( ((b-c)**2).sum() )\n \n s = (ab+ac+bc)/2\n area = np.sqrt(s*(s-ab)*(s-... | [
"0.84191346",
"0.8271097",
"0.7881103",
"0.7828473",
"0.7608223",
"0.7597579",
"0.7597544",
"0.7516894",
"0.73595786",
"0.7270853",
"0.7270003",
"0.7252681",
"0.7234488",
"0.72305065",
"0.7196257",
"0.716151",
"0.71598786",
"0.7150997",
"0.7081849",
"0.70540684",
"0.701454",
... | 0.8303363 | 1 |
Returns the most parallel vector to v, from the set w. The vector must also be at least as parallel as the tolerance. If nothing is that parallel, None is returned. All vectors are assumed to be unit length. | def most_parallel_vector(v, vectors, tolerance_dot=0.0):
best_dot = tolerance_dot
best_w = None
for w in vectors:
d = abs_dot(v, w)
if d > best_dot:
best_dot = d
best_w = w
return best_w | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def most_orthogonal_vector(v, vectors, tolerance_dot=1.0):\n\n best_dot = tolerance_dot\n best_w = None\n for w in vectors:\n d = abs_dot(v, w)\n if d < best_dot:\n best_dot = d\n best_w = w\n return best_w",
"def closest_composed(self, w_vectors, n=10):\r\n ... | [
"0.67746544",
"0.61196345",
"0.58692086",
"0.5829938",
"0.58223855",
"0.5793613",
"0.5684239",
"0.5602485",
"0.5524231",
"0.5515962",
"0.54816973",
"0.54682237",
"0.54557616",
"0.54237735",
"0.5404921",
"0.5347673",
"0.53475606",
"0.5344588",
"0.53420705",
"0.5317936",
"0.531... | 0.8011415 | 0 |
Returns the most orthogonal vector to v, from the set w. The vector must also be at least as orthogonal as the tolerance. If nothing is that orthogonal, None is returned. All vectors are assumed to be unit length. | def most_orthogonal_vector(v, vectors, tolerance_dot=1.0):
best_dot = tolerance_dot
best_w = None
for w in vectors:
d = abs_dot(v, w)
if d < best_dot:
best_dot = d
best_w = w
return best_w | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orthogonal(v):\n return np.array([-v[1], v[0]])",
"def orthogonalize(*vlist, orthonormal=False):\n\n if not all(isinstance(vec, Vector) for vec in vlist):\n raise TypeError('Each element must be of Type Vector')\n\n ortho_vlist = []\n for i, term in enumerate(vlist):\n for j in rang... | [
"0.67741066",
"0.6380468",
"0.62507844",
"0.61287045",
"0.60421896",
"0.5899978",
"0.5876221",
"0.5853856",
"0.5655817",
"0.560325",
"0.55841815",
"0.55465436",
"0.5517424",
"0.54806405",
"0.5453591",
"0.54417384",
"0.54243976",
"0.5406809",
"0.54068065",
"0.5386803",
"0.5348... | 0.782882 | 0 |
Completes any missing orthogonal triplets in a set of unit vectors. Returns the completed set of vectors. | def complete_vector_triplets(vectors, tolerance_dot=0.90630778703):
new_vectors = copy.copy(vectors)
if len(vectors) >= 2:
for i1, v1 in enumerate(vectors):
for v2 in vectors[:i1]:
v = normalized_cross(v1, v2)
if all(abs_dot(v, v3) < tolerance_dot for v3 in n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clifford_set(u):\n i, x, y, z = u.v\n result = []\n result.append(u.clone()) # I\n result.append(Uop(-x, i, -z, y, u.hierarchy, u.construction + [\"X\"], gateset=u.gateset)) # iX, but treat it as X due to only phase difference\n result.append(Uop((i-x)/SQRT2, (x+i)/SQRT2, (y-z)/SQRT2, (z+y)/SQRT... | [
"0.5495328",
"0.53125536",
"0.5294284",
"0.5276602",
"0.5242003",
"0.5139609",
"0.5106146",
"0.50740355",
"0.50630456",
"0.4960766",
"0.4878924",
"0.4877205",
"0.48581728",
"0.4829856",
"0.4798165",
"0.47981212",
"0.47862396",
"0.4785782",
"0.47827455",
"0.47827455",
"0.47799... | 0.6494852 | 0 |
Simplify a polyline based on the RamerDouglasPeucker Algorithm | def simplify_polyline_epsilon(points, epsilon):
raise NotImplementedError("TODO: test this code")
if len(points) < 3:
return points
begin, end = points[0], points[-1]
dist_sq = [segment_point_distance_sq(
begin[0], begin[1], end[0], end[1], p[0], p[1])
for p in points[1:-1]]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfold_wire(pl):\n\tpl = phone_pl\n\tshape_points = [np.array(p) for p in pl.points]\n\tpointIter = takeNGenerator(shape_points, 4)\n\td0 = getDistance(*shape_points[0:2])\n\tpoints = [np.array([0, 0]), np.array([0, d0])]\n\tfor i in range(len(shape_points)-3):\n\t\t(p1,p2,p3,p4) = pointIter.next()\n\t\tv1 =p1... | [
"0.62449044",
"0.6192112",
"0.5876959",
"0.5750502",
"0.5733133",
"0.5681934",
"0.5504439",
"0.5495337",
"0.54806966",
"0.5476194",
"0.5447982",
"0.5435657",
"0.5420936",
"0.5408061",
"0.54056406",
"0.54032993",
"0.53878033",
"0.5366727",
"0.5362038",
"0.53492206",
"0.5333261... | 0.64948124 | 0 |
SVG transform to zoom into bbox | def bbox_svg_transform(box):
return u"scale(%s,%s) translate(%s,%s)" % (
1.0 / (box[2] - box[0]),
1.0 / (box[3] - box[1]),
-box[0], -box[1],
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_transform(self):\n\n self.a = self.scale * self.pixel_size * math.cos(self.angle)\n self.d = self.scale * self.pixel_size * math.sin(self.angle)\n self.b = self.d\n self.e = -self.a\n self.c = self.point.x() - self.a*self.width/2.0 - self.b*self.height/2.0\n sel... | [
"0.6242887",
"0.61897826",
"0.59136367",
"0.58786815",
"0.581519",
"0.574324",
"0.5739371",
"0.57170194",
"0.5653899",
"0.56526536",
"0.56382596",
"0.5617384",
"0.55872774",
"0.5554871",
"0.5543525",
"0.5526807",
"0.5450559",
"0.54197973",
"0.541918",
"0.5416707",
"0.54059505... | 0.7238493 | 0 |
Calculate the centerofmass motion from Horizons.h5 and/or Matter.h5 Note that no input checking is done here. If the data sets are missing, incomplete, or corrupted, you should expect to get exceptions or silently incorrect data. | def com_motion(path_to_horizons_h5, path_to_matter_h5=None, m_A=None, m_B=None):
import numpy as np
import h5py
if path_to_matter_h5 is None:
# BBH
with h5py.File(path_to_horizons_h5, "r") as horizons:
t = horizons["AhA.dir/ChristodoulouMass.dat"][:, 0]
m_A = horizon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_center_of_mass(self):\n xyz = \"\"\"O 1.28706525 0.52121353 0.04219198\nC 0.39745682 -0.35265044 -0.63649234\nC 0.36441173 -1.68197093 0.08682400\nH -0.59818222 0.10068325 -0.65235399\nH 0.74799641 -0.48357798 -1.66461710\nH 0.03647269 ... | [
"0.5902895",
"0.583829",
"0.5833728",
"0.57325655",
"0.5730314",
"0.57017994",
"0.5638729",
"0.560713",
"0.5570779",
"0.54860926",
"0.5484837",
"0.54624414",
"0.54074883",
"0.53962797",
"0.53906804",
"0.53897077",
"0.536566",
"0.53606135",
"0.53544843",
"0.5353757",
"0.534776... | 0.7317755 | 0 |
Calculate optimal translation and boost from Horizons.h5 This returns the optimal initial position and velocity such that the CoM is best approximated as having these initial values. If the coordinate system is transformed by these values, the new CoM motion will be as close to the origin as possible (in the sense of s... | def estimate_avg_com_motion(
path_to_horizons_h5="Horizons.h5",
skip_beginning_fraction=0.01,
skip_ending_fraction=0.10,
plot=False,
fit_acceleration=False,
path_to_matter_h5=None,
m_A=None,
m_B=None,
):
import os.path
import numpy as np
from scipy.integrate import simps
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manipulate_heat_data(self): \n self.exh.T_array = ( 0.5 * (self.exh.T_inlet_array +\n self.exh.T_outlet_array) + 273.15)\n self.exh.delta_T_array = ( self.exh.T_inlet_array -\n self.exh.T_outlet_array )\n \n self.cool.delta_T_array = ( self.cool.T_inlet_array -... | [
"0.52292186",
"0.52045137",
"0.5110948",
"0.50985026",
"0.5072936",
"0.5069401",
"0.49927002",
"0.4992098",
"0.49894857",
"0.49852642",
"0.4974302",
"0.4967319",
"0.49585414",
"0.4943341",
"0.49405524",
"0.49302322",
"0.4927587",
"0.49260393",
"0.4911043",
"0.4897999",
"0.489... | 0.54184324 | 0 |
Rewrite waveform data in centerofmass frame This simply uses `estimate_avg_com_motion`, and then transforms to that frame as appropriate. Most of the options are simply passed to that function. Note, however, that the path to the Horizons.h5 file defaults to the directory of the waveform H5 file. Additional parameters | def remove_avg_com_motion(
w_m=None,
path_to_waveform_h5="rhOverM_Asymptotic_GeometricUnits.h5/Extrapolated_N2.dir",
path_to_horizons_h5=None,
skip_beginning_fraction=0.01,
skip_ending_fraction=0.10,
plot=False,
file_write_mode="w",
path_to_matter_h5=None,
m_A=None,
m_B=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_avg_com_motion(\n path_to_horizons_h5=\"Horizons.h5\",\n skip_beginning_fraction=0.01,\n skip_ending_fraction=0.10,\n plot=False,\n fit_acceleration=False,\n path_to_matter_h5=None,\n m_A=None,\n m_B=None,\n):\n import os.path\n import numpy as np\n from scipy.integrat... | [
"0.6088319",
"0.5814272",
"0.54723537",
"0.5261382",
"0.5132528",
"0.5102374",
"0.5068886",
"0.4986752",
"0.48696637",
"0.48406386",
"0.4835095",
"0.48325104",
"0.47684312",
"0.47626117",
"0.47490016",
"0.4720668",
"0.46825162",
"0.46747053",
"0.46692675",
"0.46567562",
"0.46... | 0.6393003 | 0 |
Retrieve the ItopapiTeam related to this instance | def find_team(self):
if self.team_id is not None:
return ItopapiPrototype.get_itop_class('Team').find(self.team_id)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTeam(self):\n return self.team",
"def get_team_info(self, id):\n params = {'key': self.key, 'start_at_team_id': id,\n 'teams_requested': 1}\n r = requests.get(self.TEAM_URL, params=params)\n return TeamResponse(r.json()['result']['teams'][0])",
"def get_team(... | [
"0.7549989",
"0.72300076",
"0.72153294",
"0.7191924",
"0.7166498",
"0.7157937",
"0.70628184",
"0.7051131",
"0.67465943",
"0.67198193",
"0.6711095",
"0.66625315",
"0.6601764",
"0.6539297",
"0.6510861",
"0.6504781",
"0.63860065",
"0.63829774",
"0.6346589",
"0.62430656",
"0.6213... | 0.7681342 | 0 |
Set the ItopapiTeam parameters | def set_team(self, team):
self.team_id = team.instance_id
self.team_id_friendlyname = team.friendlyname
self.team_name = team.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TeamCityParamSetter(keyName, value):\n print(\"##teamcity[setParameter name='{}' value='{}']\".format(keyName, value))",
"def set_team(self, team):\n self.team = team.upper()",
"def test_update_team(self):\n pass",
"def __init__(self, team: Team):\n if team is not None:\n ... | [
"0.6172809",
"0.60664916",
"0.5939748",
"0.591911",
"0.5844137",
"0.5844137",
"0.5844137",
"0.5844137",
"0.57071877",
"0.5691884",
"0.5687925",
"0.5633751",
"0.5569473",
"0.5567563",
"0.5539624",
"0.5538041",
"0.55226094",
"0.55067205",
"0.55022925",
"0.5499877",
"0.5437115",... | 0.627334 | 0 |
Test the capacity factor calculation. | def test_capacity_factor(pudl_out_eia):
print("\nCalculating generator capacity factors...")
cf = pudl_out_eia.capacity_factor()
print(f" capacity_factor: {len(cf)} records") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _capacity_rule(self, prod_name, r, cap, m, t):\n prod = getattr(m, prod_name)\n # note that a negative capacity means a CONSUMPTION capacity instead of PRODUCTION\n if cap > 0:\n return prod[r, t] <= cap\n else:\n return prod[r, t] >= cap",
"def _check_capacity_limit(self, res, amt, bal... | [
"0.68881196",
"0.68120736",
"0.67808044",
"0.6761478",
"0.6641522",
"0.6589486",
"0.6583583",
"0.65829414",
"0.6571818",
"0.65542054",
"0.64312893",
"0.6392681",
"0.6384535",
"0.6331468",
"0.62974155",
"0.62774104",
"0.62548894",
"0.62530494",
"0.62508786",
"0.62183774",
"0.6... | 0.7961699 | 0 |
Test whether dataframe has a single record per generator. | def single_records(df,
key_cols=['report_date', 'plant_id_eia', 'generator_id']):
len_1 = len(df)
len_2 = len(df.drop_duplicates(subset=key_cols))
return bool(len_1 == len_2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at_least_one_row(data):\n if len(data) >= 1:\n print('The dataframe has at least one row')\n else:\n print('The dataframe has least than one row')",
"def has_full_batch(self) -> bool:",
"def hasgenerator(self):\n\t\treturn self.G is not None",
"def __has_frequency_one(self):\n ... | [
"0.6431298",
"0.61375654",
"0.6087329",
"0.59722954",
"0.59278995",
"0.59018725",
"0.5842105",
"0.5797196",
"0.5791878",
"0.57786185",
"0.5716865",
"0.5700458",
"0.56931096",
"0.5691002",
"0.5655603",
"0.5649057",
"0.5647898",
"0.56356096",
"0.5594769",
"0.55854803",
"0.55537... | 0.71713555 | 0 |
Creates and saves CSV of influencers (users with valid email and within followers threshold) | def get_influencer_csv(csv):
df = pd.read_csv(csv)
df = df[(df.Followers > MIN_FOLLOWERS) & (df.Followers < MAX_FOLLOWERS)]
df = df.dropna(subset=['Email'])
csv_name = csv.replace('.csv', '') + '_influencers.csv'
df.to_csv(csv_name, index=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_followers(self) -> None:\n with open(self.graphfile, 'a') as gf:\n writer = csv.writer(gf)\n follower_count = len(self.get_user_followers(''))\n date = datetime.datetime.now()\n\n # Append the current date and follower count to the file\n writer... | [
"0.6047169",
"0.5955431",
"0.5650356",
"0.56064004",
"0.547113",
"0.5463337",
"0.5421362",
"0.54036814",
"0.5393949",
"0.53560907",
"0.5353108",
"0.5289865",
"0.5286661",
"0.52687407",
"0.52441347",
"0.5222444",
"0.51837975",
"0.5179807",
"0.5141002",
"0.5126686",
"0.5118382"... | 0.63366747 | 0 |
Main function for collecting profile and influencer information from a provided hashtag. For each hashtag in HASHTAGS go through NUM_PICTURES pictures and extract the profile information associated with them. Save the user information to a CSV and then of those user find the influencers and copy them to an additional | def main():
for hashtag in HASHTAGS:
start = time.time()
print("Getting profile info for #" + hashtag)
bot = InstagramBot(headless=HEADLESS, proxy=PROXY, threads=THREADS)
profile_links = bot.get_users(num_pictures=NUM_PICTURES, hashtag=hashtag)
profile_links_divided = list(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n # Load the API credentials\n with open('./flickr_api.txt') as f:\n keys = yaml.safe_load(f)\n\n # Set the API credentials\n flickr = flickrapi.FlickrAPI(keys['key'], keys['secret'])\n\n # Load the data\n df = pd.read_csv('./beauty-icwsm15-dataset.tsv', sep=\"\\t\", index_co... | [
"0.54673195",
"0.5459365",
"0.545394",
"0.54220074",
"0.53685695",
"0.534908",
"0.5343947",
"0.53140295",
"0.52589434",
"0.5250817",
"0.52376914",
"0.52369225",
"0.52006066",
"0.51993096",
"0.5187037",
"0.5185133",
"0.517963",
"0.51486",
"0.51440156",
"0.5128374",
"0.5113084"... | 0.6377655 | 0 |
Upgrade the strings in setting_values dependent on saved revision | def upgrade_settings(self, setting_values, variable_revision_number,
module_name, from_matlab):
return setting_values, variable_revision_number, from_matlab | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upgrade_settings(self, setting_values, variable_revision_number, module_name):\n if variable_revision_number < 2:\n setting_values = [IF_IMAGE, \"None\"] + setting_values\n if variable_revision_number < 3:\n setting_values[11] = BIT_DEPTH_FLOAT\n return setting_values... | [
"0.68198603",
"0.63423276",
"0.57808906",
"0.5656196",
"0.5642929",
"0.54664826",
"0.54023135",
"0.53713864",
"0.53115004",
"0.5286524",
"0.5274161",
"0.5229369",
"0.5191988",
"0.5175165",
"0.5146829",
"0.5144369",
"0.5144369",
"0.51223385",
"0.51142377",
"0.510358",
"0.51004... | 0.69602877 | 0 |
Apply the smoothing filter to the image | def smooth_image(self, image, mask):
filter_size = self.smoothing_filter_size.value
if filter_size == 0:
return image
sigma = filter_size / 2.35
#
# We not only want to smooth using a Gaussian, but we want to limit
# the spread of the smoothing to 2 S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_smoothing(image, kernel_size=3):\n return cv2.GaussianBlur(image, (kernel_size, kernel_size), 0)",
"def scipy_smooth(img, sigma=5):\n return ndimage.gaussian_filter(img, sigma=sigma)",
"def apply_filter(self, image):\n pass",
"def smoothImage(img):\n # Pillow uses RGB and cv2 uses G... | [
"0.78445184",
"0.7379917",
"0.7321194",
"0.7239354",
"0.71112967",
"0.7050554",
"0.70387703",
"0.6970035",
"0.67471266",
"0.6743551",
"0.6713033",
"0.66244715",
"0.6569757",
"0.6532625",
"0.649057",
"0.64129514",
"0.6408223",
"0.63947046",
"0.6379447",
"0.63546807",
"0.634057... | 0.7451357 | 1 |
Filter out objects touching the border In addition, if the image has a mask, filter out objects touching the border of the mask. | def filter_on_border(self, image, labeled_image):
return labeled_image
"""
if self.exclude_border_objects.value:
border_labels = list(labeled_image[0,:])
border_labels.extend(labeled_image[:,0])
border_labels.extend(labeled_image[labeled_image.shape[0]-1,:])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object_mask(self, image_id):\n image_info = self.image_meta[image_id]\n active_class_info = image_info['active_class_info']\n object_cnt = len(active_class_info)\n mask = np.zeros([image_info['height'], image_info['width'], object_cnt], dtype=np.uint8)\n for i, (object_, ... | [
"0.66159254",
"0.65550196",
"0.65348953",
"0.6339501",
"0.6339501",
"0.63048273",
"0.6243106",
"0.621593",
"0.6176488",
"0.6145113",
"0.61296153",
"0.61296153",
"0.61296153",
"0.60756546",
"0.60579914",
"0.60273397",
"0.60134697",
"0.59805304",
"0.59338665",
"0.5905175",
"0.5... | 0.7511416 | 0 |
Return the measurements that this module produces object_name return measurements made on this object (or 'Image' for image measurements) category return measurements made in this category | def get_measurements(self, pipeline, object_name, category):
result = self.get_object_measurements(pipeline, object_name, category,
{self.object_name.value: [] })
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_measurement_objects(self, pipeline, object_name, category, \n measurement):\n return self.get_threshold_measurement_objects(pipeline, object_name,\n category, measurement)",
"def unit_of_measurement(self) -> str:\n... | [
"0.651813",
"0.63402045",
"0.63073176",
"0.63073176",
"0.62911433",
"0.6128462",
"0.6035708",
"0.5499387",
"0.549304",
"0.54343456",
"0.5424742",
"0.5333495",
"0.532847",
"0.5316836",
"0.52300084",
"0.5221325",
"0.5207531",
"0.5196124",
"0.51641935",
"0.50457776",
"0.5033502"... | 0.70396924 | 0 |
Visualize respiration (RSP) data | def rsp_plot(rsp_signals, sampling_rate=None, figsize=(10, 10)):
# Mark peaks, troughs and phases.
peaks = np.where(rsp_signals["RSP_Peaks"] == 1)[0]
troughs = np.where(rsp_signals["RSP_Troughs"] == 1)[0]
inhale = np.where(rsp_signals["RSP_Phase"] == 1)[0]
exhale = np.where(rsp_signals["RSP_Phase"] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resultPlots(record):\n record.createDataFrames()\n \n atmPlot(record)\n clientPlot(record)\n transactionPlot(record)",
"def rsp_plot(rsp_signals, sampling_rate=None, figsize=(10, 10), static=True):\n # Mark peaks, troughs and phases.\n peaks = np.where(rsp_signals[\"RSP_Peaks\"] == 1)[0]... | [
"0.61561173",
"0.6091286",
"0.6047193",
"0.5946579",
"0.57804394",
"0.57516813",
"0.5737721",
"0.57349676",
"0.5730596",
"0.5722353",
"0.5673061",
"0.5668867",
"0.5654061",
"0.5641195",
"0.5629452",
"0.5624017",
"0.56236935",
"0.56032646",
"0.56025904",
"0.56011355",
"0.55980... | 0.61377776 | 1 |
Determine corners of target zone. | def get_target_zone_corners(self):
EL2 = self._zone_length / 2
self.c1_position = self.apply(self.zone_pose, (-EL2, -EL2, 0))
self.c2_position = self.apply(self.zone_pose, (-EL2, EL2, 0))
self.c3_position = self.apply(self.zone_pose, ( EL2, EL2, 0))
self.c4_position = self.appl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def corners(self):\n return self._corners",
"def get_corners(self):\n lon, lat = self.coordinates\n \n ll = (lon[0][0],lat[0][0])\n ul = (lon[-1][0],lat[-1][0])\n ur = (lon[-1][-1],lat[-1][-1])\n lr = (lon[0][-1],lat[0][-1])\n\n return (ll, ul, ur, lr)",
"def... | [
"0.68820864",
"0.68006533",
"0.67631537",
"0.67604804",
"0.672879",
"0.6661667",
"0.6606441",
"0.6605549",
"0.6551869",
"0.6500144",
"0.63675636",
"0.632952",
"0.6311998",
"0.6289283",
"0.62708",
"0.62133706",
"0.6206103",
"0.6177628",
"0.6134029",
"0.61161554",
"0.6113622",
... | 0.80798656 | 0 |
Add a cable like Andy does it in his cable environment. Add each `part_id` to (a) env.objects, (b) object_points, (c) _IDs, and (d) cable_bead_IDs. For (b) it is because, like the sweeping env, the demonstrator detects the one farthest from the goal to use as the pick, and `object_points` is also used to tally up items... | def add_cable(self, env, size_range, info={}, cable_idx=0,
direction='z', max_force=100):
num_parts = self.num_parts
radius = self.radius
length = self.length
color = self.colors[cable_idx] + [1]
color_end = U.COLORS['yellow'] + [1]
# Add beaded cable.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_cable_ring(self, env, info={}, cable_idx=0):\n def rad_to_deg(rad):\n return (rad * 180.0) / np.pi\n\n def get_discretized_rotations(num_rotations):\n # counter-clockwise\n theta = i * (2 * np.pi) / num_rotations\n return (theta, rad_to_deg(theta))\... | [
"0.6399299",
"0.4821775",
"0.47482178",
"0.47451603",
"0.4718969",
"0.47094646",
"0.46803755",
"0.46736267",
"0.46559674",
"0.46341786",
"0.46172512",
"0.45835376",
"0.45782167",
"0.45575184",
"0.4509802",
"0.44828296",
"0.44814327",
"0.44729352",
"0.4446633",
"0.44391727",
"... | 0.67813087 | 0 |
Add a cable, but make it connected at both ends to form a ring. For consistency, add each `part_id` to various information tracking lists and dictionaries (see `add_cable` documentation). | def add_cable_ring(self, env, info={}, cable_idx=0):
def rad_to_deg(rad):
return (rad * 180.0) / np.pi
def get_discretized_rotations(num_rotations):
# counter-clockwise
theta = i * (2 * np.pi) / num_rotations
return (theta, rad_to_deg(theta))
# B... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_cable(self, env, size_range, info={}, cable_idx=0,\n direction='z', max_force=100):\n num_parts = self.num_parts\n radius = self.radius\n length = self.length\n color = self.colors[cable_idx] + [1]\n color_end = U.COLORS['yellow'] + [1]\n\n # Add beaded ... | [
"0.6340346",
"0.5963706",
"0.561385",
"0.5282388",
"0.5237076",
"0.51247805",
"0.4898154",
"0.48567188",
"0.48145375",
"0.4784494",
"0.47760782",
"0.47517604",
"0.4741683",
"0.47313157",
"0.47248822",
"0.47120112",
"0.46812776",
"0.4679144",
"0.4670553",
"0.46684298",
"0.4659... | 0.6983091 | 0 |
Add a block (really, a cube) from sorting env. | def add_block(self, env):
block_size = (0.04, 0.04, 0.04)
block_pose = self.random_pose(env, block_size)
block_urdf = 'assets/stacking/block.urdf'
block_id = env.add_object(block_urdf, block_pose)
self.object_points[block_id] = np.float32((0, 0, 0)).reshape(3, 1)
self._ID... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_block(self, env, block_color, width, height):\n\n block_size = (0.04, 0.04, 0.04)\n block_urdf = \"stacking/block.urdf\"\n block_pose = self.get_random_pose(env, block_size)\n block_id = env.add_object(block_urdf, block_pose)\n pb.changeVisualShape(\n block_id, -1, rgbaColor=utils.COL... | [
"0.66259176",
"0.60038716",
"0.5946157",
"0.57713836",
"0.5730063",
"0.57117116",
"0.5543864",
"0.55010754",
"0.5454564",
"0.5432545",
"0.53916216",
"0.5379964",
"0.5358128",
"0.5318451",
"0.5304306",
"0.5301904",
"0.5271466",
"0.5237138",
"0.5226147",
"0.5213275",
"0.5194819... | 0.7430781 | 0 |
Generate randomly shaped box, from aligning env. | def add_random_box(self, env):
box_size = self.random_size(0.05, 0.15, 0.05, 0.15, 0.01, 0.06)
box_pose = self.random_pose(env, box_size)
box_template = 'assets/box/box-template.urdf'
box_urdf = self.fill_template(box_template, {'DIM': box_size})
box_id = env.add_object(box_urdf,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mk_room(self, bounding_box):\n if (bounding_box.top + self.edge_min + self.room_min\n > bounding_box.bottom):\n raise ValueError(\"Region too small to make room\")\n if (bounding_box.left + self.edge_min + self.room_min\n > bounding_box.right):\n ... | [
"0.62090635",
"0.60519004",
"0.6021171",
"0.60156155",
"0.60156155",
"0.5943075",
"0.59369576",
"0.58877337",
"0.58268225",
"0.5811669",
"0.5779086",
"0.57570755",
"0.5750367",
"0.5739813",
"0.5667541",
"0.56672955",
"0.5648264",
"0.56279767",
"0.5623999",
"0.560976",
"0.5587... | 0.6844028 | 0 |
Reset to start an episode. If generating training data for goalconditioned Transporters with `main.py` or goal images using `generate_goals.py`, then call the superclass. The code already puts the bead poses inside `info`. For this env it's IDs 4 through 27 (for 24 beads) but I scale it based on num_parts in case we ch... | def reset(self, env, last_info=None):
super().reset(env)
# Override with targets from last_info (and the goal image!).
if self.goal_cond_testing:
assert last_info is not None
self.goal['places'] = self._get_goal_info(last_info) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n\n # initialize gym env variables\n self.finish = False\n self.curr_step = -1\n self.curr_episode += 1\n\n # initialize target position\n self.target = np.random.uniform(-10.0,10.0,size=(2))\n\n # initialize sheep positions\n if self.fixed_r... | [
"0.6176949",
"0.6074522",
"0.5975602",
"0.59743005",
"0.57683575",
"0.5717546",
"0.5702152",
"0.5672596",
"0.56602925",
"0.5626447",
"0.5621834",
"0.56006604",
"0.5592225",
"0.5589756",
"0.5568318",
"0.5528508",
"0.5511361",
"0.551104",
"0.55050945",
"0.5504384",
"0.5470071",... | 0.64481753 | 0 |
Read a shapefile into a Pandas dataframe with a 'coords' column holding the geometry information. This uses the pyshp package | def read_shapefile(sf_shape):
fields = [x[0] for x in sf_shape.fields][1:]
records = [y[:] for y in sf_shape.records()]
#records = sf_shape.records()
shps = [s.points for s in sf_shape.shapes()]
df = pd.DataFrame(columns=fields, data=records)
df = df.assign(coords=shps)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_shapefile(shp_path):\n\timport shapefile\n\n\t#read file, parse out the records and shapes\n\tsf = shapefile.Reader(shp_path)\n\tfields = [x[0] for x in sf.fields][1:]\n\trecords = sf.records()\n\tshps = [s.points for s in sf.shapes()]\n\n\t#write into a dataframe\n\tdf = pd.DataFrame(columns=fields, data... | [
"0.80723655",
"0.75595874",
"0.7167973",
"0.7020709",
"0.65915084",
"0.64358574",
"0.6414832",
"0.6379433",
"0.62167096",
"0.6067152",
"0.60559773",
"0.5945423",
"0.58771205",
"0.583583",
"0.5752345",
"0.5710811",
"0.56827706",
"0.5679953",
"0.5671952",
"0.5589924",
"0.558504... | 0.78103423 | 1 |
Update the logger based on the current settings. | def update_logger():
settings = sublime.load_settings("OpenContextPath.sublime-settings")
# set the verbosity level
if settings.get("debug", False):
log.setLevel(logging.DEBUG)
else:
log.setLevel(logging.INFO) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, *args, **kwargs):\n self.logger.update(*args, **kwargs)",
"def logger_settings(self):\n LOG_CONFIG['root']['handlers'].append(self.logmode)\n flask_log = logging.getLogger(DEFAULT_NAME_FLASK_LOGGER)\n flask_log.setLevel(logging.ERROR)\n dictConfig(LOG_CONFIG)\n... | [
"0.7809403",
"0.66899323",
"0.6545339",
"0.6490471",
"0.63485026",
"0.6343728",
"0.6330114",
"0.6304992",
"0.6248417",
"0.62308055",
"0.61561215",
"0.61403227",
"0.61403227",
"0.6122026",
"0.6074714",
"0.6071768",
"0.60580516",
"0.60579437",
"0.6051258",
"0.6049027",
"0.60065... | 0.7595513 | 1 |
Define the shell, PromptSession and Application. | def __init__(self):
self.shell = get_ipython()
if self.shell is not None:
self.pt_app = get_app()
self.session = get_session()
else:
from prompt_toolkit import VERSION as ptk_version
# Gonna need a ptk version check
if ptk_version > 3:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_shell_context():\n return dict(app=app)",
"def make_shell_context():\n return dict(app=app)",
"def init_shell(self):\n self.shell = PlayerTerminalInteractiveShell.instance(\n commands=self.commands,\n speed=self.speed,\n parent=self,\n display_b... | [
"0.6551561",
"0.6551561",
"0.6401499",
"0.6394038",
"0.6370286",
"0.61401075",
"0.61401075",
"0.6066545",
"0.60589904",
"0.605814",
"0.591867",
"0.586694",
"0.5851491",
"0.5844033",
"0.58301234",
"0.5819857",
"0.58063215",
"0.5776259",
"0.5764055",
"0.5748111",
"0.57468295",
... | 0.74060184 | 0 |
Application instance keybindings. NOT the same as 'session_kb'. | def app_kb(self):
return self.pt_app.key_bindings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_keybinds(self):\n self.keybinds.set(self.lnp.read_keybinds())",
"def init_keystrokes(self):\n import x84.bbs.session\n term = x84.bbs.session.getterminal()\n self.keyset['home'].append(term.KEY_HOME)\n self.keyset['end'].append(term.KEY_END)\n self.keyset['pgup'... | [
"0.643027",
"0.6134622",
"0.6119234",
"0.6071617",
"0.58246946",
"0.5799789",
"0.5788179",
"0.57621205",
"0.57212794",
"0.5695585",
"0.5618283",
"0.5563702",
"0.55531985",
"0.55462164",
"0.55379134",
"0.55337375",
"0.5505733",
"0.5490425",
"0.5442608",
"0.5430167",
"0.5430014... | 0.7763129 | 0 |
Current buffer as returned by the layout property. | def current_buffer(self):
return self.layout.current_buffer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBuffer(self):\n return self.buffer",
"def buffer(self):\n return self._buffer",
"def RefBuffer(self):\n return self.buffers[self.buffergrade]",
"def current_buffer_app(self):\n return self.session.current_buffer",
"def current_buffer(self, no_minibuffer=False):\n r... | [
"0.75431836",
"0.7502951",
"0.7302088",
"0.72644943",
"0.7025632",
"0.688709",
"0.68844616",
"0.67929155",
"0.6748618",
"0.65177876",
"0.651016",
"0.63652545",
"0.6362985",
"0.63221246",
"0.6302362",
"0.6261452",
"0.624247",
"0.624247",
"0.624247",
"0.62035567",
"0.6179535",
... | 0.9105426 | 0 |
Current buffer a returned by the App. Doesn't exist on the PromptSession. | def current_buffer_app(self):
return self.session.current_buffer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_buffer(self):\n return self.layout.current_buffer",
"def getBuffer(self):\n return self.buffer",
"def current_buffer(self, no_minibuffer=False):\n return \\\n self._mini_buffer \\\n if self.mini_buffer_state and not no_minibuffer else \\\n self.... | [
"0.7640836",
"0.7111689",
"0.6949397",
"0.6914544",
"0.68030846",
"0.67877644",
"0.6574439",
"0.6408365",
"0.63995963",
"0.63825417",
"0.63321775",
"0.6320486",
"0.6278167",
"0.6251715",
"0.6251301",
"0.62437344",
"0.6209627",
"0.6205243",
"0.60938764",
"0.60937583",
"0.60341... | 0.78798133 | 0 |
Return a list of the current container children. I genuinely don't think I expected it to be so big. | def current_container_children(self):
# noinspection PyProtectedMember
return self.current_container._all_children | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children(self):\n return list(self._children)",
"def get_children(self):\r\n return self.children",
"def children(self):\n return self._children",
"def children(self):\n return self._children",
"def children(self):\n \n return self._children",
"def get_childr... | [
"0.77648324",
"0.756241",
"0.75616527",
"0.75616527",
"0.752567",
"0.7522459",
"0.75148505",
"0.75103",
"0.75103",
"0.75103",
"0.7468297",
"0.73922694",
"0.73750836",
"0.737075",
"0.7351721",
"0.73412305",
"0.7259126",
"0.72515666",
"0.71817255",
"0.71610826",
"0.71434426",
... | 0.84893423 | 0 |
Return the layout's current control. Typically a BufferControl. | def current_control(self):
return self.layout.current_control | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_buffer(self):\n return self.layout.current_buffer",
"def get_control(self):\n return self.control",
"def getControl(self):\n return self._Control",
"def get_current_layout(self):\n # ported from the widgets/src/LayoutIndicator.c code\n\n self._engine.start_liste... | [
"0.7216042",
"0.7052022",
"0.69960034",
"0.68552697",
"0.68084013",
"0.6659682",
"0.6508754",
"0.6409506",
"0.61955386",
"0.6101471",
"0.606374",
"0.60342723",
"0.60133886",
"0.5972465",
"0.5950141",
"0.5933316",
"0.59169734",
"0.5867568",
"0.58489066",
"0.58226573",
"0.58136... | 0.8376985 | 0 |
The current buffer's document. | def current_document(self):
return self.current_buffer.document | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_document(self):\n return self.document",
"def GetDocument(self):\n return self.file",
"def get_doc(self):\n return self._doc",
"def document(self):\n return self.parent.document()",
"def get_doc(self):\n return self.p",
"def getCurrentDocument(self):\n ta... | [
"0.7787452",
"0.75152844",
"0.7507224",
"0.7504951",
"0.72684044",
"0.70555586",
"0.70424634",
"0.7040623",
"0.69396853",
"0.69338596",
"0.69126844",
"0.68394786",
"0.681225",
"0.67748183",
"0.66336644",
"0.6614859",
"0.6606382",
"0.658781",
"0.65623415",
"0.6559056",
"0.6532... | 0.9013573 | 0 |
The 'content' attribute of a `Window` returns a UIControl instance. In this specific case, it returns a BufferControl. | def current_content(self):
return self.current_window.content | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetContentWindow(self):\n return self.FindWindow(\"content\")",
"def create_buffer_window(source_info: \"SourceInfo\") -> Window:\n pager = source_info.pager\n\n input_processors = [\n ConditionalProcessor(\n processor=_EscapeProcessor(source_info),\n filter=Conditio... | [
"0.6955158",
"0.5580671",
"0.554503",
"0.5451245",
"0.5433218",
"0.54189277",
"0.5402855",
"0.5393239",
"0.5390138",
"0.5306176",
"0.5288407",
"0.52839965",
"0.52839965",
"0.5283057",
"0.5212745",
"0.5180649",
"0.5153435",
"0.5114685",
"0.50980425",
"0.50876504",
"0.50473154"... | 0.60556346 | 1 |
Is the `Window` content the control returned by the layout? | def content_is_control(self):
return self.current_content is self.current_control | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsOk(self):\r\n \r\n return self.window != None",
"def IsPaneButtonVisible(self, part):\r\n\r\n captionRect = wx.Rect()\r\n\r\n for temp_part in self._uiparts:\r\n if temp_part.pane == part.pane and \\\r\n temp_part.type == AuiDockUIPart.typeCaption:\r\n ... | [
"0.64781123",
"0.6430905",
"0.6340399",
"0.63381094",
"0.63187146",
"0.62900114",
"0.62085974",
"0.618623",
"0.6118965",
"0.61071813",
"0.60423607",
"0.60262567",
"0.5999779",
"0.5974134",
"0.59737414",
"0.59509194",
"0.59471387",
"0.5941973",
"0.5929957",
"0.5925982",
"0.588... | 0.7006927 | 0 |
The validator instance on the PromptSession. Notes Not only do we not have this attribute on the App, it's not bound to anything by default in IPython! | def session_validator(self):
return self.session.validator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validator(self):\n return self._validator",
"def get_validator(cls):\n cls.validator.model = cls\n return cls.validator or SageValidator",
"def get_validator(self):\n return self.get_validator_class()(**self.get_validator_kwargs())",
"def get_validate(self):\n return se... | [
"0.67745143",
"0.6281556",
"0.62001634",
"0.6197576",
"0.6188791",
"0.61543775",
"0.60624677",
"0.5928022",
"0.5889405",
"0.58829343",
"0.58723676",
"0.5847581",
"0.5816167",
"0.5816167",
"0.5816167",
"0.5816167",
"0.5816167",
"0.5816167",
"0.5816167",
"0.5816167",
"0.5785968... | 0.6945867 | 0 |
The output attribute from the `prompt_toolkit.renderer.Renderer`. Examples | def renderer_output(self):
return self.app_renderer.output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output(self):\n return self.output",
"def get_output(self):\n return self.output",
"def output(self) -> Optional[str]:\n return self.__output",
"def _get_output(self):\n return self.__output",
"def _get_output(self):\n return self.__output",
"def _get_output(self):\n ... | [
"0.6563479",
"0.6563479",
"0.6561528",
"0.647419",
"0.647419",
"0.647419",
"0.647419",
"0.647419",
"0.647419",
"0.64474356",
"0.6399421",
"0.63702536",
"0.62928647",
"0.6291327",
"0.6240518",
"0.6209661",
"0.61675787",
"0.6133626",
"0.6133626",
"0.6119083",
"0.6119083",
"0.... | 0.68923146 | 0 |
Generate a `Layout` with a `SearchToolbar` and keybindings. Notes Windows require their `content` arguments to have a method `reset`. | def search_layout():
all_input_processors = all_processors_for_searching()
search_toolbar = SearchToolbar("Search Toolbar", vi_mode=True)
control = BufferControl(
Buffer(document=Document(), read_only=True),
search_buffer_control=search_toolbar.control,
preview_search=True,
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_layout(self) -> Layout:\n dyncond = self._dyncond\n\n # Create functions that will dynamically split the prompt. (If we have\n # a multiline prompt.)\n (\n has_before_fragments,\n get_prompt_text_1,\n get_prompt_text_2,\n ) = _split_mu... | [
"0.6820482",
"0.62265587",
"0.6197898",
"0.6183188",
"0.6066665",
"0.6048482",
"0.58153456",
"0.5809086",
"0.5701562",
"0.5700286",
"0.5664919",
"0.557461",
"0.55305725",
"0.5513161",
"0.5496757",
"0.5494577",
"0.54466414",
"0.5419139",
"0.53805226",
"0.5380222",
"0.5364679",... | 0.7143151 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.