query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Receive params set by user and change ml setting. After receiving a post request with params, the application will receive those data and change the machine learning algorithm settings using them.
def post(self, request, mat_pk, conf): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateData(self, *args):\n # if self.move_next_option == \"R\":\n # self.restSampling()\n # elif self.move_next_option == \"A\":\n # self.addExtra()\n # else:\n # self.continueReview()\n for name, value in self.parameter_inputs.items():\n ...
[ "0.64385635", "0.6344797", "0.62002456", "0.6161458", "0.5972883", "0.59180063", "0.59025645", "0.58876026", "0.5866229", "0.5861852", "0.5752512", "0.5744591", "0.5727583", "0.5713378", "0.56492746", "0.56252056", "0.5586274", "0.5580859", "0.5564696", "0.5544793", "0.553062...
0.52882826
48
return value associated with this vertex
def get_value(self): return self._value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):\n return self.__edge_value", "def value(self):\n raise NotImplementedError", "def get_value(self):\n raise NotImplementedError", "def value(self):\n return self.value()._value", "def value(self):\n return self.node_value", "def getValue(self):\n...
[ "0.762555", "0.71106493", "0.7075568", "0.7074071", "0.7037823", "0.7025406", "0.7020415", "0.6977234", "0.6951005", "0.69400465", "0.69348377", "0.69306177", "0.6923279", "0.6916961", "0.6910644", "0.69035524", "0.6877247", "0.6872131", "0.68680507", "0.68490136", "0.6837133...
0.6619391
85
return (u,v) as a tuple for vertices u and v
def endpoint(self): return (self._start, self._end)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices_tuple(self):\n vtuple = (*self.v0, *self.v1, *self.v2, *self.v3)\n return vtuple", "def _permutation_to_vertex(self, p):\n return (\n tuple(p._labels[0]),tuple(p._labels[1]),\n tuple(p._twin[0]),tuple(p._twin[1]))", "def protrudes((u,v)):\r\n return ((u,v,W), ...
[ "0.7982392", "0.704905", "0.69064075", "0.68786657", "0.6850807", "0.6843799", "0.6813446", "0.6592291", "0.656968", "0.656968", "0.6523761", "0.6369852", "0.6355231", "0.6275095", "0.62713885", "0.6256311", "0.6241648", "0.62277335", "0.6224196", "0.6222461", "0.622156", "...
0.0
-1
return vertex opposite of u on this edge
def opposite(self, u): return self._end if u is self._start else self._start
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opposite_vertex(t, tri, edge):\n tn = neighbour(t, tri, edge)\n if tn is None:\n return None\n\n for i in range(3):\n if not has_vertex(t, tri, t[tn][i]):\n return t[tn][i]\n\n return None", "def opposite(self,v):\n return self._destination if v is self._origin...
[ "0.7540669", "0.70938057", "0.66997284", "0.65678304", "0.650582", "0.64719325", "0.6390833", "0.6340622", "0.63401115", "0.63318473", "0.631391", "0.62994313", "0.62875175", "0.6275546", "0.62660474", "0.6260833", "0.6260833", "0.6252445", "0.62214375", "0.62141716", "0.6209...
0.68963504
2
return value associated with this edge
def get_value(self): return self._value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):\n return self.__edge_value", "def value(self):\n return self.node_value", "def get_value(self):\n raise NotImplementedError", "def value(self):\n return self.value()._value", "def _value(self):\n return self.device.value(*self._id[1:])", "def va...
[ "0.8759379", "0.70828825", "0.7060541", "0.7000766", "0.69739336", "0.6955263", "0.6945891", "0.6905127", "0.6903311", "0.69016474", "0.6891681", "0.6880892", "0.6871947", "0.6852401", "0.6852401", "0.6849002", "0.6848879", "0.6829016", "0.6824213", "0.6816417", "0.6815892", ...
0.67168105
35
returns edge attributes as a tuple Helpful for visualizing nodes and their edge weights
def get_items(self): return (self._start._value, self._end._value, self._value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_edge_attributes(graph: BaseGraph, attr_key: str) -> Dict:\n return get_edge_attributes(graph.graph, attr_key)", "def edge_attribute(self):\n return self._edge_attribute", "def get_edge_columns(self):\n return self.__get_columns('edge')", "def get_attributes(self):\n attrs ...
[ "0.6799987", "0.6742429", "0.65919846", "0.6539993", "0.6532845", "0.6516988", "0.6475485", "0.6444293", "0.6439524", "0.64193434", "0.640573", "0.63337636", "0.6331853", "0.6328682", "0.62146175", "0.61893076", "0.6166761", "0.60961676", "0.60922587", "0.60842216", "0.603676...
0.0
-1
return number of outgoing edges incident to vertex u in the graph. For directed graph, optional parameter counts incoming edges
def degree(self, u, outgoing=False): return NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_count(self):\n total = sum(len(self._outgoing[v]) for v in self._outgoing)\n # for undirected graphs, make sure not to double-count edges\n return total if self.is_directed() else total // 2", "def get_number_of_edges(self, where_to=OUTGOING):\n\n if not self._directed:\n ...
[ "0.68358546", "0.6561279", "0.6446544", "0.64447254", "0.6333673", "0.6319609", "0.6301107", "0.62222815", "0.6184934", "0.61087424", "0.60796434", "0.60392433", "0.6002174", "0.5998038", "0.5997388", "0.5966773", "0.59325117", "0.59113735", "0.5895486", "0.58712155", "0.5815...
0.0
-1
insert and return a new vertex with value val
def add_vertex(self, u, val): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, v):\n v = {'x': v[0], 'y': v[1]}\n if v not in self:\n self.append(v)\n return len(self)-1\n return self.index(v)", "def add_vertex(self, v):\n self[v] = {}", "def add_vertex(self, v):\n self[v] = {}", "def add_vertex(self, value):...
[ "0.70055175", "0.6672808", "0.6672808", "0.665914", "0.65796596", "0.64388794", "0.6434329", "0.6385019", "0.63737094", "0.6360909", "0.63309157", "0.62818736", "0.62777275", "0.6264226", "0.62505364", "0.6237072", "0.6217751", "0.6157137", "0.6152192", "0.6140421", "0.610808...
0.7464274
0
insert and return a new edge from vertex u to v with value val (identifies the edge)
def add_edge(self, u, v, val): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, u, v):\r\n keys = self.d.keys()\r\n #if nodes are not in graph, add them\r\n if u not in keys:\r\n self.add_node(u)\r\n if v not in keys:\r\n self.add_node(v)\r\n #add each node to the value set of each other\r\n u_old = self.d[u]\r...
[ "0.6902003", "0.68033904", "0.6797287", "0.6735052", "0.6735052", "0.673498", "0.6692211", "0.6499803", "0.6499803", "0.64099747", "0.6365838", "0.630058", "0.62901974", "0.6280423", "0.625974", "0.62564737", "0.624568", "0.61428213", "0.61315656", "0.61189634", "0.60859466",...
0.7721478
0
Basic attributes of the simple GAN.
def __init__(self, sess, max_iter=50001, optim='adagrad', learning_rate=1e-2, d_per_iter=1, g_per_iter=2, d_update=True, g_update=True, real_n=1000, real_dim=2, fake_n=1000, z_dim=3, g_out_dim=2, g_layers_depth=5, g_layers_width=None, g_activations=None, d_out_dim=1, d_la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, dualgan:nn.Module, l_adv:float=1., l_rec:float=1., l_idt:float=0.):\n super().__init__()\n store_attr()", "def basic(self):\n pass", "def gan(ident=None, gan=None):\n\n model = Sequential()\n\n model.add(gan)\n model.add(ident)\n\n model.compile(loss='binary_...
[ "0.6064089", "0.59724295", "0.5959846", "0.59587634", "0.59406954", "0.5715765", "0.5650553", "0.560533", "0.5600357", "0.54763764", "0.54249895", "0.5413517", "0.53791004", "0.53627753", "0.53603935", "0.53488046", "0.5306461", "0.53008026", "0.5296914", "0.5290118", "0.5285...
0.0
-1
Connect to a pshell server in another process, note that this does not do any handshaking to the remote pshell or maintain a connection state, it meerly sets the internal destination remote pshell server information to use when sending commands via the sendCommandN functions and sets up any resources necessary for the ...
def connectServer(controlName, remoteServer, port, defaultTimeout): return (_connectServer(controlName, remoteServer, port, defaultTimeout))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\n source_address = (socket.gethostname(), 0)\n dest_address = (self.host, self.port)\n\n self.sock = self.ssh_transport._open_ssh_channel(dest_address, source_address)\n\n # hack to work around issue in using paraminko channels as a \"socket\". See http://bugs.python...
[ "0.64140594", "0.639816", "0.6377459", "0.6183722", "0.61817", "0.61457235", "0.6118319", "0.6075475", "0.60697454", "0.60515195", "0.60034555", "0.59717435", "0.5968937", "0.5933763", "0.5918022", "0.5911673", "0.58980364", "0.5888824", "0.58549833", "0.5849856", "0.5789333"...
0.6720791
0
Cleanup any resources associated with the server connection, including releasing any temp file handles, closing any local socket handles etc.
def disconnectServer(controlName): _disconnectServer(controlName)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\n try:\n self.socket.close()\n except:\n pass # ignore errors when attempting to close socket\n self.socket = None\n self.current_host_and_port = None", "def cleanup(self):\n self.sock.close()", "def cleanup(self):\n self._sock...
[ "0.80022967", "0.7920083", "0.75370324", "0.7418731", "0.72245514", "0.7187986", "0.7143502", "0.7131036", "0.711857", "0.7110812", "0.7107524", "0.7093916", "0.705523", "0.70264", "0.7026005", "0.7022311", "0.70094144", "0.69717366", "0.69508845", "0.691903", "0.6916175", ...
0.0
-1
Use this function to cleanup any resources for all connected servers, this function should be called upon program termination, either in a graceful termination or within an exception signal handler, it is especially important that this be called when a unix server is used since there are associated file handles that ne...
def disconnectAllServers(): _disconnectAllServers()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\n\n # NOTE(jbresnah) call stop on each of the servers instead of\n # checking the pid file. stop() will wait until the child\n # server is dead. This eliminates the possibility of a race\n # between a child process listening on a port actually dying\n # and a...
[ "0.80430907", "0.756423", "0.7547833", "0.7388989", "0.7209192", "0.7117668", "0.6993189", "0.69877774", "0.6985015", "0.6981476", "0.69609797", "0.6957871", "0.694702", "0.69182354", "0.69061035", "0.69036144", "0.68822175", "0.6833263", "0.68275756", "0.6817147", "0.6801680...
0.6541632
36
Set the default server response timeout that is used in the 'send' commands that don't take a timeout override
def setDefaultTimeout(controlName, defaultTimeout): _setDefaultTimeout(controlName, defaultTimeout)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setdefaulttimeout(timeout):\r\n global _TIMEOUT\r\n _TIMEOUT = timeout", "def setdefaulttimeout(timeout):\r\n global default_timeout\r\n default_timeout = timeout", "def settimeout(self, timeout):\r\n self.sock.settimeout(timeout)", "def set_timeout(self, timeout):\n self.timeout = ...
[ "0.7465809", "0.7425091", "0.7108988", "0.71086025", "0.7076041", "0.7053614", "0.7053614", "0.6942587", "0.6913843", "0.68904024", "0.66963243", "0.66894317", "0.6640052", "0.66323835", "0.6611144", "0.66078097", "0.659158", "0.65854955", "0.64857304", "0.6467955", "0.641591...
0.67351276
10
This function will extract all the commands of a remote pshell server and present them in a human readable form, this is useful when writing a multi server control aggregator, see the demo program pshellAggregatorDemo.py in the demo directory for examples
def extractCommands(controlName, includeName = True): return (_extractCommands(controlName, includeName))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shell_commands_from_help_response(response):\n return [line.split()[0].strip() for line in response]", "def server_command(ssh, command):\n print('Executing command: {0}\\n'.format(command))\n stdin, stdout, stderr = ssh.exec_command(command)\n for line in stdout.readlines():\n print(l...
[ "0.64674234", "0.61909175", "0.5774975", "0.57586324", "0.5751912", "0.57148004", "0.56756496", "0.5617602", "0.56053746", "0.556454", "0.55518717", "0.551345", "0.55097467", "0.55046916", "0.5496907", "0.5470845", "0.5459531", "0.5436291", "0.5405054", "0.53863424", "0.53786...
0.0
-1
This command will add a controlList of multicast receivers to a multicast group, multicast groups are based either on a specified command, or if the special argument PSHELL_MULTICAST_ALL is used, the given controlList will receive all multicast commands, the format of the controlList is a CSV formatted list of all the ...
def addMulticast(command, controlList): _addMulticast(command, controlList)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe_to_mc_groups(addrs=None):\n\n listen_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_IP)\n listen_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n listen_sock.bind(('', DEFAULT_TDM_PORT))\n\n for mc in addrs:\n print(\"subscribing to {}\".format(m...
[ "0.5905946", "0.55800664", "0.53881925", "0.5349174", "0.5195199", "0.4941558", "0.4911162", "0.4821562", "0.4777276", "0.4695401", "0.46406105", "0.46260658", "0.46048972", "0.4598583", "0.4537745", "0.45331293", "0.45294213", "0.4514538", "0.45126247", "0.4490134", "0.44843...
0.82443655
0
This command will send a given command to all the registered multicast receivers for this multicast group, multicast groups are based on the command's keyword, this function will issue the command as a best effort fireandforget command to each receiver in the multicast group, no results will be requested or expected, a...
def sendMulticast(command): _sendMulticast(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addMulticast(command, controlList):\n _addMulticast(command, controlList)", "def receive(self, command_list):\n for cmd in command_list:\n self._send_cmd_with_mapped_ids(cmd)", "def discoveryBroadcast(self):\n interfaces = netifaces.interfaces()\n for interface in interface...
[ "0.6507733", "0.5696942", "0.5583125", "0.5511868", "0.53806776", "0.53689533", "0.5362779", "0.536228", "0.533392", "0.53231615", "0.528227", "0.5262153", "0.52358514", "0.52324533", "0.52314097", "0.52299494", "0.52146405", "0.52002823", "0.51943034", "0.5193174", "0.518410...
0.71866304
0
Send a command using the default timeout setup in the connectServer call, if the default timeout is 0, the server will not reply with a response and this function will not wait for one
def sendCommand1(controlName, command): return (_sendCommand1(controlName, command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_cmd(self,cmd,timeout=5):\n if not self.checkConnected():\n self.connect()\n \n while True:\n try:\n self.sock.recv(10000)\n except:\n break\n \n tic = time.time()\n try:\n self._send(cmd)\n ...
[ "0.7270078", "0.7067881", "0.68186784", "0.6705202", "0.6694927", "0.65998733", "0.6550655", "0.65368515", "0.65124404", "0.6505016", "0.6503519", "0.64692384", "0.6452845", "0.6350147", "0.6350147", "0.63350433", "0.6307867", "0.6284752", "0.6179402", "0.6110416", "0.6084439...
0.0
-1
Send a command overriding the default timeout, if the override timeout is 0, the server will not reply with a response and this function will not wait for one
def sendCommand2(controlName, timeoutOverride, command): return (_sendCommand2(controlName, timeoutOverride, command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendCommand4(controlName, timeoutOverride, command):\n return (_sendCommand4(controlName, timeoutOverride, command))", "def send_command(self, command):\r\n print (\">> send cmd: {}\".format(command))\r\n self.abort_flag = False\r\n timer = threading.Timer(self.command_timeout, self.set...
[ "0.7543854", "0.74337345", "0.72187316", "0.71768516", "0.71304816", "0.6907192", "0.6906801", "0.6848764", "0.67818886", "0.67818886", "0.6768794", "0.67666864", "0.66927606", "0.6620532", "0.656423", "0.6549495", "0.65354204", "0.65237427", "0.6503479", "0.6459959", "0.6435...
0.7466738
1
Send a command using the default timeout setup in the connectServer call and return any results received in the payload, if the default timeout is 0, the server will not reply with a response and this function will not wait for one, and no results will be extracted
def sendCommand3(controlName, command): return (_sendCommand3(controlName, command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_cmd(self,cmd,timeout=5):\n if not self.checkConnected():\n self.connect()\n \n while True:\n try:\n self.sock.recv(10000)\n except:\n break\n \n tic = time.time()\n try:\n self._send(cmd)\n ...
[ "0.71482754", "0.6893281", "0.66120017", "0.6424325", "0.6242144", "0.61846364", "0.6159615", "0.6120025", "0.61112547", "0.6076655", "0.60684544", "0.6038106", "0.59867877", "0.59867877", "0.59809977", "0.59647626", "0.5934728", "0.5900114", "0.58581513", "0.5857151", "0.583...
0.0
-1
Send a command overriding the default timeout and return any results received in the payload, if the timeout override default timeout is 0, the server will not reply with a response and this function will not wait for one, and no results will be extracted
def sendCommand4(controlName, timeoutOverride, command): return (_sendCommand4(controlName, timeoutOverride, command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_cmd(self,cmd,timeout=5):\n if not self.checkConnected():\n self.connect()\n \n while True:\n try:\n self.sock.recv(10000)\n except:\n break\n \n tic = time.time()\n try:\n self._send(cmd)\n ...
[ "0.7198552", "0.7005955", "0.692479", "0.68229157", "0.681465", "0.681138", "0.6558479", "0.6555934", "0.6424239", "0.63032883", "0.6284749", "0.6255038", "0.6234502", "0.6220798", "0.6209997", "0.6190514", "0.6189328", "0.61815345", "0.6172482", "0.61317825", "0.61125267", ...
0.62789017
11
Return the human readable form of one of the command response return codes
def getResponseString(retCode): return (_getResponseString(retCode))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe(result_code):\n return _MESSAGES.get(result_code) or 'unknown error'", "def http_return_code(res_data) -> (int, str):\n\n start = re.search(\"[0-9]{3}\", res_data).start()\n end_of_line = res_data.find(\"\\r\\n\")\n code = int(res_data[start:start+3])\n if end_of_line == -1:\n ...
[ "0.7150466", "0.7000942", "0.66937864", "0.65883315", "0.6541618", "0.64510787", "0.640594", "0.639363", "0.63820785", "0.6375024", "0.6360461", "0.63602155", "0.63514125", "0.63168716", "0.63089854", "0.630436", "0.62419325", "0.6233697", "0.6213375", "0.6213375", "0.6182567...
0.5872042
57
Provide a user callback function to send the logs to, this allows an application to get all the logs issued by this module to put in it's own logfile. If a log function is not set, all internal logs are just sent to the 'print' function.
def setLogFunction(function): _setLogFunction(function)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, logstr, *args, **kwargs):\n if self._log_func:\n self._log_func(logstr, *args, **kwargs)\n else:\n print logstr", "def set_logger( logger_fn: Callable[[str,str],any] = lambda llvl, msg: sys.stdout.write( \"[%s]: %s\\n\" % (llvl, msg) ) ):\n global LOGGER\n...
[ "0.6986424", "0.68645984", "0.6536814", "0.65157163", "0.644152", "0.64256644", "0.6399708", "0.6389585", "0.63670886", "0.63484836", "0.6286952", "0.6259448", "0.6212252", "0.6204093", "0.6178495", "0.6171018", "0.61432827", "0.6080187", "0.60760885", "0.6042212", "0.6037128...
0.61213857
17
Calculate the largest prime factor of n
def largest_prime_fac(n): divisor = 2 # Start with lowest prime and work through prime factors until highest is left while divisor ** 2 < n: while n % divisor == 0: n = n / divisor divisor += 1 return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_factor(n): \n max_factor = 1\n for i in range(2,floor(sqrt(n))+1):\n if n % i == 0:\n return max(max_factor, n // i)\n return max_factor", "def largest_factor(n):\n i = 1\n previous_factor = 1\n largest = 1\n while i < n:\n if n % i == 0:\n factor...
[ "0.8655445", "0.8430594", "0.8330235", "0.8084008", "0.8032695", "0.8024104", "0.78489286", "0.77927464", "0.7599451", "0.7428057", "0.74210066", "0.73958105", "0.7356557", "0.7315471", "0.7311111", "0.73058695", "0.72782797", "0.72395045", "0.72323185", "0.72276163", "0.7195...
0.88828486
0
Returns a JSON string appropriate for Legal Server, given a Docassemble Address object
def address_to_json(address): addr = { "zip": address.zip, "address1": address.address, "address2": address.unit, "city":address.city, "state": address.state } addr = {key:value for (key,value) in addr.items() if not value is None} return json.dumps(addr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_address_other_parameters():\n address = lob.Address.create(name = 'Siddharth Saha', address_line1 = '104, Printing Boulevard',\n address_line2 = 'Sunset Town', email = 'sidchilling@gmail.com', \n address_city = 'Boston', address_state = 'MA', address_country = 'US',\n address_zip =...
[ "0.58829296", "0.5868385", "0.5859477", "0.57941186", "0.5780272", "0.55894935", "0.5510028", "0.5468354", "0.54024804", "0.5290335", "0.5276043", "0.5274414", "0.52627796", "0.52444506", "0.5240951", "0.5239912", "0.5229631", "0.5220667", "0.5154393", "0.51464623", "0.514381...
0.56657636
5
Looks in config for legal server key, subkeys servername, username, and password then calls _ls_submit_online_intake with those values
def ls_submit_online_intake(params, task=None): servername = daconfig.get('legal server',{}).get('servername') username = daconfig.get('legal server',{}).get('username') password = daconfig.get('legal server',{}).get('password') return _ls_submit_online_intake(servername, username, password, params,task...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_ask_configs(config):\n\n if config.confluence_ask_user:\n print('(request to accept username from interactive session)')\n print(' Instance: ' + config.confluence_server_url)\n\n default_user = config.confluence_server_user\n u_str = ''\n if default_user:\n ...
[ "0.56631404", "0.5535071", "0.5369914", "0.53243005", "0.5206058", "0.51868904", "0.5166714", "0.51451874", "0.51194465", "0.5114242", "0.5108081", "0.50908875", "0.5070005", "0.50454277", "0.5037076", "0.50222623", "0.5017046", "0.49983636", "0.49888188", "0.49842295", "0.49...
0.6626169
0
Compute bounding boxes from masks.
def extract_bboxes(mask): boxes = np.zeros([mask.shape[-1], 4], dtype=np.int32) for i in range(mask.shape[-1]): m = mask[:, :, i] # Bounding box. horizontal_indicies = np.where(np.any(m, axis=0))[0] vertical_indicies = np.where(np.any(m, axis=1))[0] if horizontal_indicies...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_bboxes(mask):\r\n boxes = np.zeros([mask.shape[-1], 4], dtype=np.int32)\r\n for i in range(mask.shape[-1]):\r\n m = mask[:, :, i]\r\n # Bounding box.\r\n horizontal_indicies = np.where(np.any(m, axis=0))[0]\r\n vertical_indicies = np.where(np.any(m, axis=1))[0]\r\n ...
[ "0.7847686", "0.7822384", "0.7725646", "0.74624574", "0.7325698", "0.73178643", "0.7166094", "0.7036856", "0.70279956", "0.6984062", "0.6840271", "0.6769655", "0.6768261", "0.66790813", "0.66393876", "0.66106874", "0.6608748", "0.65870476", "0.65523195", "0.64979154", "0.6494...
0.7814012
2
Calculates IoU of the given box with the array of the given boxes.
def compute_iou(box, boxes, box_area, boxes_area): # Calculate intersection areas y1 = np.maximum(box[0], boxes[:, 0]) y2 = np.minimum(box[2], boxes[:, 2]) x1 = np.maximum(box[1], boxes[:, 1]) x2 = np.minimum(box[3], boxes[:, 3]) intersection = np.maximum(x2 - x1, 0) * np.maximum(y2 - y1, 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_iou(box, boxes):\n # Calculate intersection areas\n iou = [box.intersection(b).area / box.union(b).area for b in boxes]\n\n return np.array(iou, dtype=np.float32)", "def compute_iou(box, boxes, box_area, boxes_area):\n # Calculate intersection areas\n x1 = np.maximum(box[0], boxes[:, 0...
[ "0.8233654", "0.8128509", "0.80252707", "0.79859704", "0.7928408", "0.77582073", "0.77385104", "0.77119327", "0.7706524", "0.7639222", "0.7638932", "0.7638932", "0.76373506", "0.76087755", "0.76022065", "0.76022065", "0.75603807", "0.7515975", "0.72115165", "0.7174434", "0.71...
0.8116598
4
Computes IoU overlaps between two sets of boxes.
def compute_overlaps(boxes1, boxes2): # Areas of anchors and GT boxes area1 = (boxes1[:, 2] - boxes1[:, 0]) * (boxes1[:, 3] - boxes1[:, 1]) area2 = (boxes2[:, 2] - boxes2[:, 0]) * (boxes2[:, 3] - boxes2[:, 1]) # Compute overlaps to generate matrix [boxes1 count, boxes2 count] # Each cell contains t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox_overlaps(bboxes1, bboxes2, mode='iou'):\n\n from icv.data.core.bbox import BBox\n assert mode in ['iou', 'iof']\n\n bboxes1 = np.array([np.array(b.bbox) if isinstance(b,BBox) else b for b in bboxes1])\n bboxes2 = np.array([np.array(b.bbox) if isinstance(b,BBox) else b for b in bboxes2])\n\n ...
[ "0.7990127", "0.78907293", "0.76871777", "0.76614314", "0.7659915", "0.7565243", "0.7565243", "0.75390357", "0.75383925", "0.7536965", "0.75360364", "0.75193775", "0.74758565", "0.74505776", "0.7442953", "0.74426675", "0.7352126", "0.73306423", "0.7320014", "0.73066556", "0.7...
0.8171749
2
Computes IoU overlaps between two sets of masks.
def compute_overlaps_masks(masks1, masks2): # If either set of masks is empty return empty result if masks1.shape[-1] == 0 or masks2.shape[-1] == 0: return np.zeros((masks1.shape[-1], masks2.shape[-1])) # flatten masks and compute their areas masks1 = np.reshape(masks1 > .5, (-1, masks1.sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_overlaps(boxes1, boxes2):\n # Areas of anchors and GT boxes\n area1 = (boxes1[:, 2] - boxes1[:, 0]) * (boxes1[:, 3] - boxes1[:, 1])\n area2 = (boxes2[:, 2] - boxes2[:, 0]) * (boxes2[:, 3] - boxes2[:, 1])\n\n # Compute overlaps to generate matrix [boxes1 count, boxes2 count]\n # Each cell...
[ "0.7274957", "0.7274957", "0.7274957", "0.71368843", "0.7078123", "0.690092", "0.68660337", "0.684559", "0.68321913", "0.68063563", "0.67350006", "0.67350006", "0.66618323", "0.65612245", "0.65596884", "0.6539915", "0.6460802", "0.645651", "0.64440256", "0.6385012", "0.634447...
0.75193983
0
Performs nonmaximum suppression and returns indices of kept boxes.
def non_max_suppression(boxes, scores, threshold): assert boxes.shape[0] > 0 if boxes.dtype.kind != "f": boxes = boxes.astype(np.float32) # Compute box areas y1 = boxes[:, 0] x1 = boxes[:, 1] y2 = boxes[:, 2] x2 = boxes[:, 3] area = (y2 - y1) * (x2 - x1) # Get indicies of b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_maximum_suppression(boxes):\n\n boxes = sorted(boxes, key=lambda box: box[2]-box[0], reverse=True)\n nms_boxes = []\n overlap_threshold = 0.5\n\n for box in boxes:\n if not any([overlap_between(box, nms_box) > overlap_threshold for nms_box in nms_boxes]):\n nms_boxes.append(bo...
[ "0.70608395", "0.69983155", "0.6976223", "0.67720497", "0.67435426", "0.6703019", "0.6653769", "0.66231835", "0.654032", "0.65133655", "0.64524907", "0.6440792", "0.6414008", "0.6377664", "0.63635045", "0.6159006", "0.6144057", "0.6129111", "0.6109921", "0.60739964", "0.60683...
0.7059315
1
Applies the given deltas to the given boxes.
def apply_box_deltas(boxes, deltas): boxes = boxes.astype(np.float32) # Convert to y, x, h, w height = boxes[:, 2] - boxes[:, 0] width = boxes[:, 3] - boxes[:, 1] center_y = boxes[:, 0] + 0.5 * height center_x = boxes[:, 1] + 0.5 * width # Apply deltas center_y += deltas[:, 0] * height ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_deltas(self, deltas, boxes):\r\n assert torch.isfinite(deltas).all().item(), \"Box regression deltas become infinite or NaN!\"\r\n boxes = boxes.to(deltas.dtype)\r\n\r\n TO_REMOVE = 1 # TODO remove\r\n widths = boxes[:, 2] - boxes[:, 0] + TO_REMOVE\r\n heights = boxes[...
[ "0.7569099", "0.7402683", "0.7402683", "0.6315952", "0.6241788", "0.61341137", "0.6114744", "0.5946799", "0.59326583", "0.5875315", "0.5871217", "0.5838033", "0.5749699", "0.5743597", "0.571185", "0.55955154", "0.5593027", "0.55822027", "0.55420786", "0.55410147", "0.54427934...
0.7714714
0
Compute refinement needed to transform box to gt_box. box and gt_box are [N, (y1, x1, y2, x2)]
def box_refinement_graph(box, gt_box): box = tf.cast(box, tf.float32) gt_box = tf.cast(gt_box, tf.float32) height = box[:, 2] - box[:, 0] width = box[:, 3] - box[:, 1] center_y = box[:, 0] + 0.5 * height center_x = box[:, 1] + 0.5 * width gt_height = gt_box[:, 2] - gt_box[:, 0] gt_widt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box_refinement(box, gt_box):\n box = box.astype(np.float32)\n gt_box = gt_box.astype(np.float32)\n\n height = box[:, 2] - box[:, 0]\n width = box[:, 3] - box[:, 1]\n center_y = box[:, 0] + 0.5 * height\n center_x = box[:, 1] + 0.5 * width\n\n gt_height = gt_box[:, 2] - gt_box[:, 0]\n gt...
[ "0.7865797", "0.76733476", "0.618014", "0.5994145", "0.59115374", "0.5832164", "0.5813795", "0.579934", "0.57544625", "0.5738981", "0.56627333", "0.5630207", "0.5575435", "0.5548591", "0.5529105", "0.55070585", "0.54973537", "0.5483298", "0.5456566", "0.54436886", "0.5419322"...
0.767776
1
Compute refinement needed to transform box to gt_box. box and gt_box are [N, (y1, x1, y2, x2)]. (y2, x2) is assumed to be outside the box.
def box_refinement(box, gt_box): box = box.astype(np.float32) gt_box = gt_box.astype(np.float32) height = box[:, 2] - box[:, 0] width = box[:, 3] - box[:, 1] center_y = box[:, 0] + 0.5 * height center_x = box[:, 1] + 0.5 * width gt_height = gt_box[:, 2] - gt_box[:, 0] gt_width = gt_box...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box_refinement(box, gt_box):\n\n width = box[:, 2] - box[:, 0]\n height = box[:, 3] - box[:, 1]\n center_x = box[:, 0] + 0.5 * width\n center_y = box[:, 1] + 0.5 * height\n\n gt_width = gt_box[:, 2] - gt_box[:, 0]\n gt_height = gt_box[:, 3] - gt_box[:, 1]\n gt_center_x = gt_box[:, 0] + 0.5...
[ "0.7610481", "0.75958043", "0.6040042", "0.5797379", "0.5750006", "0.5604143", "0.55847067", "0.5577789", "0.5542151", "0.54945785", "0.54490364", "0.5434252", "0.54194343", "0.5370828", "0.5370079", "0.5363147", "0.53103286", "0.5297801", "0.5276397", "0.5259239", "0.5253485...
0.7863669
0
Return a link to the image in its source Website or details about the image that help looking it up or debugging it. Override for your dataset, but pass to this function if you encounter images not in your dataset.
def image_reference(self, image_id): return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url():", "def get_image_link(self):\n table = self.soup.find('table')\n image_tag = table.find('img')\n image_name = self.soup.find_all(\"b\")[1].text\n return image_tag['src'], image_name\n\n # image = td.find_all('img')\n # print(image)\n # if imag...
[ "0.7356208", "0.7321155", "0.70454067", "0.6973916", "0.69390285", "0.6825515", "0.6793409", "0.66577184", "0.6629512", "0.65815127", "0.6562701", "0.6562701", "0.6562701", "0.65555507", "0.6537891", "0.65354925", "0.6495418", "0.6488588", "0.642659", "0.64239824", "0.6423970...
0.0
-1
Prepares the Dataset class for use.
def prepare(self, class_map=None): def clean_name(name): """Returns a shorter version of object names for cleaner display.""" return ",".join(name.split(",")[:1]) # Build (or rebuild) everything else from the info dicts. self.num_classes = len(self.class_info) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare(self):\n if self.opts['verbose']:\n print(\"Preparing dataset (one-time operation)...\")\n # Create paths files and load them back in\n self._build_ID_sets()\n self._create_ID_files()\n self._load_ID_files()\n if self.opts['verbose']:\n pr...
[ "0.7758656", "0.7241418", "0.7239436", "0.7222972", "0.7210236", "0.72034883", "0.70932466", "0.7042313", "0.6992051", "0.694836", "0.69467616", "0.6880937", "0.68526316", "0.680469", "0.67841667", "0.6780072", "0.67789966", "0.67789966", "0.6729223", "0.6705986", "0.66246676...
0.6459618
34
Returns a shorter version of object names for cleaner display.
def clean_name(name): return ",".join(name.split(",")[:1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_names_short(self):\r\n return [p.get_name() for p in self.people]", "def get_names_from_full_objects(objects):\n return [obj.name for obj in objects]", "def __str__(self):\n name=''\n for prop in self.properties.itervalues():\n name+=str(prop)\n return name", ...
[ "0.6897465", "0.6853068", "0.6811356", "0.66232103", "0.6603486", "0.65963674", "0.64829236", "0.64755017", "0.6474727", "0.6457962", "0.6454083", "0.6422431", "0.6387667", "0.6387667", "0.6374715", "0.6348133", "0.6345442", "0.6343397", "0.632053", "0.6309584", "0.63006413",...
0.0
-1
Takes a source class ID and returns the int class ID assigned to it.
def map_source_class_id(self, source_class_id): return self.class_from_source_map[source_class_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_source_class_id(self, class_id, source):\n info = self.class_info[class_id]\n assert info['source'] == source\n return info['id']", "def get_source_class_id(self, class_id, source):\n info = self.class_info[class_id]\n assert info['source'] == source\n return inf...
[ "0.8493009", "0.8493009", "0.6766999", "0.6760587", "0.6760587", "0.66088873", "0.6549115", "0.6302364", "0.62795174", "0.6275053", "0.6236329", "0.6236329", "0.61188203", "0.6107271", "0.59653497", "0.5949911", "0.58152884", "0.572042", "0.5719192", "0.5719192", "0.5719192",...
0.7406211
2
Map an internal class ID to the corresponding class ID in the source dataset.
def get_source_class_id(self, class_id, source): info = self.class_info[class_id] assert info['source'] == source return info['id']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_source_class_id(self, source_class_id):\n return self.class_from_source_map[source_class_id]", "def map_source_class_id(self, source_class_id):\n return self.class_from_source_map[source_class_id]", "def map_id_to_idx(self, class_ids):\n class_idx = torch.zeros(class_ids.shape, dty...
[ "0.73137933", "0.73137933", "0.67718047", "0.6196242", "0.604711", "0.60226375", "0.5913221", "0.58604896", "0.58501947", "0.57519186", "0.57360935", "0.5652242", "0.56301737", "0.562527", "0.5619298", "0.5612696", "0.558716", "0.54915357", "0.5488819", "0.5482897", "0.547926...
0.63966924
3
Returns the path or URL to the image. Override this to return a URL to the image if it's available online for easy debugging.
def source_image_link(self, image_id): return self.image_info[image_id]["path"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url():", "def image_url(self) -> str:\n return pulumi.get(self, \"image_url\")", "def image_url(self) -> str:\n return self._image_url", "def image_url(self):\n return self.photo_url or GENERIC_IMAGE", "def get_image_path(self) -> Optional[str]:\n if not self.image...
[ "0.78977764", "0.78976345", "0.7831657", "0.765302", "0.75300676", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", "0.74503696", ...
0.0
-1
Load the specified image and return a [H,W,3] Numpy array.
def load_image(self, image_id): # Load image image = skimage.io.imread(self.image_info[image_id]['path']) # If grayscale. Convert to RGB for consistency. if image.ndim != 3: image = skimage.color.gray2rgb(image) # If has an alpha channel, remove it for consistency ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(image_path):\n\tpil_image = Image.open(image_path).convert(\"RGB\")\n\t# convert to BGR format\n\timage = np.array(pil_image)[:, :, [2, 1, 0]]\n\treturn image", "def image_load(path) -> numpy.ndarray:\n # file\n na = numpy.array(Image.open(path))\n # fix shape\n na = numpy.moveaxis(na, [2,0,1], [0,1...
[ "0.7215976", "0.7212851", "0.71648335", "0.71095973", "0.70218", "0.7021521", "0.6983071", "0.69782954", "0.6975055", "0.6959333", "0.69243896", "0.68574363", "0.68485564", "0.67895716", "0.67280525", "0.6722009", "0.67131233", "0.67131233", "0.6709434", "0.66899574", "0.6666...
0.0
-1
Load instance masks for the given image. Different datasets use different ways to store masks. Override this method to load instance masks and return them in the form of am array of binary masks of shape [height, width, instances].
def load_mask(self, image_id): # Override this function to load a mask from your dataset. # Otherwise, it returns an empty mask. logging.warning("You are using the default load_mask(), maybe you need to define your own one.") mask = np.empty([0, 0, 0]) class_ids = np.empty([0], n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mask(self, image_id):\n # If not a vesicle dataset image, delegate to parent class.\n image_info = self.image_info[image_id]\n if image_info[\"source\"] != \"vesicle\":\n return super(self.__class__, self).load_mask(image_id)\n\n # Convert polygons to a bitmap mask o...
[ "0.7869282", "0.786701", "0.7807325", "0.75356114", "0.7487194", "0.74836934", "0.74011266", "0.7394974", "0.7351115", "0.7336745", "0.7290065", "0.72642833", "0.7250822", "0.7201328", "0.71151125", "0.7102441", "0.7093331", "0.6974475", "0.69341886", "0.6813359", "0.6783459"...
0.72100884
13
Resizes an image keeping the aspect ratio unchanged.
def resize_image(image, min_dim=None, max_dim=None, min_scale=None, mode="square"): # Keep track of image dtype and return results in the same dtype image_dtype = image.dtype # Default window (y1, x1, y2, x2) and default scale == 1. h, w = image.shape[:2] window = (0, 0, h, w) scale = 1 padd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_image(self, width=200):\n self.new_width = width\n aspect_ratio = self.original_height/float(self.original_width)\n self.new_height = int(aspect_ratio * self.new_width)\n\n resized_image = self.image.resize((self.new_width, self.new_height), Image.BILINEAR)\n return re...
[ "0.77564126", "0.7599424", "0.7536592", "0.7518521", "0.7301986", "0.7301124", "0.72796124", "0.7271734", "0.72643673", "0.72199446", "0.72012556", "0.7201169", "0.7178162", "0.7136857", "0.7134075", "0.71085113", "0.71046597", "0.70785856", "0.707555", "0.7057434", "0.705004...
0.0
-1
Resizes a mask using the given scale and padding. Typically, you get the scale and padding from resize_image() to ensure both, the image and the mask, are resized consistently.
def resize_mask(mask, scale, padding, crop=None): # Suppress warning from scipy 0.13.0, the output shape of zoom() is # calculated with round() instead of int() with warnings.catch_warnings(): warnings.simplefilter("ignore") mask = scipy.ndimage.zoom(mask, zoom=[scale, scale, 1], order=0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_mask(mask, scale, padding):\n h, w = mask.shape[:2]\n mask = scipy.ndimage.zoom(mask, zoom=[scale, scale, 1], order=0)\n mask = np.pad(mask, padding, mode='constant', constant_values=0)\n return mask", "def fixed_scale(im, inst_masks, mask, boxes, classes, target_h, target_w):\n h, w, c...
[ "0.7886953", "0.6024971", "0.601013", "0.59956163", "0.59815747", "0.5902877", "0.5891884", "0.5891884", "0.5866327", "0.5845942", "0.5541372", "0.55336607", "0.55139524", "0.5509066", "0.5439005", "0.54368395", "0.5432924", "0.5407946", "0.54037696", "0.5389475", "0.53850484...
0.75246656
1
Resize masks to a smaller version to reduce memory load. Minimasks can be resized back to image scale using expand_masks() See inspect_data.ipynb notebook for more details.
def minimize_mask(bbox, mask, mini_shape): mini_mask = np.zeros(mini_shape + (mask.shape[-1],), dtype=bool) for i in range(mask.shape[-1]): # Pick slice and cast to bool in case load_mask() returned wrong dtype m = mask[:, :, i].astype(bool) y1, x1, y2, x2 = bbox[i][:4] m = m[y1:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resize_masks(self, results):\n for key in results.get('mask_fields', []):\n if results[key] is None:\n continue\n if self.keep_ratio:\n results[key] = results[key].rescale(results['scale'])\n else:\n results[key] = results[ke...
[ "0.7154243", "0.7154243", "0.6847967", "0.6791732", "0.6763677", "0.63252425", "0.6268384", "0.61796695", "0.61422944", "0.61002326", "0.60999435", "0.6095528", "0.60670966", "0.5973757", "0.59147686", "0.5888631", "0.5871825", "0.585708", "0.5818637", "0.58149403", "0.575772...
0.5963186
14
Resizes mini masks back to image size. Reverses the change of minimize_mask(). See inspect_data.ipynb notebook for more details.
def expand_mask(bbox, mini_mask, image_shape): mask = np.zeros(image_shape[:2] + (mini_mask.shape[-1],), dtype=bool) for i in range(mask.shape[-1]): m = mini_mask[:, :, i] y1, x1, y2, x2 = bbox[i][:4] h = y2 - y1 w = x2 - x1 # Resize with bilinear interpolation m ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resize_masks(self, results):\n for key in results.get('mask_fields', []):\n if results[key] is None:\n continue\n if self.keep_ratio:\n results[key] = results[key].rescale(results['scale'])\n else:\n results[key] = results[ke...
[ "0.6824783", "0.6824783", "0.67864114", "0.676718", "0.6713043", "0.6579464", "0.64480937", "0.6397207", "0.63829374", "0.59540915", "0.59246415", "0.5860281", "0.58096504", "0.579351", "0.5792513", "0.5773392", "0.5738282", "0.57245713", "0.56910825", "0.5675608", "0.5654996...
0.6003659
9
Converts a mask generated by the neural network to a format similar to its original shape.
def unmold_mask(mask, bbox, image_shape): threshold = 0.5 y1, x1, y2, x2 = bbox mask = resize(mask, (y2 - y1, x2 - x1)) mask = np.where(mask >= threshold, 1, 0).astype(np.bool) # Put the mask in the right location. full_mask = np.zeros(image_shape[:2], dtype=np.bool) full_mask[y1:y2, x1:x2]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepare_mask_file(mask):\n result = np.ndarray((mask.shape[0], mask.shape[1]), dtype=np.uint8)\n for i in range(mask.shape[0]):\n for j in range(mask.shape[1]):\n\n if mask[i][j] > 0:\n result[i][j] = 1\n else:\n result[i][j] = 0\n \n ...
[ "0.6579084", "0.63678986", "0.6202979", "0.61114436", "0.60927284", "0.6071165", "0.60698974", "0.6069726", "0.604764", "0.60225576", "0.6022186", "0.60067827", "0.5990867", "0.5977732", "0.5973622", "0.59313947", "0.5930267", "0.5926438", "0.5926438", "0.5926438", "0.5926438...
0.0
-1
Generate anchors at different levels of a feature pyramid. Each scale is associated with a level of the pyramid, but each ratio is used in all levels of the pyramid.
def generate_pyramid_anchors(scales, ratios, feature_shapes, feature_strides, anchor_stride): # Anchors # [anchor_count, (y1, x1, y2, x2)] anchors = [] for i in range(len(scales)): anchors.append(generate_anchors(scales[i], ratios, feature_shapes[i], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_anchors(base_size, scales, aspect_ratios):\n anchor = np.array([1, 1, base_size, base_size], dtype=np.float) - 0.5\n anchors = _ratio_enum(anchor, aspect_ratios)\n anchors = np.vstack(\n [_scale_enum(anchors[i, :], scales) for i in range(anchors.shape[0])]\n )\n return torch.fro...
[ "0.6872527", "0.65623045", "0.6540331", "0.65027565", "0.6455423", "0.64050436", "0.6319756", "0.61491024", "0.61491024", "0.6127928", "0.6111651", "0.5975255", "0.59621745", "0.593363", "0.593363", "0.59301746", "0.5921645", "0.5836477", "0.58142966", "0.577031", "0.5760737"...
0.7103498
0
It's common to have tensors larger than the available data and pad with zeros. This function removes rows that are all zeros.
def trim_zeros(x): assert len(x.shape) == 2 return x[~np.all(x == 0, axis=1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_padded_rows(data, labels, n_dimensions):\n labels = np.repeat(labels, data.shape[1])\n data = data.reshape(-1, n_dimensions)\n added_rows = np.where(np.all(data == 0, axis=1))\n data = data[~added_rows[0]]\n labels = labels[~added_rows[0]]\n\n return data, labels", "def pad_zeros(x):...
[ "0.68312913", "0.6651325", "0.66369396", "0.6633322", "0.655796", "0.6550293", "0.63369226", "0.624033", "0.6205929", "0.6150306", "0.6146983", "0.61401784", "0.60737085", "0.6045232", "0.6019735", "0.6008516", "0.5989949", "0.59858364", "0.59858364", "0.59816563", "0.5967632...
0.65694565
4
Finds matches between prediction and ground truth instances.
def compute_matches(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold=0.5, score_threshold=0.0): # Trim zero padding # TODO: cleaner to do zero unpadding upstream gt_boxes = trim_zeros(gt_boxes) gt_masks = gt_mask...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_detections(ground_truth, predictions, class_name, overlap_threshold=0.5,\n allow_multiple_matches_per_ignored=True,\n verbose=True):\n\n Detection = namedtuple('Detection', ['image', 'bbox', 'score', 'gt_match'])\n GT = namedtuple('GroundTruth', ['bb...
[ "0.6992981", "0.66807973", "0.64548296", "0.6320186", "0.62863857", "0.62353045", "0.60981554", "0.60942876", "0.59995085", "0.5991319", "0.5982584", "0.59579575", "0.59293205", "0.5912274", "0.59002244", "0.58984506", "0.5875461", "0.58587784", "0.5838439", "0.58294576", "0....
0.67443717
1
Compute Average Precision at a set IoU threshold (default 0.5).
def compute_ap(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold): # Get matches and overlaps gt_match, pred_match, overlaps = compute_matches( gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_precision(tp,fp,npos):\r\n \r\n fp = np.cumsum(fp)\r\n tp = np.cumsum(tp)\r\n rec = tp / float(npos)\r\n # avoid divide by zero in case the first detection matches a difficult\r\n # ground truth\r\n prec = tp / np.maximum(tp + fp, np.finfo(np.float64).eps)\r\n \r\n # comp...
[ "0.6656932", "0.6422307", "0.6382818", "0.61385274", "0.6118089", "0.610859", "0.6033307", "0.6023982", "0.59936446", "0.59702045", "0.5968957", "0.59669405", "0.5953504", "0.59431374", "0.59431374", "0.5923731", "0.59229136", "0.59229136", "0.5917313", "0.5913685", "0.590186...
0.5755965
33
Compute AP over a range or IoU thresholds. Default range is 0.50.95.
def compute_ap_range(gt_box, gt_class_id, gt_mask, pred_box, pred_class_id, pred_score, pred_mask, iou_thresholds=None, verbose=1): # Default is 0.5 to 0.95 with increments of 0.05 iou_thresholds = iou_thresholds or np.arange(0.5, 1.0, 0.05) # Compute AP over r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate_pr_auc(self):\n dtp = self.true_positives[:self.num_thresholds -\n 1] - self.true_positives[1:]\n p = self.true_positives + self.false_positives\n dp = p[:self.num_thresholds - 1] - p[1:]\n prec_slope = math_ops.div_no_nan(\n dtp, math_ops.maximum(dp,...
[ "0.6337302", "0.62020224", "0.5858441", "0.57893836", "0.570654", "0.5665017", "0.565793", "0.56508225", "0.56508225", "0.5629145", "0.56276184", "0.5604692", "0.5604692", "0.5554348", "0.5512706", "0.5496268", "0.5491129", "0.5452334", "0.545181", "0.5449995", "0.54353005", ...
0.7596389
0
Compute the recall at the given IoU threshold. It's an indication of how many GT boxes were found by the given prediction boxes.
def compute_recall(pred_boxes, gt_boxes, iou): # Measure overlaps overlaps = compute_overlaps(pred_boxes, gt_boxes) iou_max = np.max(overlaps, axis=1) iou_argmax = np.argmax(overlaps, axis=1) positive_ids = np.where(iou_max >= iou)[0] matched_gt_boxes = iou_argmax[positive_ids] recall = len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_recall(self, candidate_boxes=None, thresholds=None,\n area='all', limit=None):\n # Record max overlap value for each gt box\n # Return vector of overlap values\n areas = {'all': 0, 'small': 1, 'medium': 2, 'large': 3,\n '96-128': 4, '128-256': 5, '256-512': 6,...
[ "0.62621534", "0.61025965", "0.60362554", "0.5993026", "0.5992019", "0.598062", "0.59323263", "0.59282094", "0.5892321", "0.5827981", "0.5823096", "0.58173424", "0.5814973", "0.5813788", "0.5794595", "0.5781545", "0.5735283", "0.5735052", "0.57166195", "0.5709846", "0.5678209...
0.76745695
0
Splits inputs into slices and feeds each slice to a copy of the given computation graph and then combines the results. It allows you to run a graph on a batch of inputs even if the graph is written to support one instance only.
def batch_slice(inputs, graph_fn, batch_size, names=None): if not isinstance(inputs, list): inputs = [inputs] outputs = [] for i in range(batch_size): inputs_slice = [x[i] for x in inputs] output_slice = graph_fn(*inputs_slice) if not isinstance(output_slice, (tuple, list)):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_internal_graph(self, inputs, training=None, mask=None):\n # Note: masking support is relevant mainly for Keras.\n # It cannot be factored out without having the fully reimplement the network\n # calling logic on the Keras side. We choose to incorporate it in\n # Network because 1) it may be us...
[ "0.63945144", "0.6256652", "0.6116395", "0.610563", "0.60253406", "0.59494936", "0.5906976", "0.58991504", "0.5889422", "0.5747426", "0.572625", "0.57195914", "0.57115", "0.5608972", "0.56036955", "0.55904204", "0.55904204", "0.5562665", "0.55203986", "0.5502477", "0.54940283...
0.6462404
0
Download COCO trained weights from Releases.
def download_trained_weights(coco_model_path, verbose=1): if verbose > 0: print("Downloading pretrained model to " + coco_model_path + " ...") with urllib.request.urlopen(COCO_MODEL_URL) as resp, open(coco_model_path, 'wb') as out: shutil.copyfileobj(resp, out) if verbose > 0: print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_pretrained_weights(env_name):\n print('Downloading model weights to ')\n os.system('mkdir -p %s' % MODEL_CACHE_DIR)\n os.system('cd \"%s\" && curl -s -S \"%s\" > %s' %\n (MODEL_CACHE_DIR, ENV_TO_URL[env_name], ENV_TO_FNAME[env_name]))", "def download():\n basedir = os.path.dirname(o...
[ "0.6020204", "0.5707817", "0.55433", "0.5521925", "0.542334", "0.5288183", "0.5267926", "0.52549994", "0.51362795", "0.5122463", "0.51079065", "0.5062796", "0.5055925", "0.50515425", "0.50506604", "0.50467", "0.50458384", "0.50201833", "0.5007972", "0.49885204", "0.4973859", ...
0.6550675
0
Converts boxes from pixel coordinates to normalized coordinates.
def norm_boxes(boxes, shape): h, w = shape scale = np.array([h - 1, w - 1, h - 1, w - 1]) shift = np.array([0, 0, 1, 1]) return np.divide((boxes - shift), scale).astype(np.float32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_image_coords(self, boxes, height, width):\n box_coords = np.zeros_like(boxes)\n box_coords[:, 0] = boxes[:, 0] * height\n box_coords[:, 1] = boxes[:, 1] * width\n box_coords[:, 2] = boxes[:, 2] * height\n box_coords[:, 3] = boxes[:, 3] * width\n \n return bo...
[ "0.68868893", "0.68544734", "0.6806951", "0.680621", "0.6679069", "0.66423506", "0.6616238", "0.6581388", "0.6555221", "0.6463992", "0.6444687", "0.6427912", "0.642191", "0.6411296", "0.6409057", "0.63507575", "0.6326939", "0.63160884", "0.6313592", "0.6240533", "0.62274957",...
0.63272595
16
Converts boxes from normalized coordinates to pixel coordinates.
def denorm_boxes(boxes, shape): h, w = shape scale = np.array([h - 1, w - 1, h - 1, w - 1]) shift = np.array([0, 0, 1, 1]) return np.around(np.multiply(boxes, scale) + shift).astype(np.int32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_image_coords(self, boxes, height, width):\n box_coords = np.zeros_like(boxes)\n box_coords[:, 0] = boxes[:, 0] * height\n box_coords[:, 1] = boxes[:, 1] * width\n box_coords[:, 2] = boxes[:, 2] * height\n box_coords[:, 3] = boxes[:, 3] * width\n \n return bo...
[ "0.75712496", "0.70867115", "0.6775384", "0.67204654", "0.660275", "0.6589974", "0.6581208", "0.654033", "0.6539582", "0.6535337", "0.6491841", "0.64614946", "0.64540744", "0.64395887", "0.64245975", "0.64113736", "0.6410515", "0.6381608", "0.63608825", "0.6334851", "0.629560...
0.0
-1
A wrapper for ScikitImage resize(). ScikitImage generates warnings on every call to resize() if it doesn't receive the right parameters. The right parameters depend on the version of skimage. This solves the problem by using different parameters per version. And it provides a central place to control resizing defaults.
def resize(image, output_shape, order=1, mode='constant', cval=0, clip=True, preserve_range=False, anti_aliasing=False, anti_aliasing_sigma=None): if LooseVersion(skimage.__version__) >= LooseVersion("0.14"): # New in 0.14: anti_aliasing. Default it to False for backward # compatibility w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_img(img, STANDARD_SIZE, verbose=False):\n if verbose:\n print \"changing size from %s to %s\" % (str(img.size), str(STANDARD_SIZE))\n img = img.resize(STANDARD_SIZE)\n return img", "def resize(img, x_scale, y_scale, optimize=True):\n interpolation = cv.INTER_LINEAR\n\n # pick an ...
[ "0.6523847", "0.64584726", "0.634822", "0.62387604", "0.61824757", "0.61671", "0.61054593", "0.61029464", "0.6078603", "0.60667974", "0.60569525", "0.60493225", "0.60473925", "0.602524", "0.6010532", "0.5983239", "0.5977212", "0.5962961", "0.5949879", "0.5918345", "0.59152895...
0.5944985
19
Ouput the probability assigned to the predicted class label
def predict_proba(self, x): scores = self.forward(x) scores = F.softmax(scores, dim=1) probs, predictions = scores.max(1) return probs, predictions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, testData=[]):\n result = []\n for classValue in self._classAttrs:\n #print(f'Computing Label: {classValue}, {self._classLabelMap[classValue]}')\n result.append(self._computeCondProb(testData, classValue))\n return self._classLabelMap[result.index(max(res...
[ "0.757653", "0.7374608", "0.71136236", "0.71083784", "0.7088286", "0.70875514", "0.7081029", "0.7028333", "0.6985528", "0.6969515", "0.6936937", "0.6908614", "0.68896395", "0.6848533", "0.6847466", "0.68329763", "0.6827754", "0.68091077", "0.6806938", "0.6783956", "0.67832845...
0.0
-1
Computes the area of the polygon formed by the two borders of the cells
def area(sx, dx): #make the polygon from the coordinates dataframes polsx = sx polsx = polsx.reset_index(drop = True) polsx.columns = ["x","y"] poldx = dx poldx = poldx.reset_index(drop = True) poldx.columns = ["x","y"] #sometimes Polygon takes the wrong order from the dataframe so i rev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polygon_area(x, y):\n return 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)))", "def polygon_area_2d(polygon):\r\n return geometry.gmPolygonArea(polygon)", "def polygon_area(nodes, edges):\n # extract the (x, y) coordinates of the boundary nodes in the order\n x = []\n y = [...
[ "0.7552802", "0.7258244", "0.7185722", "0.717917", "0.7128212", "0.7111392", "0.7071247", "0.7070617", "0.7019341", "0.7001358", "0.6988815", "0.6931913", "0.6912602", "0.6905599", "0.6905145", "0.6893624", "0.6893624", "0.6893216", "0.68896395", "0.68792206", "0.6866619", ...
0.6524727
54
Makes the comparison between the areas found by the fronts and the hand drawn fronts
def comparison(): path = "Data/data_fronts/" path1 = "Results/labelled_images1010/fronts/" #computes the areas for the first frame in order to normalize the other areas pol0 = pd.DataFrame(pd.read_csv(path1 + "fronts_labelled.m.0.png.txt",sep =' ')) #makes an object polygon in order to compute the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareAreas(self):\n self.play(area_ABE_copy.animate.move_to(RIGHT*2).scale(0.5),\n area_ABD_copy.animate.move_to(RIGHT*3.45).scale(0.5),\n area_ABC_copy.animate.move_to(RIGHT*5.3).scale(0.5))\n \n global geq_1, geq_2\n geq_1 = always_redraw(\n ...
[ "0.6685574", "0.6605892", "0.62640494", "0.5846008", "0.5673034", "0.5656782", "0.56183696", "0.5525242", "0.54825574", "0.5430052", "0.5400948", "0.5369326", "0.53554475", "0.53546107", "0.5341256", "0.5335645", "0.5331851", "0.5317563", "0.5290342", "0.5276358", "0.5259017"...
0.65753627
2
Makes the comparison between the areas found by the fronts and the hand drawn fronts
def fast_comparison(path = "Data/data_fronts/",path1 = "Results/modified_images/fronts/"): #computes the areas for the first frame in order to normalize the other areas pol0dx = grid(path1+"m_0.png_dx.txt") pol0dx.columns = ["y","x"] pol0sx = grid(path1+"m_0.png_sx.txt") pol0sx.columns = ["y","x"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareAreas(self):\n self.play(area_ABE_copy.animate.move_to(RIGHT*2).scale(0.5),\n area_ABD_copy.animate.move_to(RIGHT*3.45).scale(0.5),\n area_ABC_copy.animate.move_to(RIGHT*5.3).scale(0.5))\n \n global geq_1, geq_2\n geq_1 = always_redraw(\n ...
[ "0.66837907", "0.6575163", "0.6263167", "0.58445203", "0.56722116", "0.56547314", "0.56170374", "0.55234486", "0.54833543", "0.54306924", "0.54007286", "0.53672487", "0.5356115", "0.5355021", "0.53413737", "0.5333159", "0.53326285", "0.53160363", "0.5291504", "0.52766323", "0...
0.6605803
1
Computes the error between two arrays of areas in L^2
def error(area, area_hand): #computes the error in L^2 between the two areas error = np.sqrt((area - area_hand)**2) return np.array(error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_error(d1, d2):\n square_sum = 0.0\n for i in range(len(d1)):\n square_sum += pow( distributions_EMD(d1[i], d2[i]), 2)\n return math.sqrt(square_sum)", "def l2_error(dist_orig, dist_proj):\n return torch.mean((dist_orig - dist_proj) ** 2).item()", "def l2_error(self, X=None, y=N...
[ "0.65325993", "0.63615954", "0.6179437", "0.609222", "0.605296", "0.6028187", "0.599732", "0.5983641", "0.5969193", "0.5934326", "0.5855971", "0.5838469", "0.5831721", "0.57680076", "0.57575697", "0.57521516", "0.57331836", "0.5730827", "0.5712154", "0.5709225", "0.57017916",...
0.7461862
0
Computes the interpolation based on the distance of x and y
def necklace_points(df,N=100,method='quadratic'): points = df points = points.values if points.T[1][0]>points.T[1][-1]: points=points[::-1] # Linear length along the line: distance = np.cumsum( np.sqrt(np.sum( np.diff(points, axis=0)**2, axis=1 )) ) distance = np.insert(distance, 0, 0)/d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate(self, distance, normalized=...): # -> BaseGeometry:\n ...", "def __call__(self, x, y):\n #- TODO: compare speed to solution at\n #- http://stackoverflow.com/questions/12729228/simple-efficient-bilinear-interpolation-of-images-in-numpy-and-python\n \n #- Find wh...
[ "0.74763143", "0.74462795", "0.7319428", "0.6918792", "0.6713479", "0.6679906", "0.6628338", "0.6622846", "0.6523665", "0.64880437", "0.6467035", "0.644733", "0.6429274", "0.64286536", "0.6382073", "0.6373567", "0.6341869", "0.63415915", "0.62522244", "0.62355286", "0.6230538...
0.0
-1
Makes an approximation of the fronts dividing the range in subintervals and for each subinterval takes the max value in that interval.
def grid(df, N = 100, l = 1200, side = "sx"): #variables for the intervals of the grid min_x = 0 max_x = l delta = l/float(N) grid = df grid.columns = [0,1] grid = grid.sort_values(by = 1) #makes a new aray where will be the smoothed fronts grid_smooth=np.empty((2,N)) #makes the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_values(self, lower, upper):\n if not self.upper_bounds is None:\n return self.upper_bounds\n\n minus = np.clip(self.coeffs,-math.inf,0)\n plus = np.clip(self.coeffs,0,math.inf)\n self.upper_bounds = plus.dot(upper) + minus.dot(lower) + self.const\n \n re...
[ "0.66897374", "0.64998215", "0.6440705", "0.6252599", "0.62063515", "0.6113716", "0.61022276", "0.6075901", "0.6067187", "0.6034195", "0.5965521", "0.5950584", "0.59467804", "0.5936569", "0.59013295", "0.5887589", "0.5885376", "0.5840551", "0.58273983", "0.58234775", "0.58077...
0.0
-1
Computes the velocity of the fronts. Since the Delta t is defined by the single frame, the velocity of the front results to be only the difference between the final and the initial position between two frames
def velocity(df0, df1): velocity = df1 - df0 return velocity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_frame_vels(self):\n num_frames = self.get_num_frames()\n frame_vel_size = self.get_frame_vel_size()\n dt = self.get_frame_duration()\n frame_vels = np.zeros([num_frames, frame_vel_size])\n\n for f in range(num_frames - 1):\n frame0 = self.get_frame(f)\n frame1 = self.get_frame(f ...
[ "0.6244868", "0.61821187", "0.60186166", "0.6012535", "0.597797", "0.59639156", "0.5961367", "0.5956541", "0.5949349", "0.5946402", "0.5931904", "0.5884024", "0.5822902", "0.578919", "0.57804185", "0.5740533", "0.5727816", "0.56713223", "0.56561303", "0.56134444", "0.55979645...
0.6255532
0
Computes the Velocity Autocorrelation Fuction (VACF) which is the correlation between the velocities of the fronts
def VACF(df,conversion = "x"): #conversion from pixels to micrometers if conversion == "y": df = df/1200*633 else: df = df/1600*844 #computes the velocity in one direction between the frames dif = pd.DataFrame() for i in range(1,len(df.T)): dif[i-1] = velocity(df[i-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arma_acf(ar, ma, lags=10):\n acovf = arma_acovf(ar, ma, lags)\n return acovf / acovf[0]", "def to_acf(self):\n rho = 0.5*np.fft.irfft(self) / self.delta_t\n return AutoCovariance(rho, delta_t=self.delta_t)", "def acorrelation(X):\r\n C = acovariance(X)\r\n V = N.diagonal(C)\r\n ...
[ "0.6702072", "0.66773623", "0.6595808", "0.63585", "0.621406", "0.6199433", "0.6074216", "0.5957068", "0.5952068", "0.59308684", "0.58676976", "0.5809938", "0.5808968", "0.5808968", "0.57998204", "0.57998204", "0.5779451", "0.5774701", "0.5768634", "0.57117593", "0.5701248", ...
0.7130035
0
Computes the Mean Square Displacement (MSD) which is the mean squared difference between the y coordinates of the fronts
def MSD_Sham(dir, side = "dx", delimiter = "\t"): x = pd.DataFrame() y = pd.DataFrame() for fname in os.listdir(dir): if side in fname: k = fname.split('_')[-2] k = int(k) #df = grid(dir + fname + str(i+1) + side + ".txt", delimiter = delimiter) dfx, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_mean_square_displacement(self):\n # compute the current_positions by adding the number of crossings of the system\n current_positions = self.positions + self.crossings\n # get the dx vector between the current position and the initial positions for all particles\n dx = curre...
[ "0.6706372", "0.6380913", "0.6317311", "0.59720457", "0.5931211", "0.591202", "0.5905131", "0.5895542", "0.58468115", "0.58449733", "0.58386844", "0.58273387", "0.58237064", "0.58074224", "0.57953835", "0.57770765", "0.5766499", "0.57611054", "0.57602835", "0.57558906", "0.57...
0.0
-1
Computes the Mean Square Displacement (MSD) which is the mean squared difference between the x or y coordinates of the fronts
def MSD(df, conversion = "x"): #conversion from pixels to micrometers if conversion == "y": df = df/1200*633 else: df = df/1600*844 msd = [] for i in range(len(df)): #computes the msd for the x or y coordinates between the different frames msd.append(tidynamics.msd(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_mean_square_displacement(self):\n # compute the current_positions by adding the number of crossings of the system\n current_positions = self.positions + self.crossings\n # get the dx vector between the current position and the initial positions for all particles\n dx = curre...
[ "0.6966176", "0.61639786", "0.6018065", "0.5993215", "0.5912783", "0.58723664", "0.5847443", "0.5834911", "0.58309865", "0.5812362", "0.58062315", "0.58034176", "0.5803261", "0.57953024", "0.57795405", "0.57587886", "0.5740806", "0.57335556", "0.5715038", "0.571395", "0.57075...
0.53968173
60
The function for the fit of the Mean Squared Displacement (MSD) and the Valocity Autocorrelation Function (VACF)
def func(x,D,a): return D*x**a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def V_fit(x, a, b, c, d, e, f):\n x1 = x[0] # I\n x2 = x[1] # dT\n m = (a * x1 ** 2 + b * x1 + c)\n b = (d * x1 ** 2 + e * x1 + f)\n return m * x2 + b", "def VarianceOfAbsAcceleration(self):\n H = []\n for i in range(len(self.omega_range)):\n \"\"\"Calculation of the Trans...
[ "0.6198946", "0.5641791", "0.56011695", "0.55843526", "0.54904765", "0.5478402", "0.54771173", "0.5465643", "0.54508656", "0.5439425", "0.54361963", "0.54349506", "0.5405831", "0.53648007", "0.53482056", "0.53214926", "0.5307086", "0.52886397", "0.5286853", "0.52665716", "0.5...
0.0
-1
Return the parameter D ( which is the diffusion coefficient) and a, which is the exponent which tell us if the process is subdiffusive or superdiffusive
def fit(ydata): xdata = np.linspace(0,len(ydata),num = len(ydata)) popt, pcov = curve_fit(func, xdata, ydata) #returns the parameters of the fitting return popt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discriminant(self):\r\n return self.__b**2 - (4 * self.__a * self.__c)", "def extinction_efficiency(self):\r\n n = np.arange(1, self.n + 1)\r\n return 2*np.sum((2*n+1)*np.real(self.a + self.b))/self.x**2", "def _core_calc_degrad(self,bd,Ld) :\n\t\tdegrad = np.dot(Ld,bd) # Do matrix mul...
[ "0.62930554", "0.6032858", "0.59725374", "0.59425664", "0.5927702", "0.57941645", "0.5712847", "0.56772953", "0.5652777", "0.5646484", "0.56391436", "0.55836076", "0.5573688", "0.5548624", "0.5542578", "0.552761", "0.5504785", "0.5503876", "0.54975355", "0.54859763", "0.54796...
0.0
-1
Formats the date taken from the log file in order to align with the sql date format YMD
def format_date(test_date): split_date = test_date.split() split_date[0] = split_date[0].split('/') return ''.join( [split_date[0][2], split_date[0][0], split_date[0][1]] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reformat_date(mdy_date_string):\n date = mdy_date_string.split('/')\n return f\"{date[2]}-{date[0]}-{date[1]}\" # difficult to read", "def format_date(self, data):\n return '%s/%s' % (data.month, data.day)", "def test_format_date(self):\n assert BaseTSVWriter.format_date(FIXED_DATE) == ...
[ "0.6511338", "0.64542186", "0.6451588", "0.6371941", "0.63189375", "0.62899065", "0.626468", "0.62239367", "0.6207798", "0.62021685", "0.6146992", "0.61419857", "0.6121732", "0.6037092", "0.6026142", "0.60041934", "0.5999904", "0.5974926", "0.5921738", "0.5880304", "0.5861925...
0.56192946
43
Takes in a string and determines if the string has all unique characters.
def is_unique(a_string): if len(a_string) is 0: print "String is empty." return False chars = [] for char in a_string: if char not in chars: chars.append(char) else: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_unique(str):\n\n # char_count = {}\n\n # for char in str:\n # count = char_count.get(char, 0)\n\n # if count == 1:\n # return False\n\n # else:\n # char_count[char] = 1\n\n # return True\n\n return len(str) == len(set(str))", "def has_unique_chars(str...
[ "0.86151016", "0.8613927", "0.84924", "0.8390653", "0.8336384", "0.83281904", "0.82862496", "0.8270841", "0.8191371", "0.8183168", "0.81753576", "0.8143583", "0.80594736", "0.8022519", "0.7995879", "0.7965749", "0.79114544", "0.78726995", "0.7841943", "0.77861714", "0.7760643...
0.85300475
2
Takes in a string and determines if the string has all unique characters.
def is_unique2(a_string): if len(a_string) is 0: print "String is empty." return False for i in range(len(a_string)): if a_string[i] in a_string[i+1:]: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_unique(str):\n\n # char_count = {}\n\n # for char in str:\n # count = char_count.get(char, 0)\n\n # if count == 1:\n # return False\n\n # else:\n # char_count[char] = 1\n\n # return True\n\n return len(str) == len(set(str))", "def has_unique_chars(str...
[ "0.861529", "0.8614102", "0.85297453", "0.8492495", "0.83905035", "0.8336132", "0.8327812", "0.8286163", "0.8270551", "0.8191982", "0.81836796", "0.81755346", "0.8143316", "0.80597657", "0.8023318", "0.7995991", "0.79654086", "0.7911735", "0.7873022", "0.78424656", "0.7786826...
0.7717289
22
Takes in a string and determines if the string has all unique characters.
def is_unique3(a_string): if len(a_string) is 0: print "String is empty." return False charset = [False] * 256 for char in a_string: print char if charset[ord(char)]: return False charset[ord(char)] = True return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_unique(str):\n\n # char_count = {}\n\n # for char in str:\n # count = char_count.get(char, 0)\n\n # if count == 1:\n # return False\n\n # else:\n # char_count[char] = 1\n\n # return True\n\n return len(str) == len(set(str))", "def has_unique_chars(str...
[ "0.86153203", "0.8614615", "0.8529938", "0.8492738", "0.8390427", "0.8336505", "0.8327872", "0.8269875", "0.8190885", "0.8182324", "0.8175011", "0.8142256", "0.8060082", "0.8023433", "0.7996046", "0.79665226", "0.7911152", "0.7871877", "0.78428173", "0.77870584", "0.7761677",...
0.82858235
7
Simplest Euler ODE initial value solver
def ode_solve(z0, t0, t1, f): h_max = 0.05 n_steps = math.ceil((abs(t1 - t0) / h_max).max().item()) h = (t1 - t0) / n_steps t = t0 z = z0 for i_step in range(n_steps): z = z + h * f(z, t) t = t + h return z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_initial_condition_euler(self, tol=1e-10):\n Z = zeros((len(self._meshes), len(self._meshes[0].elements)+1))\n for mi, m in enumerate(self._meshes):\n if not m._left_lift:\n raise Exception(\"get_initial_condition_euler() only works if all boundary conditions are give...
[ "0.6278976", "0.6196513", "0.61778826", "0.61417085", "0.6135391", "0.612472", "0.6123873", "0.6113143", "0.6042279", "0.5995978", "0.5992606", "0.5929135", "0.5923891", "0.59184945", "0.58999056", "0.58809644", "0.5873486", "0.58456355", "0.58425784", "0.5832537", "0.5824120...
0.60224956
9
Compute f and a df/dz, a df/dp, a df/dt
def forward_with_grad(self, z, t, grad_outputs): batch_size = z.shape[0] out = self.forward(z, t) a = grad_outputs adfdz, adfdt, *adfdp = torch.autograd.grad( (out,), (z, t) + tuple(self.parameters()), grad_outputs=(a), allow_unused=True, retain_graph=True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(z):\n a=1./(1.+z)\n #da=0.01\n da=0.01*a\n #da=1e-7\n gp,g,gm=[D(1./ia-1.) for ia in [a+da,a,a-da]]\n f=a*(gp-gm)/(2*g*da)\n #dz=0.01\n #gp,g,gm=[D(zi) for zi in [z+dz,z,z-dz]]\n #f=(z)*(gp-gm)/(2.*g*dz)\n return f", "def calc_diff(f, dx):\n \n df = (np.roll(f,-3)/60.-np...
[ "0.65598327", "0.6533953", "0.6445629", "0.64416105", "0.6421207", "0.6414517", "0.6276763", "0.62149906", "0.61623836", "0.6144747", "0.61093503", "0.59886336", "0.59453213", "0.59289813", "0.59204227", "0.58522046", "0.58500564", "0.5848149", "0.58448523", "0.5820977", "0.5...
0.0
-1
tensors here are temporal slices
def augmented_dynamics(aug_z_i, t_i): z_i, a = aug_z_i[:, :n_dim], aug_z_i[:, n_dim:2 * n_dim] # ignore parameters and time # Unflatten z and a z_i = z_i.view(bs, *z_shape) a = a.view(bs, *z_shape) with torch.set_grad_enabled(True): t_i = t_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decompress(self, tensors):", "def construct_map_with_sliders(var_tensor, extvar=[]):\n var_tensor = tf.cast(var_tensor, tf.float32)\n var_shape = var_tensor.shape\n wall_l = 0.15\n wall_r = 0.85\n x_max = 512\n y_max = 384\n out = []\n cp = tf.constant([256, 192, 0, 0])\n phase = 0...
[ "0.59237313", "0.5900721", "0.5883174", "0.58358926", "0.5826405", "0.5722477", "0.57079685", "0.5707707", "0.562491", "0.56208307", "0.55920815", "0.55906343", "0.55804354", "0.5572166", "0.55460525", "0.55390936", "0.5520055", "0.55046904", "0.55034024", "0.54950047", "0.54...
0.0
-1
When this method is called, the agent executes an action based on its Qtable The allowExploration can be turned of to select one action without risk of getting a random action.
def select_action(self, state,allowExploration=True): actions = self.environment.all_actions(forExploration=allowExploration) #Returns any action return actions[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_action(self, agent, action):\n abstract", "def __ExecuteActionForRandomAgentWithNoisyTransitionModel__(self, idx_request_action, noise_level):\n n = len(self.AGENT_ALLOWED_ACTIONS)\n pp = noise_level/(n-1) * np.ones((n,1))\n pp[idx_request_action] = 1.0 - noise_level\n ...
[ "0.7098795", "0.7049997", "0.7011307", "0.70085603", "0.6927966", "0.6927966", "0.6844904", "0.6752088", "0.6737723", "0.67269474", "0.6726928", "0.66863275", "0.6665031", "0.6654349", "0.6645674", "0.66325814", "0.66324943", "0.6631375", "0.65904975", "0.65824896", "0.655624...
0.6421871
30
Returns the size of the QTable
def get_Q_size(self): return len(self.qTable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size(self):\n return len(self.table)", "def Size(self):\n return _table.Table_Size(self)", "def get_table_size(self):\r\n return self.table_size", "def __len__(self) -> int:\n return len(self._table)", "def __len__(self) -> int:\n return len(self.table)", "def n...
[ "0.84217036", "0.8339136", "0.8243864", "0.7573548", "0.756553", "0.75452423", "0.72798103", "0.72645706", "0.722", "0.7214287", "0.71470475", "0.70735765", "0.7053196", "0.70288885", "0.70014083", "0.69187534", "0.69187534", "0.68950015", "0.6887229", "0.6842048", "0.6799798...
0.8351228
1
Performs the standard QLearning Update
def observe_reward(self,state,action,statePrime,reward): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, state, action, nextState, reward):\n \"\"\"Description:\n Use Q-Learning algoritm in slide 58 of MDP\n \"\"\"\n \"\"\" YOUR CODE HERE \"\"\"\n maxQns = self.getValue(nextState) # get max q-value of next state\n if maxQns == None:\n maxQns = 0\n Qsa = self.getQValue(st...
[ "0.72860533", "0.7248721", "0.7104772", "0.70131433", "0.6933749", "0.69023186", "0.6897439", "0.6878899", "0.68225056", "0.67770153", "0.6769734", "0.6769042", "0.6768943", "0.6762251", "0.675095", "0.67383903", "0.6716597", "0.6716597", "0.6688053", "0.66453344", "0.664344"...
0.0
-1
[API router to deploy an AutoML model]
async def deploy_model( deploy_model_request: ManageModel, token: str = Depends(oauth2_scheme), ): try: logging.info("Calling /gcp/automl/deploy_model endpoint") logging.debug(f"Request: {deploy_model_request}") if decodeJWT(token=token): response = ManageModelController(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_model_api():\n inventory_name = request.args.get('inventory_name') or \"strawberry\"\n inventory_name = inventory_name.lower()\n\n model = None\n if is_valid_model(inventory_name):\n model = get_model(inventory_name)\n\n deployed_models[inventory_name] = model\n return \"Deploym...
[ "0.67975754", "0.6421354", "0.617725", "0.6079207", "0.59251535", "0.5920245", "0.5917937", "0.584197", "0.5638889", "0.5625943", "0.56257206", "0.5606921", "0.5595735", "0.55278116", "0.55245316", "0.54917186", "0.54890645", "0.54810137", "0.54787046", "0.5445659", "0.544535...
0.5993189
4
[API router to undeploy a AutoML model]
async def undeploy_model( undeploy_model_request: ManageModel, token: str = Depends(oauth2_scheme), ): try: logging.info("Calling /gcp/automl/undeploy_model endpoint") logging.debug(f"Request: {undeploy_model_request}") if decodeJWT(token=token): response = ManageModelCon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UndeployModel(self, request, global_params=None):\n config = self.GetMethodConfig('UndeployModel')\n return self._RunMethod(\n config, request, global_params=global_params)", "def unload_model(app: FastAPI) -> None:\n\n logging.info(\"Shuting down the app\")\n app.state.model = None"...
[ "0.73572034", "0.65931576", "0.6241049", "0.6191326", "0.61793065", "0.61463386", "0.60557854", "0.6005815", "0.6002277", "0.58911914", "0.5883165", "0.5864652", "0.583561", "0.58052224", "0.5799982", "0.5774924", "0.5772157", "0.57606065", "0.5738826", "0.5733435", "0.567713...
0.73963165
0
[API router to list all autoML models]
async def list_models( list_models_request: ListModels, token: str = Depends(oauth2_scheme), ): try: logging.info("Calling /gcp/automl/list_models endpoint") logging.debug(f"Request: {list_models_request}") if decodeJWT(token=token): response = ManageModelController().lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opt_get_all_models_rest_api():\n return retrieve_all_models()", "def index(self, req):\n return self._get_models(req, is_detail=False)", "def ListModels(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "def list_models(\n architecture: Optional[str...
[ "0.7432265", "0.67710197", "0.6650352", "0.66157657", "0.6412069", "0.63923717", "0.6368158", "0.6323094", "0.63016313", "0.63016313", "0.63005906", "0.62834233", "0.62803614", "0.61695796", "0.60627615", "0.6009803", "0.59790945", "0.5969741", "0.5942163", "0.5926064", "0.58...
0.6140692
14
[API router to get model description]
async def get_model_description( get_model_description_request: DescriptionModels, token: str = Depends(oauth2_scheme), ): try: logging.info("Calling /gcp/automl/get_model_description endpoint") logging.debug(f"Request: {get_model_description_request}") if decodeJWT(token=token): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getModelDesc():\n\n return \"Example model template\"", "def model_info():\n pass", "def describe_model(ModelName=None):\n pass", "def detail(model_id: str = typer.Argument(..., help='Model ID')):\n with requests.get(f'{app_settings.api_v1_prefix}/model/{model_id}') as r:\n data = r.js...
[ "0.74278885", "0.72100854", "0.7075913", "0.7006186", "0.68071127", "0.6690818", "0.6629447", "0.6569052", "0.6503898", "0.64079887", "0.63255906", "0.6302595", "0.6290094", "0.6284655", "0.62740713", "0.6245484", "0.6191554", "0.6186802", "0.6186802", "0.6186802", "0.6186802...
0.6072023
36
[API router to get model description]
async def get_model_evaluation( get_model_evaluation_request: DescriptionModels, token: str = Depends(oauth2_scheme), ): try: logging.info("Calling /gcp/automl/get_model_evaluation endpoint") logging.debug(f"Request: {get_model_evaluation_request}") if decodeJWT(token=token): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getModelDesc():\n\n return \"Example model template\"", "def model_info():\n pass", "def describe_model(ModelName=None):\n pass", "def detail(model_id: str = typer.Argument(..., help='Model ID')):\n with requests.get(f'{app_settings.api_v1_prefix}/model/{model_id}') as r:\n data = r.js...
[ "0.74278885", "0.72100854", "0.7075913", "0.7006186", "0.68071127", "0.6690818", "0.6629447", "0.6569052", "0.6503898", "0.64079887", "0.63255906", "0.6302595", "0.6290094", "0.6284655", "0.62740713", "0.6245484", "0.6191554", "0.6186802", "0.6186802", "0.6186802", "0.6186802...
0.0
-1
[API router to delete AutoML model]
async def delete_model( delete_model_request: DeleteModels, token: str = Depends(oauth2_scheme), ): try: logging.info("Calling /gcp/automl/delete_model endpoint") logging.debug(f"Request: {delete_model_request}") if decodeJWT(token=token): response = ManageModelController...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opt_delete_model_rest_api(model_id):\n return delete_model_data(model_id)", "def DeleteModel(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "def delete_model(self, request, instance):\n pass", "def delete_model(ModelName=None):\n pass", "def delete...
[ "0.74440473", "0.7271275", "0.7212634", "0.7045793", "0.679965", "0.67952406", "0.6778194", "0.66648835", "0.6658815", "0.66291076", "0.65967035", "0.65883905", "0.6585231", "0.65569973", "0.65512174", "0.6513304", "0.6474453", "0.64397734", "0.6434618", "0.6423123", "0.64231...
0.6713244
7
Creates an instance of this client using the provided credentials info.
def from_service_account_info(cls, info: dict, *args, **kwargs): return PublisherServiceClient.from_service_account_info.__func__(PublisherServiceAsyncClient, info, *args, **kwargs) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_credentials(credentials):\n return API(\n username=credentials.username,\n password=credentials.password,\n database=credentials.database,\n session_id=credentials.session_id,\n server=credentials.server,\n )", "def client():\n retu...
[ "0.7084164", "0.6895784", "0.6610505", "0.6400965", "0.6400965", "0.6395601", "0.6389145", "0.63587", "0.6351121", "0.6340887", "0.6340205", "0.633686", "0.6331628", "0.63234246", "0.6297002", "0.62733454", "0.62672657", "0.6265198", "0.6211646", "0.6199081", "0.6180081", "...
0.58073014
59
Creates an instance of this client using the provided credentials file.
def from_service_account_file(cls, filename: str, *args, **kwargs): return PublisherServiceClient.from_service_account_file.__func__(PublisherServiceAsyncClient, filename, *args, **kwargs) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_file(cls, filename, **kwargs):\n return super(Credentials, cls).from_file(filename, **kwargs)", "def from_service_account_file(cls, filename: str, *args, **kwargs):\n return Controller2Client.from_service_account_file.__func__(Controller2AsyncClient, filename, *args, **kwargs) # type: ign...
[ "0.708768", "0.67545366", "0.6722142", "0.67080176", "0.67009336", "0.6663084", "0.6663084", "0.6663084", "0.6658751", "0.6658751", "0.65014106", "0.649276", "0.6472659", "0.6467851", "0.6391994", "0.6375295", "0.63744223", "0.6354681", "0.62859195", "0.62786347", "0.62652254...
0.601436
32
Returns the transport used by the client instance.
def transport(self) -> PublisherServiceTransport: return self._client.transport
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transport(self):\n return self._transport", "def transport(self) -> TraceServiceTransport:\n return self._client.transport", "def transport(self) -> ServiceControllerTransport:\n return self._client.transport", "def transport(self) -> MetadataServiceTransport:\n return self._c...
[ "0.82946277", "0.7887542", "0.773594", "0.773068", "0.76806635", "0.7674273", "0.76357967", "0.7558095", "0.7551682", "0.75303864", "0.74958986", "0.7488142", "0.7436853", "0.7368433", "0.73340607", "0.721926", "0.7109823", "0.7102308", "0.68808985", "0.68144", "0.6671675", ...
0.7423566
13
Instantiates the publisher service client.
def __init__( self, *, credentials: ga_credentials.Credentials = None, transport: Union[str, PublisherServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_setup(self):\n self.client = Client()", "def _CreatePubsubClient():\n client = pubsub_client.PubSubClient()\n client.CreateTopic(DEVICE_NOTE_PUBSUB_TOPIC)\n client.CreateTopic(HOST_NOTE_PUBSUB_TOPIC)\n return client", "def create_client(self) -> None:\n pass", "def create_client(self...
[ "0.6814219", "0.6603148", "0.6296222", "0.6273346", "0.6272793", "0.6184935", "0.6142706", "0.6142319", "0.61270845", "0.6113662", "0.6101793", "0.60950136", "0.6036625", "0.60295045", "0.6023517", "0.6020195", "0.5991119", "0.59851164", "0.5982286", "0.59499663", "0.59193116...
0.7053379
0
r"""Establishes a stream with the server for publishing messages. Once the stream is initialized, the client publishes messages by sending publish requests on the stream. The server responds with a PublishResponse for each PublishRequest sent by the client, in the same order that the requests were sent. Note that multi...
def publish( self, requests: AsyncIterator[publisher.PublishRequest] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> Awaitable[AsyncIterable[publisher.PublishResponse]]: # Wrap t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_publishing(self):\n print(f\"{self._connection_param}: Issuing consumer related RPC commands\")\n # self._channel.confirm_delivery(self.on_delivery_confirmation)\n self.schedule_next_message(self.SLOW_SEND)", "def test_stream_publish(self):\n pass", "def stream(self, repla...
[ "0.6385019", "0.6283657", "0.62584347", "0.62273216", "0.61827046", "0.61629355", "0.61482024", "0.6066445", "0.5997109", "0.591492", "0.5840306", "0.5826994", "0.5812375", "0.58092064", "0.57881904", "0.57806206", "0.5753054", "0.5748098", "0.5740442", "0.57194793", "0.57106...
0.62381107
3
Calls multiple time with retry.
def call(self, request=None, *args, **kwargs): if request is not None: self.request = request retry = self.request.configuration.retry if not isinstance(retry, SimpleRetry): raise Error('Currently only the fast retry strategy is supported') last_exception = None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retry_occurred(self):", "def retry(times):\n return repeat_with_success_at_least(times, 1)", "def retry(self, times):\n return Retry((requests.ConnectionError, requests.Timeout), times)", "def retry_multi(max_retries=5):\n\n def retry(func):\n @wraps(func)\n def wrapper(*args,...
[ "0.7541673", "0.7499093", "0.7474191", "0.7330312", "0.7289515", "0.7275474", "0.69946194", "0.6966883", "0.69495356", "0.6930432", "0.6859438", "0.68335676", "0.68318886", "0.67898613", "0.678004", "0.67352784", "0.6731087", "0.66999316", "0.669435", "0.66890466", "0.6672457...
0.65164095
30
Converts given value to long if possible, otherwise None is returned.
def field_to_long(value): if isinstance(value, (int, long)): return long(value) elif isinstance(value, basestring): return bytes_to_long(from_hex(value)) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_long_int(val):\n return long(val) if six.PY2 else int(val)", "def to_long(x):\n if isinstance(x, long):\n return x\n elif isinstance(x, int):\n return long(x)\n else:\n return bytes_to_long(to_bytes(x))", "def getLong(t, swipl):\n i = c_long()\n if swipl.PL_get_long(...
[ "0.74933696", "0.715573", "0.67231256", "0.6618173", "0.6471894", "0.6345347", "0.6273417", "0.6199922", "0.6176904", "0.6092171", "0.6039979", "0.59916466", "0.5962227", "0.59519756", "0.59280604", "0.58702356", "0.5813299", "0.57505965", "0.57384586", "0.57117707", "0.57028...
0.8211291
0
Extracts textual status from the response statusdetail, if present. Otherwise extracts status field.
def get_text_status(json): if json is None: return None elif 'statusdetail' in json: return json['statusdetail'] elif 'status' in json: return json['status'] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_status(self, status_headers):\n self.status = status_headers.get_statuscode()\n if not self.status:\n self.status = '-'", "def extract_status(self, status) -> None:\r\n if \"VehicleInfo\" in status:\r\n if \"RemoteHvacInfo\" in status[\"VehicleInfo\"]:\r\n ...
[ "0.71241224", "0.69161105", "0.64333415", "0.6411626", "0.637063", "0.633951", "0.6296589", "0.6296589", "0.62450236", "0.6228615", "0.6178295", "0.616995", "0.6121935", "0.60539556", "0.6043532", "0.6018284", "0.59186006", "0.5911772", "0.5887343", "0.5886755", "0.5885079", ...
0.7453901
0
Performs one API request. Raises exception on failure.
def call_once(self, request=None, *args, **kwargs): if request is not None: self.request = request config = self.request.configuration if config.http_method != EBConsts.HTTP_METHOD_POST or config.method != EBConsts.METHOD_REST: raise Error('Not implemented yet, only REST...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _request_one(self, url, header, id, index, session):\n async with session.get(url=url, headers=header) as resp:\n status = resp.status\n if status == '200':\n self.logger.info(\"[%s] Request for url %s, header: %s\", index, url, header)\n result ...
[ "0.660848", "0.64304566", "0.641587", "0.6358635", "0.63426375", "0.6338766", "0.6335184", "0.630673", "0.63005996", "0.6273256", "0.6261616", "0.6245517", "0.62402403", "0.6220143", "0.6220143", "0.61883336", "0.61802566", "0.61773384", "0.6166584", "0.61428225", "0.6137324"...
0.59837574
36
Checks response after request was made. Checks status of the response, mainly
def check_response(self, resp): # For successful API call, response code will be 200 (OK) if resp.ok: json = resp.json() self.response = ResponseHolder() self.response.response = json # Check the code if 'status' not in json: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_check(response):\n print(response)\n print(response.text)\n return response.status_code == 200", "def _check_response(self, res: requests.Response, token: str) -> None:\n return", "def response_check(response):\n print(response)\n print(response.text)\n return response.sta...
[ "0.7452881", "0.7442197", "0.7356236", "0.7327101", "0.7195795", "0.7139699", "0.7128513", "0.70273316", "0.69047374", "0.6885308", "0.687781", "0.6869948", "0.68602526", "0.68387777", "0.68387234", "0.6829005", "0.6815245", "0.6805538", "0.6786491", "0.6731174", "0.6709148",...
0.6998442
8
return next larger sparse number
def next_sparse(sparse_number): # print("sparse_number 0b{0:b}".format(sparse_number)) # Edge case. Handle explicitly for clarity if sparse_number == 0: return 1 power_max = twos_power_max(sparse_number) for power in range(0, power_max): # print("power", power) if is_zero...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_sparse_incremental(sparse_number):\n\n\n # limit is arbitrary in Python\n # http://stackoverflow.com/questions/5470693/python-number-limit\n limit = 2 ** 32\n for possible_sparse in range(sparse_number + 1, limit):\n if is_sparse(possible_sparse):\n return possible_sparse\n ...
[ "0.7672728", "0.61580247", "0.61358225", "0.60774994", "0.59932333", "0.58844113", "0.58825076", "0.58825076", "0.5832039", "0.5826069", "0.56333584", "0.56146306", "0.55914325", "0.55845207", "0.55805635", "0.55033994", "0.5497962", "0.5486491", "0.547879", "0.5476193", "0.5...
0.74779063
1
return next larger sparse number
def next_sparse_incremental(sparse_number): # limit is arbitrary in Python # http://stackoverflow.com/questions/5470693/python-number-limit limit = 2 ** 32 for possible_sparse in range(sparse_number + 1, limit): if is_sparse(possible_sparse): return possible_sparse return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_sparse(sparse_number):\n\n # print(\"sparse_number 0b{0:b}\".format(sparse_number))\n\n # Edge case. Handle explicitly for clarity\n if sparse_number == 0:\n return 1\n\n power_max = twos_power_max(sparse_number)\n\n for power in range(0, power_max):\n # print(\"power\", power...
[ "0.7477969", "0.61573946", "0.613509", "0.60775334", "0.5992545", "0.58828956", "0.588183", "0.588183", "0.5831891", "0.5825192", "0.56328684", "0.56140053", "0.559014", "0.5583566", "0.5578744", "0.55031174", "0.5497666", "0.548524", "0.5477917", "0.5475614", "0.5440766", ...
0.7672149
0
return True if number binary digit 1s have no adjacent 1s.
def is_sparse(number): if number == 0: return True if number == 1: # edge case. List explicitly for clarity. Define to be True return True else: bits = bits_list(number) # start power_of_2 at 1 so previous_bit index won't be out of list range for power_of_2 i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onlyonepositive(a):\n nbr = 0\n for e in a:\n if e >= 0: \n nbr += 1\n if nbr>1: return False\n return nbr==1", "def count_ones(value):\n return bin(value).count('1')", "def __nonzero__(self):\n for e in self:\n if e != 0:\n return T...
[ "0.6595635", "0.6540053", "0.6482591", "0.63950247", "0.63907003", "0.6204543", "0.61807245", "0.6171981", "0.61649305", "0.6097352", "0.6066647", "0.60572785", "0.6053024", "0.60443586", "0.6039504", "0.60368466", "0.6022546", "0.6005996", "0.5991123", "0.59874594", "0.59751...
0.6741046
0