query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
For timedependent runs plot maximum displacements versus time
def plot_maxdisp_time(pointsh5, xscale=1e3, yscale=1e-2, tscale=3.1536e7, adjustRadial=False): coords,data,number,times = pu.load_h5_visco(pointsh5) x = coords[:,0] ur = np.hypot(data[:,:,0], data[:,:,1]) uz = data[:,:,2] # Convert units & extract maximums for each timestep ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_displacements(ds):\n # Se obtienen una matriz de datos con los desplazamientos promedios de cada imagen\n t = ds['t']\n t = t[:n_im-1]\n t = mplt.dates.date2num(t)\n d = ds['d_t']\n \n # Se grafica la curva Desplazamientos promedios vs Tiempo\n formatter = DateFormatter(\"%d/%m - %H...
[ "0.5977297", "0.59203607", "0.591389", "0.5904414", "0.58950406", "0.5851301", "0.583456", "0.5795047", "0.5763769", "0.57332605", "0.569345", "0.567947", "0.56562036", "0.56409806", "0.5510336", "0.54855245", "0.54765123", "0.54744595", "0.54681593", "0.5465856", "0.546511",...
0.6763449
0
Convert scale term to unit label
def get_unit(scale): scale2unit = { 1e-9: 'nm', 1e-6: u'\N{MICRO SIGN}m', #or hex id (lookup): u'\u00B5' 1e-3: 'mm', 0.01: 'cm', 0.1:'dm', 1:'m', 1000:'km', # time ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_scale_name(self):", "def to_axis_units(self, label, vals):\n if label in ['Hmolar', 'Smolar', 'Umolar', 'Dmolar', 'P']:\n return vals / 1000\n elif label in ['T']:\n return vals\n else:\n raise ValueError(label)", "def labels_x(x_unit, latex = Tru...
[ "0.66115385", "0.64944685", "0.6276687", "0.62619853", "0.6258747", "0.6168202", "0.6106348", "0.6104452", "0.6032182", "0.59474814", "0.59472513", "0.593621", "0.5931593", "0.591483", "0.59085834", "0.5896219", "0.58899754", "0.588468", "0.58570886", "0.5837348", "0.5832844"...
0.7126686
0
Plot profiles for each output/step0X folder on same figure
def plot_directory_profiles(path, outname=None, show=True, xscale=1, yscale=1, xval='x', adjustRadial=True): outdirs = np.sort(os.listdir(path)) plt.figure() #labels=['homogeneous','1D layering', '3D tomography'] #xscale=1e-3, yscale=1e2 for i,outdir in enumerate(outdirs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_ratios(path='/Volumes/OptiHDD/data/pylith/3d/agu2014/output',\n\t\t\t\tsteps=['step01','step02'],\n\t\t\t\t#labels='',\n\t\t\t\tshow=True,\n\t\t\t\txscale=1e3,\n\t\t\t\tyscale=1e-2):\n\tplt.figure()\n\t#path = '/Users/scott/Desktop/elastic'\n\n\t# Deep source\n\t#labels = ['no APMB', 'APMB']\n\t#if labels...
[ "0.68558604", "0.6830801", "0.682716", "0.6536897", "0.6412557", "0.6166356", "0.61190796", "0.60816085", "0.6074869", "0.60712504", "0.598796", "0.59763676", "0.5945832", "0.59333724", "0.5919523", "0.589908", "0.58856714", "0.58749056", "0.5861554", "0.5851671", "0.58485967...
0.7218871
0
Plot grid of surface displacement maps from each output/step folder if normalize=True, use step01 colorbar for all images
def plot_directory_surface(path,figsize=(17,11), comp=2, nrow=1, norm=None, cbar='each', cloc='top', outname=None, labels='1', show=True): outdirs = np.sort(os.listdir(path)) nplots = len(outdirs) ncol = np.ceil(nplots/nrow).astype(np.int) fig = plt.figure(figsize=figsize) grid = ImageGrid(fig,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debugplots(fig,data):\n grid = AxesGrid(fig, 111, # similar to subplot(142)\n nrows_ncols=(1, 6),\n axes_pad=0.0,\n share_all=True,\n label_mode=\"L\",\n cbar_location=\"right\",\n cbar_mode=\"...
[ "0.64044726", "0.63224024", "0.6253856", "0.61958474", "0.6189722", "0.60908437", "0.60695", "0.606345", "0.6026868", "0.6024125", "0.5955344", "0.5922822", "0.5906817", "0.58775115", "0.58641946", "0.58604985", "0.5835713", "0.5813257", "0.5810878", "0.580833", "0.57819027",...
0.703744
0
Use gdal/osr to get latlon point location from georeferenced array indices
def ind2latlon(index, filePath): # Load georeferencing ds = gdal.Open(filePath) proj = ds.GetProjection() gt = ds.GetGeoTransform() srs = osr.SpatialReference() srs.ImportFromWkt(proj) x0 = gt[0] #top left longitude y0 = gt[3] #top left latitude dx = gt[1] #pixel width dy = gt[5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_coord_indices(lon_array, lat_array, lon_points, lat_points, proj_str):\n\n proj = Proj(proj_str)\n proj_lon, proj_lat = np.array(proj(lon_array, lat_array)) # transform to distances using specified projection\n lonlat = np.column_stack(\n (proj_lon.ravel(), proj_lat.ravel())) # Stack all...
[ "0.64533174", "0.62730485", "0.6266516", "0.6246362", "0.6216341", "0.6202899", "0.6187555", "0.6148967", "0.6142526", "0.6036951", "0.5968435", "0.59425825", "0.59397787", "0.5923113", "0.5836684", "0.5829554", "0.58170235", "0.58012676", "0.5789401", "0.5754598", "0.5750754...
0.72259116
0
Plot stress contours by extracting nearest stresses resolved on a point for 4 vertices per cell (tetrahedra)
def contour_stresses(matFile, infoFile, ax=0, esize=100): # NOTE: some bug to work out here vertices, cells, moduli, stress, strain = pu.load_h5_material(matFile, infoFile) # NOTE: could get list of all elements that have a vertex on a particular surface # or get list of all cells that have a centroid ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight_cells_on_tsne(tsne, cells, fig=None, ax=None):\n fig, ax = get_fig(fig=fig, ax=ax)\n ax.scatter(tsne['x'], tsne['y'], s=3, color='lightgrey')\n ax.scatter(tsne.loc[cells, 'x'], tsne.loc[cells, 'y'], s=3, color='b')\n ax.set_axis_off()\n return fig, ax", "def _uniform_refine_tetrahedr...
[ "0.54688436", "0.54646534", "0.53946656", "0.5362895", "0.5319889", "0.52629554", "0.52503395", "0.52421236", "0.52283096", "0.52271646", "0.52166325", "0.5207605", "0.52060854", "0.5204232", "0.51916236", "0.51884454", "0.5186699", "0.5146042", "0.5143565", "0.51160043", "0....
0.6441977
0
Initialize the inference network, stream video to network, and output stats and video.
def infer_on_stream(args, client): # Initialise the class infer_network = Network() # Set Probability threshold for detections prob_threshold = args.prob_threshold ### TODO: Load the model through `infer_network` ### infer_network.load_model(args.model,args.cpu_extension,args.device) input_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_on_stream(args, client):\n # Initialise the class\n infer_network = Network()\n # Set Probability threshold for detections\n prob_threshold = args.prob_threshold\n\n ### TODO: Load the model through `infer_network` ###\n infer_network.load_model(model=args.model,\n ...
[ "0.6657868", "0.6654198", "0.6620068", "0.6584362", "0.6474501", "0.62960565", "0.6276968", "0.6220246", "0.6160445", "0.59733164", "0.5964964", "0.59312594", "0.5894175", "0.5887097", "0.58308923", "0.5786715", "0.5768193", "0.57668513", "0.57543945", "0.57250965", "0.570893...
0.6824545
0
Workbook galleries supported by the template.
def galleries(self) -> pulumi.Input[Sequence[pulumi.Input['WorkbookTemplateGalleryArgs']]]: return pulumi.get(self, "galleries")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galleries(self) -> pulumi.Output[Sequence['outputs.WorkbookTemplateGalleryResponse']]:\n return pulumi.get(self, \"galleries\")", "def get_galleries(self):\n data = self._get('get_gallery_list')\n return data['galleries']", "def Gallery():\n return render_template(\n 'Gallery...
[ "0.8052166", "0.6197946", "0.585732", "0.57718176", "0.5716009", "0.5657963", "0.5653665", "0.56315845", "0.5574098", "0.5572743", "0.5434536", "0.5415715", "0.530429", "0.5217824", "0.5189865", "0.5185198", "0.5181188", "0.51711136", "0.5099473", "0.5087812", "0.50609577", ...
0.82092285
0
Get an existing WorkbookTemplate resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'WorkbookTemplate': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = WorkbookTemplateArgs.__new__(WorkbookTemplateArgs) __props__.__d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(template_id):\n try:\n template = Template.objects.get(pk=template_id)\n except:\n raise CMException('template_get')\n\n if not template or template.state != template_states['active']:\n raise CMException('template_get')\n\n return template", "...
[ "0.60059094", "0.5583698", "0.5580275", "0.5527408", "0.54685605", "0.5425252", "0.5421419", "0.54145896", "0.5405498", "0.52019465", "0.5158618", "0.5141349", "0.5131247", "0.5115271", "0.50936675", "0.5086638", "0.5047412", "0.5034328", "0.5018827", "0.49963653", "0.4993864...
0.66030896
0
Workbook galleries supported by the template.
def galleries(self) -> pulumi.Output[Sequence['outputs.WorkbookTemplateGalleryResponse']]: return pulumi.get(self, "galleries")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galleries(self) -> pulumi.Input[Sequence[pulumi.Input['WorkbookTemplateGalleryArgs']]]:\n return pulumi.get(self, \"galleries\")", "def get_galleries(self):\n data = self._get('get_gallery_list')\n return data['galleries']", "def Gallery():\n return render_template(\n 'Galler...
[ "0.82092285", "0.6197946", "0.585732", "0.57718176", "0.5716009", "0.5657963", "0.5653665", "0.56315845", "0.5574098", "0.5572743", "0.5434536", "0.5415715", "0.530429", "0.5217824", "0.5189865", "0.5185198", "0.5181188", "0.51711136", "0.5099473", "0.5087812", "0.50609577", ...
0.8052166
1
Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal.
def localized(self) -> pulumi.Output[Optional[Mapping[str, Sequence['outputs.WorkbookTemplateLocalizedGalleryResponse']]]]: return pulumi.get(self, "localized")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photo_dict(phrase):\n switcher = {\n '병원 위치': 'https://maps.googleapis.com/maps/api/staticmap?center=37.507144,127.063737&zoom=16&size=640x480&markers=color:blue%7Clabel:S%7C37.507144,127.063737&key=AIzaSyCF-XXYf7IW1mkUZFeZF84BCcZdtC-z1M0',\n '병원 운영시간': 'http://gunn.pausd.org/sites/default/fil...
[ "0.579176", "0.5739075", "0.5682472", "0.5466263", "0.5320878", "0.5197395", "0.515548", "0.5117539", "0.5035321", "0.50232655", "0.5018956", "0.49866858", "0.4972195", "0.49670196", "0.49650854", "0.49545366", "0.4943", "0.49376488", "0.48790962", "0.48603863", "0.48575422",...
0.59551746
0
Test SNMPv3 script utilizing Kirks snmp_helper module
def main(): # Take path argument and list all text files ip = '10.1.10.100' a_user = 'cisco' auth_key = 'cisco123' encr_key = 'cisco123' snmp_user = (a_user, auth_key, encr_key) sw1 = (ip, 161) sysDescr = '1.3.6.1.2.1.1.1.0' sysObjectID = '1.3.6.1.2.1.1.2.0' sysUpTime = '1.3.6....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quickstart():\n snmp.quickstart()\n return 0", "def handle_snmpconf():\n return 0", "def main():\n # CREATE EACH OID STRING USING THE FIRST ARGUMENT PASSED\n cmd_uptime = \"snmpget -v 1 -c public \" + argv[1] + \" 1.3.6.1.2.1.1.3.0\"\n # CREATE LISTS OUT OF EACH COMMAND\n clUptime = cm...
[ "0.63348025", "0.619772", "0.6136724", "0.5980005", "0.5947892", "0.58158255", "0.57572633", "0.5711977", "0.5508595", "0.53740776", "0.53207225", "0.5219235", "0.5182949", "0.5170424", "0.5160724", "0.5152555", "0.5085134", "0.50800693", "0.5075875", "0.5074044", "0.50578886...
0.64426136
0
Connect to the API and test connection
def connect_api(): print("INFO: Checking API connection and credentials...") conf = ConfigParser() conf.read(os.path.join(os.path.abspath( os.path.dirname(__file__)), '.', 'api.conf')) client = CBWApi(conf.get('cyberwatch', 'url'), conf.get( 'cyberwatch', 'api_key'), conf.get('cyberwatch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\n return connection.Connection(username=api_user,\n api_key=api_key,\n region=api_region)", "def test_api_connection(server, username, password, api_key):\n global api_url\n api_url = \"http://\" + server + \"/i-doit/src/jsonrp...
[ "0.75394267", "0.71746594", "0.71069753", "0.70297796", "0.69757605", "0.6968587", "0.6940774", "0.6929308", "0.6752766", "0.67461467", "0.66849214", "0.6681502", "0.6624572", "0.66045177", "0.6603074", "0.6563905", "0.6545671", "0.6543918", "0.650036", "0.64967084", "0.64955...
0.7394636
1
Setup variables for SMTP
def setup_smtp(): print("INFO: Setting up SMTP variables...") conf = ConfigParser() conf.read(os.path.join(os.path.abspath( os.path.dirname(__file__)), '.', 'smtp.conf')) smtp = { "server": conf.get('smtp', 'smtp_server'), "login": conf.get('smtp', 'smtp_login'), "passwor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, smtp_server, smtp_user, smtp_password,\n smtp_port=25, is_with_tls=False):\n self.smtp_server = smtp_server\n self.smtp_port = smtp_port\n self.smtp_user = smtp_user\n self.smtp_password = smtp_password\n self.is_with_tls = is_with_tls", "def ...
[ "0.65546256", "0.6469776", "0.6447924", "0.64182866", "0.63860655", "0.6361841", "0.62926346", "0.6200357", "0.6009188", "0.5971613", "0.59700364", "0.5938338", "0.58888084", "0.5881734", "0.5868435", "0.5861525", "0.5846991", "0.58270794", "0.57619554", "0.57489693", "0.5721...
0.7708062
0
Replace server list in file with recent one
def replace_file(servers): print("INFO: Replacing server list in file with recent one...") if os.path.exists(os.path.dirname(__file__) + '/communication_failure_list.txt'): try: os.remove(os.path.dirname(__file__) + '/communication_failure_list.txt') except OSEr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_server_list(filename):\n if not os.path.isfile(filename):\n return #ignore this error for now\n fo=open(filename,\"r\")\n rd=fo.read()\n fo.close()\n __load_server_list(rd)", "def update_servers(self, output_file, current_time):\n\n # Check the servers le...
[ "0.6282345", "0.6164431", "0.5646351", "0.5629765", "0.55825335", "0.55205137", "0.54738104", "0.54054666", "0.53958476", "0.53949213", "0.53838426", "0.5362909", "0.53529775", "0.5349839", "0.53414625", "0.53314036", "0.5330049", "0.53072166", "0.5290604", "0.52862704", "0.5...
0.7886564
0
Find servers with status "Communication failure" and save them to a file
def find_communication_failure_servers(servers): print('INFO: Finding servers with "Communication failure" status and saving result in file') with open(os.path.dirname(__file__) + '/communication_failure_list.txt', 'w+') as file: for server in servers: if server.status == "server_update_comm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_recovered_servers(client):\n print(\"INFO: Determining recovered servers by comparing current servers with list in file...\")\n current_servers_list = []\n for server in client.servers():\n if server.status == \"server_update_comm_fail\":\n current_servers_list.append({\"id\": s...
[ "0.64982885", "0.6221347", "0.61516804", "0.5741765", "0.57228017", "0.56389916", "0.56194955", "0.5510259", "0.5408489", "0.5404776", "0.53996354", "0.5329651", "0.5317809", "0.5298589", "0.5267512", "0.52575266", "0.5253678", "0.5225752", "0.5221685", "0.51375675", "0.51358...
0.85111237
0
Compare list of servers in file with current ones to find recovered servers
def find_recovered_servers(client): print("INFO: Determining recovered servers by comparing current servers with list in file...") current_servers_list = [] for server in client.servers(): if server.status == "server_update_comm_fail": current_servers_list.append({"id": server.id}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_file(servers):\n print(\"INFO: Replacing server list in file with recent one...\")\n if os.path.exists(os.path.dirname(__file__) + '/communication_failure_list.txt'):\n try:\n os.remove(os.path.dirname(__file__) +\n '/communication_failure_list.txt')\n ...
[ "0.67536014", "0.6489799", "0.6314629", "0.5987139", "0.5953733", "0.58189934", "0.5703676", "0.55950475", "0.55163497", "0.5493828", "0.54845756", "0.54702073", "0.54463625", "0.5411403", "0.53845555", "0.5359683", "0.5357033", "0.53492767", "0.52340114", "0.52160895", "0.51...
0.7713606
0
Make an HTML list from server list for email
def create_body_html(client, server_list): servers_html = "" for server in server_list: link = '<a href="{}/servers/{}">{}</a>'.format( client.api_url, server.id, server.hostname) html = """{}<br />""".format(link) servers_html += html return servers_html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_html(self, items):\n html = \"\"\"\n <html>\n\t\t\t<head>\n\t\t\t\t<title>OpenFDA Cool App</title>\n\t\t\t</head>\n\t\t\t<body>\n <ol>\n \"\"\"\n\n for item in items:\n html += \"<li>\" + item + \"</li>\\n\"\n\n html += \"\"\"\n ...
[ "0.6742271", "0.61657894", "0.61091125", "0.60555714", "0.60321444", "0.5965353", "0.59480834", "0.5918078", "0.5883233", "0.5821413", "0.5801513", "0.5782404", "0.57817954", "0.57756126", "0.57365865", "0.5734727", "0.57307297", "0.56886506", "0.5656043", "0.5625895", "0.562...
0.7079043
0
Remove a random item from the set, and return it
def pop_random(self): rand_index = randint(0, len(self._list) - 1) item = self._list[rand_index] self.remove(item) return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def popitem(self):\n all_items = self.items()\n removed_item = random.choice(all_items)\n self[removed_item[0]] = None\n return removed_item", "def getRandom(self):\n n = len(self.keys)\n while n > 0:\n index = random.randint(0, n - 1)\n my_key = se...
[ "0.8282262", "0.7164812", "0.7115214", "0.69544333", "0.68911844", "0.68830067", "0.6759804", "0.67500526", "0.67464954", "0.67222595", "0.6633977", "0.6544951", "0.6462838", "0.6461487", "0.6363013", "0.6315286", "0.6308643", "0.62988245", "0.6254927", "0.6241444", "0.621253...
0.79628265
1
Generate a compressed name from keys wrt config.
def get_compressed_name_from_keys(config: Dict[str, Any], keys: Tuple[Tuple[str]], allow_missing: bool = True): assert not isinstance(config, list), config name = '' for pre_keys in keys: v = config pre_keys_str = '' missing = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_pack_name(names):\n assert names\n tokens_in_names = [name.split('/') for name in names]\n common_prefix_tokens = []\n\n # Find the longest common prefix of tokens.\n while True:\n first_token_in_names = set()\n for tokens in tokens_in_names:\n if not tokens:\n break\n first_t...
[ "0.64022315", "0.63604325", "0.6284187", "0.61198986", "0.592737", "0.5915452", "0.59024495", "0.5840366", "0.5840366", "0.5803846", "0.57972753", "0.5789273", "0.5788882", "0.57822824", "0.5780839", "0.5775445", "0.57516694", "0.57482225", "0.5740038", "0.5716991", "0.570401...
0.7821243
0
Get a sample of config.
def get_configuration_sample(config, root=True): if isinstance(config, dict): return { k: get_configuration_sample(v, root=False) for k, v in sorted(config.items()) } elif isinstance(config, list): if root: return get_configuration_sample( config[np.random.randint(len(con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sample(config, n_sample=1):\n if config['distribution'] == 'binary':\n data = np.random.choice([0, 1], size=n_sample, replace=True, p=config['pmf'])\n\n elif config['distribution'] == 'discrete':\n data = np.random.choice(config['category'], size=n_sample, replace=True, p=config['pmf'])...
[ "0.66725135", "0.65855396", "0.6482443", "0.64281243", "0.62920535", "0.62203", "0.62141085", "0.6211423", "0.61809164", "0.61482966", "0.6130489", "0.60582256", "0.60312045", "0.6018113", "0.6018113", "0.59389967", "0.5933204", "0.5931536", "0.5909174", "0.590119", "0.587822...
0.7430664
0
Test aperture_photometry when error has units (see 176).
def test_aperture_photometry_with_error_units(): data1 = np.ones((40, 40), dtype=float) data2 = u.Quantity(data1, unit=u.adu) error = u.Quantity(data1, unit=u.adu) radius = 3 true_flux = np.pi * radius * radius unit = u.adu position = (20, 20) table1 = aperture_photometry(data2, Circula...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aperture_photometry_inputs_with_mask():\n\n data = np.ones((5, 5))\n aperture = CircularAperture((2, 2), 2.0)\n mask = np.zeros_like(data, dtype=bool)\n data[2, 2] = 100.0 # bad pixel\n mask[2, 2] = True\n error = np.sqrt(data)\n data_in = data.copy()\n error_in = error.copy()\n ...
[ "0.69079345", "0.6512504", "0.62657374", "0.6050535", "0.5927566", "0.57785326", "0.5778429", "0.5767613", "0.566218", "0.5603356", "0.5592774", "0.55879194", "0.5550571", "0.55201626", "0.5513671", "0.54968745", "0.5489606", "0.5488023", "0.54835194", "0.544789", "0.54413337...
0.82502395
0
Test that aperture_photometry does not modify the input data or error array when a mask is input.
def test_aperture_photometry_inputs_with_mask(): data = np.ones((5, 5)) aperture = CircularAperture((2, 2), 2.0) mask = np.zeros_like(data, dtype=bool) data[2, 2] = 100.0 # bad pixel mask[2, 2] = True error = np.sqrt(data) data_in = data.copy() error_in = error.copy() t1 = aperture...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aperture_photometry_with_error_units():\n\n data1 = np.ones((40, 40), dtype=float)\n data2 = u.Quantity(data1, unit=u.adu)\n error = u.Quantity(data1, unit=u.adu)\n radius = 3\n true_flux = np.pi * radius * radius\n unit = u.adu\n position = (20, 20)\n table1 = aperture_photometry(...
[ "0.6387848", "0.62934524", "0.6213696", "0.60203755", "0.60186976", "0.6006882", "0.59526944", "0.58965045", "0.5882132", "0.5878645", "0.58625317", "0.5860351", "0.5847825", "0.58367264", "0.58344615", "0.58279014", "0.5787623", "0.57459146", "0.569849", "0.56977993", "0.567...
0.87002504
0
Test elliptical exact aperture photometry on a grid of pixel positions.
def test_ellipse_exact_grid(x, y, r): data = np.ones((10, 10)) aperture = EllipticalAperture((x, y), r, r, 0.0) t = aperture_photometry(data, aperture, method='exact') actual = t['aperture_sum'][0] / (np.pi * r**2) assert_allclose(actual, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phantom_ellipses(n_points,E):\n \n #Rescaling according to image size \n E[:,0] = E[:,0]*n_points/2 #semiaxis a\n E[:,1] = E[:,1]*n_points/2 #semiaxis b\n E[:,2] = E[:,2]*n_points/2 #x\n E[:,3] = E[:,3]*n_points/2 #y\n E[:,4] = E[:,4]*math.pi/180\n \n x,y = np.meshgrid(np.arange(0,n...
[ "0.66793174", "0.6369313", "0.635344", "0.5881113", "0.57845265", "0.5761885", "0.57279414", "0.561903", "0.55827296", "0.55767804", "0.55325985", "0.55246985", "0.55024266", "0.5493475", "0.5487103", "0.5459197", "0.54441357", "0.5431681", "0.5411385", "0.5358013", "0.535433...
0.7887095
0
Regression test that nonfinite data values outside of the aperture mask but within the bounding box do not affect the photometry.
def test_nan_in_bbox(): data1 = np.ones((101, 101)) data2 = data1.copy() data1[33, 33] = np.nan data1[67, 67] = np.inf data1[33, 67] = -np.inf data1[22, 22] = np.nan data1[22, 23] = np.inf error = data1.copy() aper1 = CircularAperture((50, 50), r=20.0) aper2 = CircularAperture(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aperture_photometry_inputs_with_mask():\n\n data = np.ones((5, 5))\n aperture = CircularAperture((2, 2), 2.0)\n mask = np.zeros_like(data, dtype=bool)\n data[2, 2] = 100.0 # bad pixel\n mask[2, 2] = True\n error = np.sqrt(data)\n data_in = data.copy()\n error_in = error.copy()\n ...
[ "0.6720967", "0.6610739", "0.6296814", "0.61645174", "0.6088839", "0.60787433", "0.5982765", "0.59556407", "0.5947607", "0.58739126", "0.58470315", "0.58464575", "0.5712174", "0.57064", "0.57048935", "0.5660747", "0.5626591", "0.5626591", "0.5626591", "0.5622805", "0.5616519"...
0.7124479
0
Regression test to check that scalar SkyCoords are added to the table as a length1 SkyCoord array.
def test_scalar_skycoord(): data = make_4gaussians_image() wcs = make_wcs(data.shape) skycoord = wcs.pixel_to_world(90, 60) aper = SkyCircularAperture(skycoord, r=0.1 * u.arcsec) tbl = aperture_photometry(data, aper, wcs=wcs) assert isinstance(tbl['sky_center'], SkyCoord)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_xy(self):\n x = np.array([[1,3], [2,8], [1,3]])\n y = np.array([1,1,-1])\n lro = LogisticRegressionOptimiser(x,y)\n expected = np.array([[1,3], [2,8], [-1,-3]])\n for i in 0,1,2:\n for j in 0,1:\n self.assertEqual(lro.xy[i][j], expected[i][j])", "def test_scalar_index(self):\n...
[ "0.5772283", "0.5675139", "0.5644284", "0.5608696", "0.5585975", "0.5573823", "0.54413795", "0.5437408", "0.5400953", "0.5393124", "0.5352665", "0.53412086", "0.5340118", "0.53243935", "0.5320892", "0.531939", "0.5305857", "0.5282068", "0.52805465", "0.5274832", "0.5256645", ...
0.5873713
0
Getter of the user id.
def get_user_id(self): return self.id_user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self):\n return self.user_id", "def get_id(self) -> int:\n return self.user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._u...
[ "0.8740212", "0.8674682", "0.8466421", "0.8466421", "0.8466421", "0.8466421", "0.8466421", "0.84438294", "0.84438294", "0.8365442", "0.8362073", "0.83430153", "0.8284895", "0.8284895", "0.8263458", "0.8238554", "0.82361627", "0.82293457", "0.8197898", "0.8093313", "0.80851257...
0.8879019
0
Getter of ratings list for this user.
def get_ratings(self): return self.ratings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_user_ratings(self, user_id):\n return self.ratings[self.ratings['user_id'] == user_id]", "def get_ratings(self):\n return Vote.objects.filter(content_type=self.get_content_type(), object_id=self.instance.pk, key=self.field.key)", "def user_ratings(user_id):\n return _fetch_records(f\"...
[ "0.7477732", "0.7453791", "0.73936325", "0.72100174", "0.7001172", "0.69021744", "0.68245584", "0.67234373", "0.6693334", "0.66076666", "0.65877724", "0.6586307", "0.6462181", "0.6363747", "0.63283545", "0.61764896", "0.6175898", "0.61114925", "0.61114925", "0.6096961", "0.60...
0.83241516
1
Method to check if a movie have been already seen for the given user.
def check_movie_seen(self, id_movie): if id_movie in self.seen: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_watched_movie(username: str, movie_id: int) -> bool:\n with connection:\n all_movies = connection.execute(MOVIES_IDS, (movie_id,)).fetchone()\n all_usernames = connection.execute(USERS_IDS, (username,)).fetchone()\n if all_usernames is not None and all_movies is not None:\n ...
[ "0.62960756", "0.6231976", "0.609444", "0.6070275", "0.60486317", "0.6042864", "0.6039808", "0.6021467", "0.5981415", "0.59635645", "0.5831276", "0.58286434", "0.5827806", "0.5819191", "0.579271", "0.5785383", "0.57851636", "0.5760467", "0.57585835", "0.57534826", "0.5748277"...
0.7359592
0
Getter of movie id
def get_movie_id(self): return self.id_movie
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movie_id(self) -> str:\n return self.movie.id", "def _get_ID(self):\n raw_data = imdb.search_for_title(self.title)\n if len(raw_data) > 1:\n raw_data = raw_data[0] # Pulls the first value of the title (the closest match)\n # if there is more than one\n s...
[ "0.8985618", "0.72579557", "0.7143325", "0.6941592", "0.6938852", "0.68658173", "0.67975396", "0.6750645", "0.67016894", "0.66771835", "0.6601591", "0.6580242", "0.6561278", "0.65610945", "0.6541132", "0.6535963", "0.65356594", "0.65356594", "0.65356594", "0.65356594", "0.653...
0.8726083
1
Getter of ratings list for this movie. Pair (user, rating)
def get_ratings(self): return self.ratings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_ratings(user_id):\n return _fetch_records(f\"SELECT item_id, rating_type FROM ratings WHERE user_id = {user_id}\")", "def _get_user_ratings(self, user_id):\n return self.ratings[self.ratings['user_id'] == user_id]", "def ratings_usuarios(username, ratings):\n return list(filter(lambda x: ...
[ "0.7654455", "0.75835025", "0.7034352", "0.7018935", "0.68056756", "0.67744166", "0.6699223", "0.66923803", "0.66044664", "0.6584102", "0.64854413", "0.63792723", "0.6326823", "0.63158023", "0.63092196", "0.62783813", "0.62779266", "0.6260052", "0.62443334", "0.62352544", "0....
0.77323925
1
Write similarities data to file
def write_similarities(self, data): # If file is yet created, return data and do not create it again if os.path.isfile(cfg.similarities): return None with open(cfg.similarities, 'wb') as similarities: print("Storing data as serialized object...") pickle.dump(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_similarities(similarities):\n writer = open(\"similarities.txt\", \"w\")\n for userA in similarities.keys():\n for userB in similarities[userA].keys():\n writer.write(userA + \"\\t\" + userB + \"\\t\" +\n str(similarities[userA][userB]) + \"\\n\")\n wri...
[ "0.68487245", "0.6322778", "0.62223566", "0.608114", "0.6032401", "0.5957932", "0.5846", "0.581992", "0.58038425", "0.5798109", "0.5784611", "0.57362115", "0.56961566", "0.5652088", "0.56154805", "0.56049746", "0.55978143", "0.55934703", "0.55828327", "0.55662423", "0.5545500...
0.77305156
0
Load similarities pickle data
def load_similarities(self): if not os.path.isfile(cfg.similarities): return None else: print("Serialized object exists. Reading from disk...") with open(cfg.similarities, 'rb') as file: data = pickle.load(file) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data():\r\n f = gzip.open('mnist.pkl.gz', 'rb')\r\n training_data, validation_data, test_data = pickle.load(f,encoding='bytes')\r\n f.close()\r\n return (training_data, validation_data, test_data)", "def write_similarities(self, data):\n # If file is yet created, return data and do no...
[ "0.63505393", "0.63323516", "0.6323051", "0.6226563", "0.6211917", "0.6082885", "0.6041092", "0.6009795", "0.5966512", "0.58577603", "0.58408076", "0.5830951", "0.5827306", "0.57913244", "0.5778014", "0.5771801", "0.57601976", "0.57570964", "0.5746246", "0.57078785", "0.56944...
0.7810446
0
Initializes our connectors by giving them a handler function.
def initConnectors(self): def handlerFunc(message, responseFunc): for h in self._handlers: h.handleMessage(message, responseFunc) getLogger(__name__).debug('Initializing %d connectors...' % len(self._connectors)) for c in self._connectors: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init(self, connection_strings):\n # Init connections\n self._connections = []\n for s in connection_strings:\n d = Dict() # don't do Dict(foo=x) bc PyScript only supports that for dict\n self._connections.append(d)\n d.fullname = s\n d.type = s...
[ "0.6854127", "0.6759487", "0.6748176", "0.6468161", "0.6428388", "0.63626826", "0.6295971", "0.62636906", "0.6258875", "0.62326473", "0.616134", "0.61134547", "0.60776216", "0.6075216", "0.60286105", "0.6026851", "0.6011213", "0.60032165", "0.5989295", "0.5989295", "0.5989295...
0.8177971
0
Read a pulse of SPI data on a pin that corresponds to DYMO scale output protocol (12 bytes of data at about 14KHz), timeout is in seconds
def get_scale_data(pin, timeout=1.0): timestamp = time.monotonic() with pulseio.PulseIn(pin, maxlen=96, idle_state=True) as pulses: pulses.pause() pulses.clear() pulses.resume() while len(pulses) < 35: if (time.monotonic() - timestamp) > timeout: rais...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s_read(self, timeout = 1):\n if self.s.is_open:\n data = [] \n b = bytearray()\n try:\n self.s.timeout = 3\n data = self.s.read(1)\n \n if not len(data):\n return b\n\n self....
[ "0.6665904", "0.6170786", "0.6145323", "0.61205214", "0.6039192", "0.6033334", "0.59552085", "0.5954513", "0.58192575", "0.5769836", "0.5758939", "0.56423473", "0.5639176", "0.5637689", "0.56207716", "0.56185025", "0.5606741", "0.5584944", "0.55758065", "0.5558758", "0.554726...
0.75666636
0
encode convex hulls to network input format
def _encode_convex_hull(record): max_encode_len = max(seq_len) max_decode_len = max(seq_len) + 1 + 1 total_len = max_encode_len + max_decode_len encoder_seq, hull = record encoder_seq_len = len(encoder_seq) # add new dimension for the [start] token encoder_seq = [(0., *e) for e in encoder_seq] # creat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convex_hull(points):\n\n # Sort the points lexicographically (tuples are compared lexicographically).\n # Remove duplicates to detect the case we have just one unique point.\n points = sorted(set(points))\n\n # Boring case: no points or a single point, possibly repeated multiple times.\n if len...
[ "0.58518094", "0.5845417", "0.57677484", "0.57292026", "0.5701482", "0.5699452", "0.5666843", "0.5633451", "0.5616808", "0.5535729", "0.5463705", "0.54190964", "0.5377508", "0.5347325", "0.5336038", "0.5333922", "0.5331519", "0.5311888", "0.5309981", "0.53056556", "0.52919686...
0.6956518
0
Stacks are comprised of multiple hosts. Each host may be located in different cloud accounts. This method returns a map of the underlying driver implementation and the hosts that running in the account. host_ids (list); a list of primary keys for the hosts we're interested in (dict); each key is a provider driver imple...
def get_driver_hosts_map(self, host_ids=None): host_queryset = self.get_hosts(host_ids) # Create an account -> hosts map accounts = {} for h in host_queryset: accounts.setdefault(h.get_account(), []).append(h) # Convert to a driver -> hosts map result = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_configs(self, hostids, **kwargs):\n host_configs = {}\n for hostid in hostids:\n host_configs[hostid] = self.get_host_config(hostid, **kwargs)\n return host_configs", "def query_hosts(self, force=False):\n CACHE_KEY = 'salt-cloud-full-query'\n\n cached_r...
[ "0.6461176", "0.62735856", "0.60457814", "0.5975142", "0.5896362", "0.5873509", "0.5828188", "0.5788435", "0.5750981", "0.574665", "0.57066274", "0.56011957", "0.55321527", "0.55266124", "0.55064696", "0.54972166", "0.54785377", "0.5460819", "0.54548657", "0.54415405", "0.543...
0.7679804
0
Quick way of getting all hosts or a subset for this stack. (list); list of primary keys of hosts in this stack (QuerySet);
def get_hosts(self, host_ids=None): if not host_ids: return self.hosts.all() return self.hosts.filter(id__in=host_ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self, **kwargs):\n\n return self.getResourceManager() \\\n .getSdk() \\\n .hosts \\\n .list(**kwargs)", "def get_hosts(self):\n\n raise NotImplementedError", "def hosts(self):\n\n return self._get_list_field(\"hosts\", lambda x...
[ "0.6386337", "0.6371365", "0.63523024", "0.63523024", "0.6272247", "0.6215245", "0.6201035", "0.6201035", "0.616472", "0.6138865", "0.6128013", "0.6115967", "0.6107518", "0.60520285", "0.6051724", "0.60374975", "0.6008605", "0.6000928", "0.599559", "0.59938854", "0.598613", ...
0.6725173
0
Creates host objects on this Stack. If no arguments are given, then all hosts available based on the Stack's blueprint host definitions will be created. If args are given, then only the `count` for the given `host_definition` will be created. host_definition (BlueprintHostDefinition object); the host definition to use ...
def create_hosts(self, host_definition=None, count=None, backfill=False): created_hosts = [] if host_definition is None: host_definitions = self.blueprint.host_definitions.all() else: host_definitions = [host_definition] for hostdef in host_definitions: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n\n try:\n if \"hosts\" in self.jbody:\n hostnames = self.jbody[\"hosts\"]\n else:\n hostnames = [{\"hostname\": self.jbody[\"hostname\"]}]\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Requi...
[ "0.4938579", "0.48584768", "0.47865078", "0.47671604", "0.47439453", "0.47246405", "0.4700411", "0.46670032", "0.45571178", "0.45547783", "0.44747478", "0.43636113", "0.43369415", "0.42789087", "0.4247567", "0.4242754", "0.4227977", "0.4216803", "0.42011896", "0.42005447", "0...
0.8422698
0
Uses saltcloud to query all the hosts for the given stack id.
def query_hosts(self, force=False): CACHE_KEY = 'salt-cloud-full-query' cached_result = cache.get(CACHE_KEY) if cached_result and not force: logger.debug('salt-cloud query result cached') result = cached_result else: logger.debug('salt-cloud query re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_hosts(self):\n ...", "def get_stacking_stacks_by_stack_id(self, stack_id, *, fields=None, **kwargs):\n function_endpoint = urljoin(self._baseurl, 'stacking/stacks/{stack_id}'.format(stack_id=stack_id))\n return self._call('GET', function_endpoint, **kwargs)", "def get(self, request...
[ "0.6205435", "0.6024829", "0.60159945", "0.59807694", "0.595565", "0.5935895", "0.59275913", "0.58967364", "0.58842933", "0.5843488", "0.5838476", "0.58124864", "0.5785423", "0.5756203", "0.5662017", "0.56044453", "0.5555758", "0.5528058", "0.55251485", "0.55106646", "0.54707...
0.6475528
0
Given an array it splits the array in two parts at index i
def split_i(array:list, i:int) -> (list, list): if i==len(array)-1: return array[i], array[:-1] else: pre = array[0:i] post = array[i+1:] l = pre + post x = array[i] return x, l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_array(a):\n n = len(a)\n if n == 1:\n return a\n index = n // 2\n b = a[:index]\n c = a[index:]\n return b, c", "def even_split(a, n):\n n = min(n, len(a)) # if less elements in array than chunks to output, change chunks to array length\n k, m = divmod(len(a), n)\n ret...
[ "0.7665456", "0.7067053", "0.68895733", "0.6825084", "0.6575467", "0.6566739", "0.656526", "0.6551348", "0.65445685", "0.6517187", "0.64508444", "0.6435194", "0.6357571", "0.63475424", "0.6298871", "0.6265837", "0.6259398", "0.6205831", "0.6199721", "0.61938316", "0.61762506"...
0.77543867
0
Testing for proper beaker kwargs usage
def test_beaker_kwargs(self): css_source = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True) from fixtures import beaker_container self.assertEqual(beaker_container, beaker_kwargs) css_source = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True, b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_020_kwargs(self):\n caller = self.get_caller([KwargsTaskOverride])\n self.assertEqual([\"A\", \"B\"], caller(\"A\", \"B\"))", "def test_kwargs(self):\n kwargs = forge.kwargs\n assert isinstance(kwargs, forge._signature.VarKeyword)\n assert kwargs.name == 'kwargs'\n ...
[ "0.7301403", "0.72157216", "0.69301623", "0.6644783", "0.65698075", "0.65681475", "0.65209633", "0.6470704", "0.6410706", "0.6393279", "0.6379091", "0.6320997", "0.6313386", "0.6237101", "0.6231931", "0.621528", "0.62060726", "0.6202357", "0.6099443", "0.6098508", "0.6097881"...
0.7554935
0
Call first_move() after good key was pressed. Good key will be saved in self.first_key
def wait_first_move(self): self.env.keyboard.listen_once(self.catch_key_first, key_down)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_move(self):\n self.play_sound(self.first_key)\n self.make_blink()\n self.wait_second_move()", "def key_handler(self, event):\n if event.type == pygame.KEYUP: \n self.done = True", "def wait_second_move(self):\n self.qr_unregister()\n self.env.ke...
[ "0.7691176", "0.69349104", "0.68719256", "0.68288636", "0.6766883", "0.6606569", "0.6452956", "0.63939595", "0.63457495", "0.6345322", "0.6335956", "0.63320196", "0.6313395", "0.6303774", "0.6273421", "0.6273016", "0.62193775", "0.6212796", "0.61779016", "0.616101", "0.615977...
0.7749387
0
Call second_move() after good key was pressed. Good key will be saved in self.second_key
def wait_second_move(self): self.qr_unregister() self.env.keyboard.listen_once(self.catch_key_second, key_down)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def second_move(self):\n self.play_sound(self.second_key)\n self.end_move()", "def first_move(self):\n self.play_sound(self.first_key)\n self.make_blink()\n self.wait_second_move()", "def wait_first_move(self):\n self.env.keyboard.listen_once(self.catch_key_first, key_...
[ "0.7825597", "0.7296097", "0.7028338", "0.67003924", "0.66919225", "0.6691698", "0.65923977", "0.6526897", "0.6478581", "0.64533395", "0.6391608", "0.63787925", "0.63162094", "0.63137877", "0.62750816", "0.6266099", "0.62504405", "0.62090117", "0.6191794", "0.61795557", "0.61...
0.7450435
1
Responses for second_key press.
def second_move(self): self.play_sound(self.second_key) self.end_move()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_second_move(self):\n self.qr_unregister()\n self.env.keyboard.listen_once(self.catch_key_second, key_down)", "def goto_second():\n\tglobal c2\n\tglobal a2\n\tglobal BUF_SIZE\n\tglobal state\n\n\tmsg = c2.recv(BUF_SIZE) # wait for the taken off message\n\tprint a2, ' >> ', msg\n\tif msg != ...
[ "0.6041951", "0.58219993", "0.57078713", "0.567378", "0.55835176", "0.55665016", "0.55074126", "0.55048704", "0.5473432", "0.5445047", "0.5436347", "0.54057235", "0.5393213", "0.5380113", "0.53439146", "0.5318712", "0.5311537", "0.52885514", "0.5287942", "0.5277704", "0.52646...
0.63019663
0
Plot a histogram of the pnorms of the solutions
def plot_p_norm(p=2, bins=500): plt.title(f"{p}-norms of solutions for lattice point quaternion polynomials") plt.hist([sum(abs(x)**p for x in abcd)**(1/p) for abcd in solutions], bins=bins)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_imag_p_norm(p=2, bins=500):\n plt.title(f\"{p}-norms of imaginary parts of solutions to polynomials with quaternion coefficients\")\n plt.hist([sum(abs(x) ** p for x in abcd[1:]) ** (1 / p) for abcd in solutions], bins=bins)", "def test_normal(self):\r\n s = np.random.normal(-0.42, 0.55, 50...
[ "0.765192", "0.68404233", "0.66037804", "0.65835", "0.6533649", "0.64928544", "0.6461779", "0.645999", "0.6441155", "0.6404364", "0.6345734", "0.6342641", "0.6324178", "0.63204044", "0.62690324", "0.62213695", "0.61868656", "0.6182514", "0.6176014", "0.61743295", "0.6171994",...
0.8222845
0
Plot a histogram of the pnorms of the imaginary parts of the solutions
def plot_imag_p_norm(p=2, bins=500): plt.title(f"{p}-norms of imaginary parts of solutions to polynomials with quaternion coefficients") plt.hist([sum(abs(x) ** p for x in abcd[1:]) ** (1 / p) for abcd in solutions], bins=bins)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_p_norm(p=2, bins=500):\n plt.title(f\"{p}-norms of solutions for lattice point quaternion polynomials\")\n plt.hist([sum(abs(x)**p for x in abcd)**(1/p) for abcd in solutions], bins=bins)", "def show_histogram(im):\n\n if im.ndim == 2:\n # Input image is single channel\n ...
[ "0.777749", "0.6434252", "0.6400417", "0.62809926", "0.6274087", "0.62183875", "0.6199149", "0.61816305", "0.6179878", "0.6179878", "0.6179878", "0.61471015", "0.6140279", "0.6139242", "0.6112178", "0.6104909", "0.60622525", "0.60274523", "0.5973794", "0.59647155", "0.5960954...
0.83347857
0
First Python implementation method of the Levenshtein distance between strings
def levenshtein(s1, s2): if len(s1) < len(s2): return levenshtein(s2, s1) # len(s1) >= len(s2) if len(s2) == 0: return len(s1) previous_row = range(len(s2) + 1) for i, c1 in enumerate(s1): current_row = [i + 1] for j, c2 in enumerate(s2): insertions = pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levenshtein_distance(s1,s2):\n\n\t\tif len(s1) < len(s2):\n\t\t\treturn Searcher.levenshtein_distance(s2, s1)\n\n\t\t# len(s1) >= len(s2)\n\t\tif len(s2) == 0:\n\t\t\treturn len(s1)\n\n\t\tprevious_row = range(len(s2) + 1)\n\t\tfor i, c1 in enumerate(s1):\n\t\t\tcurrent_row = [i + 1]\n\t\t\tfor j, c2 in enumer...
[ "0.81522393", "0.79750335", "0.7954744", "0.7949555", "0.78139377", "0.7758564", "0.7698071", "0.7673589", "0.7605972", "0.7590628", "0.7568366", "0.7530191", "0.74639803", "0.7419249", "0.739178", "0.7367446", "0.7348473", "0.7338631", "0.73206055", "0.7319021", "0.7293537",...
0.80752313
1
It is reccommended that preprocessing has taken place before loading directly into object class in iterable format level to avoid inconsistencies due to document delimitation from the puctuations. Upon calling method `.fit()` on corpus, collection sets on entities and PoS will be identified to harmonise the extracted r...
def fit(self, corpus: Union[str, Iterable[str]], sent_delim: str='\.\s+|\r|\n', preferred_spacy_core: str='en_core_web_sm' ) -> None: # Initialise corpus if type(corpus) == str: self.__corpus__ = [sent+'.' if ('\.' in sent_delim and sent[-1] != '.') else sent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _preprocess(self):\n self.data['sentences'] = self.data['text'].apply(self._tokenize_sent)\n self.data['nouns'] = self.data['sentences'].apply(self._get_nouns)\n # self._get_frequent_features()\n # self._compactness_pruning()\n # self._redundancy_pruning()\n # self._ge...
[ "0.6566442", "0.64008427", "0.6272306", "0.6270147", "0.6244757", "0.62283623", "0.61422414", "0.6133686", "0.6117981", "0.6093613", "0.60885054", "0.60684276", "0.6040109", "0.60277957", "0.6005362", "0.59342384", "0.59225696", "0.59128237", "0.5904542", "0.58896387", "0.588...
0.64138544
1
Parse relation triplets over the following conditions 1. Remove triplets with pronouns and determinants in subj/obj; i.e. "we", "she" "I", "their", etc. 2. Harmonise duplicated triplets, return only the superset triplet Semantic comparison option using word mover distance & agglomerative clustering FastText via Gensim ...
def parse_triplets(self, levenshtein_thold: float=20., coph_scr: float=2.) -> Iterable[dict]: # Remove pronoun and determiners parse_triples = [triple for triple in self.__triples_corpus__ if (triple['subject'] not in self.__pron_det_pos_words__ and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_data_from_input_file(triplet):\n\n sentence = triplet.subject + ' ' + triplet.predicate + ' ' + triplet.object\n doc = nlp(unicode(sentence))\n root = doc[0]\n for t in doc:\n if t.pos_ == 'VERB' and t.head == t:\n root = t\n # elif t.pos_ == 'NOUN'\n\n # also, i...
[ "0.61057407", "0.56719995", "0.55161005", "0.5455312", "0.5447199", "0.5435746", "0.5421998", "0.5421532", "0.53770727", "0.5327237", "0.53150713", "0.5306053", "0.52893126", "0.52765054", "0.52570033", "0.5234349", "0.5214712", "0.5208659", "0.5204619", "0.5195088", "0.51826...
0.61369044
0
Set defaul config to app
def configure_app(self, defaults: t.Optional[DefaultConfig]) -> None: self.config = Config(defaults)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_config(app):\n # set config from config.py\n app.config.from_object('config')\n\n # override config from secret conf files\n pi_home = os.path.dirname(app.config['ENVPATH']) # /home/pi\n secret_conf_dir = os.path.join(pi_home, 'CONFIG_CHAUDIERE') # /home/pi/CONFIG_...
[ "0.7135407", "0.6767803", "0.67038256", "0.6664277", "0.65583634", "0.6471732", "0.6440063", "0.64349705", "0.64288706", "0.63906646", "0.6379789", "0.63641423", "0.63625246", "0.6274701", "0.627201", "0.6265376", "0.6263423", "0.6263423", "0.62554973", "0.6252563", "0.624745...
0.7263818
0
Validating ProductsDataViewSet by giving Invalid data
def test_ProductsDataViewSet_with_post_Invalid_data(self): payload = { "name": "1234" } # Request the data by API call. response = self.client.post('/api/productsdata/', data=json.dumps(payload), content...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_dataset(self):\n pass", "def is_valid(self, dataset):\n pass", "def test_ProductsDataViewSet_with_get_request_Invalid_id(self):\n # Request the data by API call.\n response = self.client.get('/api/productsdata/{}/'.format(-1))\n\n # Checking the response\n ...
[ "0.6795187", "0.6527712", "0.62331474", "0.62078047", "0.6093575", "0.6072888", "0.5991253", "0.5977534", "0.59747654", "0.5947358", "0.5937604", "0.5932143", "0.59246784", "0.5910832", "0.58964", "0.5830329", "0.5815245", "0.5773554", "0.5771487", "0.57573295", "0.57554066",...
0.73469806
0
Validating ProductsDataViewSet using get request method
def test_ProductsDataViewSet_with_get_request(self): # Request the data by API call. response = self.client.get('/api/productsdata/') # Checking the response self.assertEqual(response.status_code, 200) self.assertEqual(response.json()['count'], 1) self.assertEqual(respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ProductsDataViewSet_with_get_request_id(self):\n # Request the data by API call.\n response = self.client.get('/api/productsdata/{}/'.format(\n self.product_id))\n\n # Checking the response\n self.assertEqual(response.status_code, 200)\n self.assertIsNotNone(r...
[ "0.7251704", "0.6607075", "0.6369387", "0.5741582", "0.5719708", "0.5598621", "0.55916286", "0.55769634", "0.5567388", "0.5546251", "0.55135393", "0.5474931", "0.5474357", "0.5402799", "0.5396396", "0.5390451", "0.5390293", "0.5374702", "0.5366535", "0.53604525", "0.5345702",...
0.7067096
1
Validating ProductsDataViewSet using get request method with Id
def test_ProductsDataViewSet_with_get_request_id(self): # Request the data by API call. response = self.client.get('/api/productsdata/{}/'.format( self.product_id)) # Checking the response self.assertEqual(response.status_code, 200) self.assertIsNotNone(response.json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ProductsDataViewSet_with_get_request_Invalid_id(self):\n # Request the data by API call.\n response = self.client.get('/api/productsdata/{}/'.format(-1))\n\n # Checking the response\n self.assertEqual(response.status_code, 404)\n self.assertEqual(response.json()['detail'...
[ "0.7191686", "0.673298", "0.59211195", "0.585185", "0.58161724", "0.5667275", "0.5570321", "0.5554077", "0.5522598", "0.5515945", "0.5448646", "0.5404771", "0.53977585", "0.53932184", "0.5391353", "0.53493273", "0.53440976", "0.5339966", "0.533051", "0.53057694", "0.5302475",...
0.7739606
0
Validating ProductsDataViewSet using get request method with Invalid Id
def test_ProductsDataViewSet_with_get_request_Invalid_id(self): # Request the data by API call. response = self.client.get('/api/productsdata/{}/'.format(-1)) # Checking the response self.assertEqual(response.status_code, 404) self.assertEqual(response.json()['detail'], 'Not fou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ProductsDataViewSet_with_get_request_id(self):\n # Request the data by API call.\n response = self.client.get('/api/productsdata/{}/'.format(\n self.product_id))\n\n # Checking the response\n self.assertEqual(response.status_code, 200)\n self.assertIsNotNone(r...
[ "0.73838174", "0.650162", "0.6430197", "0.6365987", "0.59624434", "0.5900515", "0.5785338", "0.5644582", "0.5601564", "0.55595815", "0.5494436", "0.5453852", "0.5401711", "0.5401711", "0.5401711", "0.53924847", "0.5382707", "0.537352", "0.5360401", "0.5338085", "0.53339374", ...
0.77829665
0
Map towers to 412 integer Examples >>> state([[1], [3], [5, 4], [2]]) 668 = 0 40 + 2 41 + 1 42 + 2 43 + 2 44
def state(towers): ret = 0 for i, row in enumerate(towers): for val in row: ret += i * 4**(val-1) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_to_locations(state: list) -> list:\n\n locations = []\n for i in range(0, 16):\n locations.append((0, 0))\n # Each tuple represents a location on the board as (row, column)\n\n \"\"\" \"locations\" keeps track of all fifteen numbers in the given state and the goal \n state. The ...
[ "0.5918972", "0.58628327", "0.5638546", "0.56378", "0.55551183", "0.55406606", "0.5532196", "0.5530488", "0.55285954", "0.5523649", "0.5497859", "0.54556745", "0.5416261", "0.5404722", "0.53601176", "0.53601176", "0.53426325", "0.53384787", "0.53346574", "0.53269804", "0.5321...
0.70966303
0
Builds a CoverMultiWaySearchTree of n nodes with all the currency codes in the standard
def build_tree(n=None) -> CoverMultiWaySearchTree: tree = CoverMultiWaySearchTree() codes = [currency.code for currency in cur] shuffle(codes) currencies = [Currency(code) for code in codes] if n is None: n = len(currencies) for currency in currencies[:n]: tree[currency._code] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tree(n, d, name=defaultname):\n return build_tree_helper(1, n, 1, d, name)", "def build(n):\n if n not in memo:\n res = []\n if n % 2 != 0:\n for i in range(1, n - 1):\n left = i\n right = n - 1...
[ "0.5964563", "0.5795323", "0.5791167", "0.5771873", "0.55232745", "0.5508132", "0.5490907", "0.5467991", "0.5449655", "0.53897923", "0.53540474", "0.5349767", "0.53464985", "0.53308815", "0.5326568", "0.5323885", "0.5319227", "0.5293522", "0.5292058", "0.5261324", "0.52417105...
0.8640555
0
Find the number of items in nodes in range [a, b]
def get_number_of_useful_items(nodes, a: str, b: str) -> int: return sum(int(a <= item.key <= b) for node in nodes for item in node.elements)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f02_03_countElemBetween(l, a, b):\n return sum([a < x < b for x in l])", "def numberOfNodes(i):\n \n if (i == 1 or i == 2):\n i = RANGE\n else:\n i = i + RANGE\n return i", "def countNodes(epr):\n result = 1\n argLst = epr.args\n for arg in argLst:\n ...
[ "0.69374925", "0.6823391", "0.65383244", "0.6350672", "0.6334986", "0.6127555", "0.6124622", "0.6086067", "0.6057941", "0.6051697", "0.6039297", "0.5993141", "0.59556144", "0.59417903", "0.59389144", "0.5936251", "0.59148836", "0.5914569", "0.5904718", "0.5901973", "0.5877726...
0.8006855
0
Tries to compute the (k, c1, c2)cover of tree with the minimum number of nodes. It follows a greedylike approach.
def compute_cover(tree: CoverMultiWaySearchTree, k: int, c1: str, c2: str) -> Optional[Set[CoverMultiWaySearchTree.Position.Node]]: # Step 1: Find nodes useful for the (k, c1, c2)-cover nodes = tree.find_nodes_in_range(c1, c2) # Step 2: Count number of items in range [c1, c2] n = get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Trees__LCA_LowestCommonDenominator():\n # Python2 ported to Python3 via 2to3-3.7\n # URL:# URL:https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor/problem\n '''\n class Node:\n def __init__(self,info): \n self.info = info \n self.left ...
[ "0.58355105", "0.5734315", "0.5723906", "0.56961703", "0.55900025", "0.55862707", "0.5409351", "0.53967494", "0.53904384", "0.53811276", "0.5372247", "0.53711116", "0.536589", "0.5354127", "0.53164554", "0.52926135", "0.529009", "0.5275919", "0.5232045", "0.52311265", "0.5228...
0.7809844
0
given 2d image, lidar and camera as well as the current scan message, localizes the pixel against the lidar data
def localize_pixel(img_pos,camera : Camera,lidar : Lidar, scan : LaserScan) -> tuple: # ---OBJ-- # x r1 /\ r2 x # / \ #cam_ray / \ average_ray # / \ # / \ # CAM ----> LID # # has to be 2d assert (img_pos.size == 2) cam_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localize(image):\n\n # Call the vision function in order to have the grid with the obstacle and the goal coordinate\n object_grid, occupancy_grid, world = vision(image)\n\n # Correction of the goal coordinate in order to fit the A* coordinate\n goal_x = object_grid[0][1]\n goal_y = WIDTH_G - o...
[ "0.5971704", "0.59564734", "0.5860076", "0.57806957", "0.57335377", "0.56992394", "0.5685931", "0.56329805", "0.5621531", "0.5617687", "0.5521019", "0.5454433", "0.54460114", "0.5421576", "0.5418019", "0.53956425", "0.5381104", "0.53777224", "0.53671235", "0.53640884", "0.534...
0.80712897
0
Check that the no_cache cache control header is set on the resopnse.
def test_no_cache(self): content = self.unique() self.assertViewBehavior( {"cache_control_no_cache": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "no-cache"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def nocache(response):\n response.headers['Cache-Control'] = 'no-store, no-cache, m...
[ "0.7414972", "0.6805398", "0.67788416", "0.67497075", "0.6657216", "0.6639991", "0.6516709", "0.6489518", "0.6489176", "0.64887327", "0.644979", "0.6448329", "0.6426001", "0.63928515", "0.63785326", "0.6366645", "0.63470674", "0.63470674", "0.63428575", "0.6316757", "0.628442...
0.7025476
1
Check that the no_transform cache control header is set on the resopnse.
def test_no_transform(self): content = self.unique() self.assertViewBehavior( {"cache_control_no_transform": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "no-transform"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def test_not_modified_headers(self):\n\n def get_response(req):\n resp = sel...
[ "0.6575073", "0.62584645", "0.6253825", "0.61756957", "0.6135134", "0.61045665", "0.6085116", "0.6053426", "0.6017882", "0.58883804", "0.5885764", "0.5883365", "0.58609915", "0.58609915", "0.577764", "0.5760166", "0.57544553", "0.5737813", "0.5737813", "0.5734081", "0.5727316...
0.72058463
0
Check that the must_revalidate cache control header is set on the resopnse.
def test_must_revalidate(self): content = self.unique() self.assertViewBehavior( {"cache_control_must_revalidate": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "must-revalidate"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def has_cached(self,ourmod,etag=None):\n if \"If-Modified-Since\" in self.request.heade...
[ "0.70986366", "0.67210567", "0.6683338", "0.6584366", "0.6584366", "0.6293861", "0.62422216", "0.62041104", "0.6199004", "0.6124973", "0.6101025", "0.608115", "0.6053864", "0.60428745", "0.60428745", "0.6038889", "0.6029584", "0.6014237", "0.600515", "0.5989785", "0.59765875"...
0.7850928
0
Check that the proxy_revalidate cache control header is set on the response.
def test_proxy_revalidate(self): content = self.unique() self.assertViewBehavior( {"cache_control_proxy_revalidate": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "proxy-revalidate"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_must_revalidate(self):\n content = self.unique()\n self.assertViewBehavior(\n {\"cache_control_must_revalidate\": True, \"get\": content},\n status_code=200,\n content=content,\n headers_exact={\"Cache-Control\": \"must-revalidate\"})", "def _may...
[ "0.72086537", "0.7039436", "0.6617241", "0.65517527", "0.6426039", "0.6425563", "0.6400477", "0.63885456", "0.63592887", "0.6339059", "0.6339059", "0.6319922", "0.6256228", "0.6244743", "0.62436944", "0.6205305", "0.6193491", "0.6190335", "0.6190335", "0.612926", "0.6054342",...
0.7780337
0
Check that the max_age cache control header is set on the resopnse.
def test_max_age(self): content = self.unique() self.assertViewBehavior( {"cache_control_max_age": 1, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "max-age=1"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_client_max_age_3600(self, sess):\r\n r = sess.get(self.url)\r\n assert self.cache.get(self.url) == r.raw\r\n\r\n # request that we don't want a new one unless\r\n r = sess.get(self.url, headers={'Cache-Control': 'max-age=3600'})\r\n assert r.from_cache is True\r\n\r\n ...
[ "0.72107726", "0.6873612", "0.68624157", "0.66889685", "0.6536094", "0.6532378", "0.6311946", "0.62280434", "0.6197227", "0.61068356", "0.61068356", "0.6103469", "0.60647094", "0.6050893", "0.5995915", "0.5928432", "0.58629507", "0.58624345", "0.5841793", "0.5827531", "0.5821...
0.7228714
0
Check that the s_maxage cache control header is set on the response.
def test_s_maxage(self): content = self.unique() self.assertViewBehavior( {"cache_control_s_maxage": 1, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "s-maxage=1"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_max_age(self):\n content = self.unique()\n self.assertViewBehavior(\n {\"cache_control_max_age\": 1, \"get\": content},\n status_code=200,\n content=content,\n headers_exact={\"Cache-Control\": \"max-age=1\"})", "def test_client_max_age_3600(self...
[ "0.7056533", "0.69589156", "0.6764175", "0.6662597", "0.6601882", "0.6553718", "0.6453501", "0.640816", "0.6405672", "0.63611406", "0.63209236", "0.63209236", "0.63096035", "0.6251666", "0.6251313", "0.6150831", "0.6150831", "0.6129807", "0.6030514", "0.6019444", "0.60143363"...
0.71437556
0
Check that the behavior is disabled when cache_control is falsy.
def test_disabled(self): content = self.unique() self.assertViewBehavior({ "cache_control": False, "cache_control_public": True, "get": content}, status_code=200, content=content, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_disabled(self):\n content = self.unique()\n self.assertViewBehavior(\n {\"never_cache\": False, \"get\": content},\n status_code=200,\n content=content,\n headers_exclude=\"Cache-Control\")", "def test_no_cache(self):\n content = self.uniq...
[ "0.6935497", "0.6439297", "0.6283687", "0.62281615", "0.62020856", "0.6143714", "0.61050105", "0.6087825", "0.59735376", "0.58653027", "0.57895696", "0.5783289", "0.5764132", "0.57436347", "0.57417667", "0.5730427", "0.5700605", "0.5676634", "0.5612492", "0.5606958", "0.55914...
0.70288587
0
Check that the default HTTP method name protection takes precedence and that no cache control headers are set on the response.
def test_precedence(self): self.assertViewBehavior( {"cache_control_public": True}, status_code=405, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_precedence(self):\n self.assertViewBehavior(\n status_code=405,\n headers_exclude=\"Cache-Control\")", "def test_cache_page_precedence(self):\n self.assertViewBehavior(\n status_code=405)", "def filter_request():\n if request.method not in ALLOWED_...
[ "0.7021219", "0.6748958", "0.65596247", "0.64970404", "0.6401734", "0.6361947", "0.6359896", "0.6333692", "0.6294945", "0.62907964", "0.626692", "0.6196885", "0.6187532", "0.6166396", "0.61391157", "0.6137009", "0.6135213", "0.6134873", "0.6127822", "0.6123319", "0.6056474", ...
0.7186979
0
Check that the behavior is disabled when never_cache is falsy.
def test_disabled(self): content = self.unique() self.assertViewBehavior( {"never_cache": False, "get": content}, status_code=200, content=content, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_be_disabled(self) -> bool:\n return True", "def test_disabled(self):\n content = self.unique()\n self.assertViewBehavior({\n \"cache_control\": False,\n \"cache_control_public\": True,\n \"get\": content},\n status_code=200,\n ...
[ "0.6629997", "0.6369304", "0.6163698", "0.6107162", "0.60885584", "0.60602385", "0.6041304", "0.60086805", "0.59680194", "0.5952674", "0.5931698", "0.5891131", "0.5890093", "0.5888327", "0.58407855", "0.58371407", "0.5833242", "0.58196545", "0.57784563", "0.57356924", "0.5717...
0.66546726
0
Check that the defualt HTTP method name protection takes precedence and that no cache control headers are set on the response.
def test_precedence(self): self.assertViewBehavior( status_code=405, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_precedence(self):\n self.assertViewBehavior(\n {\"cache_control_public\": True},\n status_code=405,\n headers_exclude=\"Cache-Control\")", "def test_cache_page_precedence(self):\n self.assertViewBehavior(\n status_code=405)", "def filter_reques...
[ "0.7131305", "0.6643577", "0.6529459", "0.6490842", "0.63628715", "0.6359141", "0.6331613", "0.62303495", "0.6216774", "0.62062776", "0.6205969", "0.619509", "0.6160482", "0.6113934", "0.6082911", "0.6071884", "0.6065874", "0.6062073", "0.6059281", "0.6055744", "0.6038644", ...
0.6926853
1
Get all command parsers
def get_all_command_parsers(self) -> None: for command in self.commands: self.get_command_parser(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_parsers():\n return [OptimizerFactory.get_parser(optimizer) for optimizer in OptimizerFactory.optimizers]", "def get_parsers(self):\n return tuple([getattr(self, '_{}'.format(i)) for i in self.parsers_available])", "def list_parsers(self, *args):\n print('==== Available parsing...
[ "0.7812656", "0.76759416", "0.7401005", "0.715044", "0.68813735", "0.6622853", "0.65283746", "0.6448501", "0.63693243", "0.6357003", "0.63433", "0.629923", "0.62847006", "0.6254544", "0.6221769", "0.62131053", "0.61972797", "0.617932", "0.6152421", "0.6145008", "0.61301106", ...
0.8496855
0
Checks if controller has commands
def has_commands(self) -> bool: return len(self.commands) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_commands(self):\n pass", "def check_commands(self):\n self.check_subsystem_commands()\n self._select_mode()", "def check_subsystem_commands(self):\n self.communications.check_controls()\n self.__check_video()\n self.__check_picture()\n self.__check_pin...
[ "0.78209513", "0.69910705", "0.6867466", "0.6849808", "0.6793685", "0.67325574", "0.6730906", "0.66486543", "0.65833414", "0.6539244", "0.65337753", "0.65301454", "0.65070695", "0.64574474", "0.6441197", "0.6439012", "0.643634", "0.6421861", "0.6406352", "0.6401896", "0.63948...
0.78347164
0
Gets all controllers modules
def _get_modules(self) -> Dict[str, ModuleType]: modules = {} terminal_path = Path(openbb_terminal.__file__).parent for file in terminal_path.glob("**/*controller.py"): spec = spec_from_file_location(file.stem, file) if spec is not None and spec.loader is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_modules(self):\n return self._modules.values()", "def get_controllers(self):\n s = self._NDL_API('getcontrollers', {})\n return s.split(\",\")", "def modules(self):\n return self._modules.keys()", "def modules(self):\n return self._modules", "def init_controllers(self...
[ "0.6834421", "0.6675395", "0.6673012", "0.6617", "0.65380013", "0.65167725", "0.6488117", "0.635962", "0.62996364", "0.62916434", "0.6280447", "0.6221304", "0.62206507", "0.6197537", "0.61878586", "0.6163962", "0.61522275", "0.61329126", "0.6120377", "0.6109719", "0.610647", ...
0.6716505
1
Get the ControllerDoc instance for a controller
def get_controller_doc(self, controller_name: str) -> ControllerDoc: if controller_name not in self.controller_docs: raise KeyError(f"Controller {controller_name} not found") return self.controller_docs[controller_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_controller(self):\n return self.__controller", "def getController(self):\n return self.__controller", "def controller( self ):\n\t\ttry:\n\t\t\treturn self._controller\n\t\texcept Exception as e:\n\t\t\tself.logToConsole( \"controller: %s\" % str(e) )", "def get_controller(cls):\n i...
[ "0.741653", "0.7332534", "0.7241322", "0.7156778", "0.69970584", "0.67327803", "0.66837436", "0.6661715", "0.6410457", "0.6287942", "0.6268927", "0.62614125", "0.6155133", "0.59957176", "0.5957962", "0.59505653", "0.5928965", "0.58955836", "0.5859399", "0.58194286", "0.570986...
0.8244815
0
Return the mongodb session document or None
def _get_mongo_session(self, sid): return self.coll.find_one({'sid': sid})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def find_session_by_id(id: int, mongo: MongoDB = mongodb) -> SessionOutModel:\n if session := await mongo.session_coll.find_one({\"id\": id}):\n return SessionOutModel(**session)\n else:\n return SessionOutModel()", "def document(self):\n query = {\"_id\": ObjectId(self.document_...
[ "0.68857235", "0.6614606", "0.6558535", "0.6487476", "0.64846057", "0.6472054", "0.6447504", "0.6445352", "0.6444354", "0.64425755", "0.64312917", "0.6427674", "0.6427674", "0.6384613", "0.63736564", "0.636652", "0.636652", "0.63567775", "0.62485236", "0.61746705", "0.6169451...
0.7997712
0
Returns IEX Corporate Actions from the refdata endpoints
def get_iex_corporate_actions(start=None, **kwargs): return CorporateActions(start=start, **kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions(self) -> List[str]:\n return list(self.__endpoints.keys())", "def _get_cloud_functions_actions(self, namespace_id):\n\n res = requests.get(\n f\"{self.cf_namespaces_url}/{namespace_id}/actions?limit=200\",\n headers=self.get_headers(),\n )\n return js...
[ "0.578277", "0.5591671", "0.55305415", "0.546881", "0.5408633", "0.5356158", "0.5350876", "0.53415024", "0.53084", "0.5253717", "0.5253717", "0.5253717", "0.5253487", "0.524838", "0.52430826", "0.52192104", "0.51942307", "0.51654327", "0.51577294", "0.51444995", "0.5118404", ...
0.6782529
0
Returns IEX Dividends from the refdata endpoints
def get_iex_dividends(start=None, **kwargs): return Dividends(start=start, **kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path_endpoints(self):\n endpoints = []\n\n # Get the far end of the last path segment\n path, split_ends, position_stack = self.trace()\n endpoint = path[-1][2]\n if split_ends is not None:\n for termination in split_ends:\n endpoints.extend(term...
[ "0.57260317", "0.570597", "0.5704981", "0.5656375", "0.5609971", "0.542474", "0.5416715", "0.54091465", "0.5392832", "0.53809077", "0.5363819", "0.53049743", "0.52954215", "0.5283466", "0.5228727", "0.52135223", "0.51494527", "0.5141439", "0.51192796", "0.5101566", "0.5099677...
0.60407233
0
Returns IEX Next Day Ex Date from the refdata endpoints
def get_iex_next_day_ex_date(start=None, **kwargs): return NextDay(start=start, **kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_day(self):\n pass", "def next_day(isotext):\n as_arrow = arrow.get(isotext)\n return as_arrow.replace(days=+1).isoformat()", "def next_day(isotext):\n as_arrow = arrow.get(isotext)\n return as_arrow.replace(days=+1).isoformat()", "def _get_date(self, relative_idx):\r\n ...
[ "0.6659892", "0.6455671", "0.6455671", "0.5981699", "0.57411253", "0.56931394", "0.5636958", "0.5636958", "0.562946", "0.55402404", "0.5531359", "0.5511678", "0.54665154", "0.5407168", "0.538642", "0.5366092", "0.5354358", "0.5353504", "0.5346452", "0.53019017", "0.5287904", ...
0.71448374
0
Returns IEX Listed Symbol Directory from the refdata endpoints
def get_iex_listed_symbol_dir(start=None, **kwargs): return ListedSymbolDir(start=start, **kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_entries(self):", "async def Available_Endpoints() -> List[Dict[str, str]]:\n return [{\"path\": endpoint} for endpoint in busylightapi.endpoints]", "def uri(self) -> list:\n raise NotImplementedError(\"ErddapArgoDataFetcher.uri not implemented\")", "def build_filelist(basepath):\n log.i...
[ "0.52443194", "0.52027243", "0.51738554", "0.50811166", "0.507001", "0.5039871", "0.5038013", "0.5036818", "0.5025535", "0.5022163", "0.5022163", "0.4984427", "0.4979942", "0.49156174", "0.48973256", "0.48810825", "0.48625612", "0.48537242", "0.48472953", "0.48335177", "0.483...
0.67579544
0
Configures CUDA environment variable and returns tensorflow GPU config.
def set_gpu(gpu): os.environ['CUDA_VISIBLE_DEVICES'] = gpu tf_config = tf.ConfigProto() tf_config.gpu_options.allow_growth = True return tf_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_gpu_tf():\n\n try:\n # locate available devices & set required environment variables\n available_device_ids = GPUtil.getFirstAvailable(order='first', maxLoad=0.7, maxMemory=0.7, attempts=1, interval=10)\n available_device_id = available_device_ids[0]\n os.environ['CUDA_...
[ "0.7806248", "0.71696466", "0.7148312", "0.7142579", "0.69135433", "0.686044", "0.6859421", "0.6798698", "0.6659943", "0.66523975", "0.6578853", "0.64233935", "0.6382924", "0.63151455", "0.62676334", "0.6249967", "0.6245296", "0.620838", "0.6173646", "0.6164236", "0.61608374"...
0.78912264
0
Create baseline convolutional recurrent model. Arguments
def create_baseline_model(filters, gru_units, dropout, bias, mels, nb_classes): inp = Input(shape=(259, mels, 1)) x = Conv2D(filters, (3,3), padding='same', activation='relu', use_bias=bias)(inp) x = MaxPooling2D(pool_size=(1,5))(x) x = Conv2D(filters, (3,3), padding='same', activation='relu', use_bias=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_baseline(cls: Type['ResNet'], *, d_in: int, n_blocks: int, d_main: int, d_hidden: int, dropout_first: float, dropout_second: float, d_out: int) ->'ResNet':\n return cls(d_in=d_in, n_blocks=n_blocks, d_main=d_main, d_hidden=d_hidden, dropout_first=dropout_first, dropout_second=dropout_second, normal...
[ "0.647522", "0.6304403", "0.6284953", "0.6194349", "0.60414153", "0.5895362", "0.587735", "0.58602476", "0.58557093", "0.5830293", "0.5820108", "0.5811813", "0.5765692", "0.576528", "0.5761624", "0.57612926", "0.5757742", "0.5744773", "0.573896", "0.57358533", "0.573499", "...
0.64495075
1
Plot the accuracy during training for the train and val datasets. Arguments
def plot_accuracy(model_fit, save_folder): train_acc = model_fit.history['binary_accuracy'] val_acc = model_fit.history['val_binary_accuracy'] epoch_axis = np.arange(1, len(train_acc) + 1) plt.title('Train vs Validation Accuracy') plt.plot(epoch_axis, train_acc, 'b', label='Train Acc') plt.plot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_accuracy(self):\n plot_title, img_title = self.prep_titles(\"\")\n test_legend = ['training data', 'test data']\n\n # Data for plotting x- and y-axis\n x = np.arange(1, CFG.EPOCHS + 1)\n y = [self.tr_accuracy, self.test_accuracy]\n\n # prints x and y-axis values\n...
[ "0.82207394", "0.7538035", "0.7494659", "0.74623656", "0.7418454", "0.7315145", "0.72615117", "0.72388804", "0.7238736", "0.71817374", "0.7173168", "0.71567535", "0.7148802", "0.71439624", "0.7055238", "0.70549214", "0.7051441", "0.7018947", "0.70176554", "0.70033777", "0.700...
0.7705123
1
Plot and save the ROC with AUC value. Arguments
def plot_ROC(model, x_test, y_test, save_folder): predicted = model.predict(x_test).ravel() actual = y_test.ravel() fpr, tpr, thresholds = roc_curve(actual, predicted, pos_label=None) roc_auc = auc(fpr, tpr) plt.title('Test ROC AUC') plt.plot(fpr, tpr, 'b', label='AUC = %0.3f' % roc_auc) pl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_roc(X,y,test_preds,fname=\"res/roc.png\"):\n\t#Retrieve multiple fpr and tpr values for different thresholds\n\tfpr, tpr, thresholds = roc_curve(y,test_preds)\n\tplt.plot(fpr, tpr)\n\tplt.title(auc(fpr, tpr))\n\tplt.savefig(fname, bbox_inches='tight')\n\tplt.close()", "def plot_roc_acc(self,x_test,y_tes...
[ "0.7867306", "0.7626776", "0.732372", "0.7319301", "0.73173314", "0.7298921", "0.7294701", "0.7286847", "0.71924317", "0.71809953", "0.71744895", "0.7162829", "0.71388173", "0.712525", "0.70957816", "0.7076601", "0.70679814", "0.70641404", "0.706279", "0.69863737", "0.6980341...
0.78781956
0
Saves the network architecture as a .txt file. Arguments
def save_arch(model, save_folder): with open(save_folder + '/architecture.txt','w') as a_save: model.summary(print_fn=lambda x: a_save.write(x + '\n'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, path=\"\"):\n path = path + \"model_\" + str(self.name) + \".txt\"\n if os.path.isfile(path):\n os.remove(path)\n f = open(path, \"w+\")\n for ident in self.networks:\n f.write(ident + \"_\" + self.networks[ident].descriptor.codify_components() + \"_...
[ "0.7442755", "0.6993565", "0.69844145", "0.69380265", "0.69357723", "0.6913174", "0.6849668", "0.6798643", "0.66806936", "0.65847754", "0.6535876", "0.6521386", "0.64706856", "0.6424189", "0.6404124", "0.6398808", "0.63774717", "0.6374491", "0.6335782", "0.6327243", "0.629258...
0.7138623
1
Compute and store the QC metrics Runs the QC on the session and stores a map of the metrics for each datapoint for each test, and a map of which datapoints passed for each test
def compute(self, **kwargs): if self.extractor is None: kwargs['download_data'] = kwargs.pop('download_data', self.download_data) self.load_data(**kwargs) self.log.info(f"Session {self.session_path}: Running QC on behavior data...") self.metrics, self.passed = get_bpodqc_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(self, download_data=None):\n if self.extractor is None:\n # If download_data is None, decide based on whether eid or session path was provided\n ensure_data = self.download_data if download_data is None else download_data\n self.load_data(download_data=ensure_dat...
[ "0.6188606", "0.6146431", "0.6113068", "0.60673046", "0.59287566", "0.5926206", "0.5902293", "0.5877014", "0.5784998", "0.573546", "0.5707369", "0.5694776", "0.56773263", "0.5656921", "0.5625058", "0.5584204", "0.55599093", "0.5556537", "0.55550545", "0.55543596", "0.5553796"...
0.61870587
1
Given a dictionary of results, computes the overall session QC for each key and aggregates in a single value
def compute_session_status_from_dict(results): indices = np.zeros(len(results), dtype=int) for i, k in enumerate(results): if k in TaskQC.criteria.keys(): indices[i] = TaskQC._thresholding(results[k], thresholds=TaskQC.criteria[k]) else: indices[i]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate_results(results):\n\n for (config,con,dec),folds in results.iteritems():\n m = MODEL_PATTERN.match(config)\n if m:\n mode = m.groupdict()['mode'] # mle, rl, mrt, ...\n model = m.groupdict()['model'] # haem, hacm, hard, ...\n align = m.groupdict()['a...
[ "0.6222572", "0.60406405", "0.5990933", "0.5945015", "0.58555114", "0.5849532", "0.5788227", "0.57747865", "0.5715895", "0.5701647", "0.56428385", "0.5619109", "0.5589009", "0.55545366", "0.5523717", "0.5481006", "0.5478383", "0.545642", "0.54334474", "0.53829503", "0.5372924...
0.6752876
0
Computes the overall session QC for each key and aggregates in a single value
def compute_session_status(self): if self.passed is None: raise AttributeError('passed is None; compute QC first') # Get mean passed of each check, or None if passed is None or all NaN results = {k: None if v is None or np.isnan(v).all() else np.nanmean(v) for k, v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate(self):\n data_to_track = {}\n for possession in self.possessions_to_track_aggregate:\n data_to_track[possession] = self._haves[possession]\n\n for variable in self.variables_to_track_aggregate:\n try:\n data_to_track[variable] = self.__dict__[...
[ "0.5516195", "0.5445356", "0.5358602", "0.5349585", "0.5333742", "0.5271777", "0.52661145", "0.5255679", "0.5213781", "0.5190634", "0.51589733", "0.51226103", "0.51122093", "0.50610095", "0.5024973", "0.501899", "0.50044125", "0.49149823", "0.49074388", "0.48728678", "0.48719...
0.5601444
0
Compute and store the QC metrics Runs the QC on the session and stores a map of the metrics for each datapoint for each test, and a map of which datapoints passed for each test
def compute(self, download_data=None): if self.extractor is None: # If download_data is None, decide based on whether eid or session path was provided ensure_data = self.download_data if download_data is None else download_data self.load_data(download_data=ensure_data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(self, **kwargs):\n if self.extractor is None:\n kwargs['download_data'] = kwargs.pop('download_data', self.download_data)\n self.load_data(**kwargs)\n self.log.info(f\"Session {self.session_path}: Running QC on behavior data...\")\n self.metrics, self.passed =...
[ "0.61865723", "0.61484236", "0.6111889", "0.6068964", "0.59302425", "0.5927652", "0.5902292", "0.5878314", "0.5785274", "0.5735238", "0.57067233", "0.56961745", "0.56763333", "0.5656826", "0.5624611", "0.5584238", "0.55624455", "0.55575174", "0.5555539", "0.5554058", "0.55537...
0.6186402
1
Evaluates all the QC metric functions in this module (those starting with 'check') and returns the results. The optional kwargs listed below are passed to each QC metric function.
def get_bpodqc_metrics_frame(data, **kwargs): def is_metric(x): return isfunction(x) and x.__name__.startswith('check_') # Find all methods that begin with 'check_' checks = getmembers(sys.modules[__name__], is_metric) prefix = '_task_' # Extended QC fields will start with this # Method 'ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_all(self):\n # TODO: this should use functions in execute.py to run tests in-sequence so that variable\n # name collisions are accounted for\n self._log_event(EventType.BEGIN_CHECK_ALL)\n\n # TODO: this is a janky way of resolving where the tests are. Formalize a method of \n ...
[ "0.5860062", "0.5827285", "0.5809412", "0.57624185", "0.5620037", "0.5605969", "0.5575548", "0.55414146", "0.54573965", "0.5391575", "0.5385385", "0.53589267", "0.5340336", "0.53369385", "0.53235877", "0.53075016", "0.53034043", "0.5302152", "0.52251285", "0.52243036", "0.521...
0.6367398
0
Checks that the time difference between the onset of the visual stimulus and the onset of the go cue tone is positive and less than 10ms.
def check_stimOn_goCue_delays(data, **_): # Calculate the difference between stimOn and goCue times. # If either are NaN, the result will be Inf to ensure that it crosses the failure threshold. metric = np.nan_to_num(data["goCue_times"] - data["stimOn_times"], nan=np.inf) passed = (metric < 0.01) & (met...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def check_errorCue_delays(data, **_):\n metric = np.nan_to_num(data[\"errorCue_times\"] - data[\"errorCueTrigger_times\"], nan=np.inf...
[ "0.67452455", "0.661119", "0.66066587", "0.6345932", "0.6258288", "0.6236096", "0.6135885", "0.610645", "0.6103701", "0.60535103", "0.5981245", "0.59316677", "0.5911776", "0.5881983", "0.5873338", "0.5859669", "0.58114415", "0.5803081", "0.57706165", "0.57561266", "0.57425934...
0.6955062
0
Checks that the time difference between the response and the feedback onset (error sound or valve) is positive and less than 10ms.
def check_response_feedback_delays(data, **_): metric = np.nan_to_num(data["feedback_times"] - data["response_times"], nan=np.inf) passed = (metric < 0.01) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed) return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def check_errorCue_delays(data, **_):\n metric = np.nan_to_num(data[\"errorCue_times\"] - data[\"errorCueTrigger_times\"], nan=np.inf...
[ "0.6539133", "0.6228387", "0.5913726", "0.58829933", "0.58373797", "0.5837246", "0.58290553", "0.5787292", "0.5782435", "0.5740518", "0.57268006", "0.5696717", "0.5689673", "0.5688602", "0.56735766", "0.5667824", "0.56554264", "0.56536883", "0.5650586", "0.5647413", "0.562253...
0.66533184
0
Checks that the time difference between the visual stimulus freezing and the response is positive and less than 100ms.
def check_response_stimFreeze_delays(data, **_): # Calculate the difference between stimOn and goCue times. # If either are NaN, the result will be Inf to ensure that it crosses the failure threshold. metric = np.nan_to_num(data["stimFreeze_times"] - data["response_times"], nan=np.inf) # Test for valid ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def remaining_ms():", "def check_stimFreeze_delays(data, **_):\n metric = np.nan_to_num(data[\"stimFreeze_times\"] - data[\"stimFre...
[ "0.6850367", "0.66160536", "0.6374804", "0.6345569", "0.6269667", "0.6260532", "0.6249905", "0.6247848", "0.62191147", "0.6194862", "0.6190176", "0.61887175", "0.6181643", "0.61796886", "0.6098504", "0.60839707", "0.6060317", "0.6029891", "0.6001722", "0.5985031", "0.59810483...
0.69304246
0
Check that the wheel does move within 100ms of the feedback onset (error sound or valve).
def check_wheel_move_before_feedback(data, **_): # Get tuple of wheel times and positions within 100ms of feedback traces = traces_by_trial( data["wheel_timestamps"], data["wheel_position"], start=data["feedback_times"] - 0.05, end=data["feedback_times"] + 0.05, ) metric ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_check(self):\n #loop three times and moce the servo \n for ang in range(self.MIDPOINT - 115, self.MIDPOINT+116, 115):\n self.servo(ang)\n time.sleep(.05)\n if self.read_distance() < self.SAFE_DISTANCE:\n return False\n #if the three-par...
[ "0.66823375", "0.6660327", "0.6061239", "0.6020045", "0.60030603", "0.59889495", "0.5890945", "0.58775824", "0.58463895", "0.58456963", "0.58017486", "0.57889277", "0.574577", "0.57411665", "0.57179874", "0.56755745", "0.5675489", "0.5675418", "0.56641567", "0.5627082", "0.55...
0.68362546
0
Check that the wheel moves by approximately 35 degrees during the closedloop period on trials where a feedback (error sound or valve) is delivered.
def check_wheel_move_during_closed_loop(data, wheel_gain=None, **_): # Get the Bpod extracted wheel data timestamps = data['wheel_timestamps'] position = data['wheel_position'] return _wheel_move_during_closed_loop(timestamps, position, data, wheel_gain, tol=3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_wheel_move_before_feedback(data, **_):\n # Get tuple of wheel times and positions within 100ms of feedback\n traces = traces_by_trial(\n data[\"wheel_timestamps\"],\n data[\"wheel_position\"],\n start=data[\"feedback_times\"] - 0.05,\n end=data[\"feedback_times\"] + 0.05...
[ "0.68954474", "0.6710869", "0.6472989", "0.6405544", "0.6370359", "0.6348814", "0.6189378", "0.61632794", "0.61214834", "0.60362446", "0.59838736", "0.59421074", "0.5902024", "0.5865627", "0.5801896", "0.5794535", "0.5791539", "0.576547", "0.5760083", "0.57588446", "0.5731025...
0.6723247
1
Check that the wheel moves by approximately 35 degrees during the closedloop period on trials where a feedback (error sound or valve) is delivered. This check uses the Bpod wheel data (measured at a lower resolution) with a stricter tolerance (1 visual degree).
def check_wheel_move_during_closed_loop_bpod(data, wheel_gain=None, **_): # Get the Bpod extracted wheel data timestamps = data.get('wheel_timestamps_bpod', data['wheel_timestamps']) position = data.get('wheel_position_bpod', data['wheel_position']) return _wheel_move_during_closed_loop(timestamps, pos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_wheel_move_during_closed_loop(data, wheel_gain=None, **_):\n # Get the Bpod extracted wheel data\n timestamps = data['wheel_timestamps']\n position = data['wheel_position']\n\n return _wheel_move_during_closed_loop(timestamps, position, data, wheel_gain, tol=3)", "def check_wheel_move_befor...
[ "0.70852953", "0.6954929", "0.67112726", "0.6621059", "0.65253836", "0.61799824", "0.60759044", "0.60224724", "0.5899143", "0.58587676", "0.5816214", "0.57901406", "0.5771904", "0.5665009", "0.5647753", "0.564011", "0.5637705", "0.5631486", "0.562445", "0.558077", "0.5572283"...
0.6956577
1
Check that the wheel does not move more than 2 degrees in each direction during the quiescence interval before the stimulus appears.
def check_wheel_freeze_during_quiescence(data, **_): assert np.all(np.diff(data["wheel_timestamps"]) >= 0) assert data["quiescence"].size == data["stimOnTrigger_times"].size # Get tuple of wheel times and positions over each trial's quiescence period qevt_start_times = data["stimOnTrigger_times"] - data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_check(self):\n # loop three times and move the servo\n for ang in range(self.MIDPOINT - 100, self.MIDPOINT + 101, 100):\n self.servo(ang)\n time.sleep(.01)\n if self.read_distance() < self.SAFE_DISTANCE:\n return False \n # if the th...
[ "0.6584762", "0.6560514", "0.5976932", "0.59019744", "0.5843425", "0.57786036", "0.5677382", "0.5633235", "0.55985075", "0.55899405", "0.55809784", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802", "0.5558802"...
0.7057081
0
Check that the number events per trial is correct Within every trial interval there should be one of each trial event, except for goCueTrigger_times which should only be defined for incorrect trials
def check_n_trial_events(data, **_): intervals = data['intervals'] correct = data['correct'] err_trig = data['errorCueTrigger_times'] # Exclude these fields; valve and errorCue times are the same as feedback_times and we must # test errorCueTrigger_times separately # stimFreeze_times fails oft...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_goCue_delays(data, **_):\n metric = np.nan_to_num(data[\"goCue_times\"] - data[\"goCueTrigger_times\"], nan=np.inf)\n passed = (metric <= 0.0015) & (metric > 0)\n assert data[\"intervals\"].shape[0] == len(metric) == len(passed)\n return metric, passed", "def check_errorCue_delays(data, **_...
[ "0.6352797", "0.6281508", "0.6265516", "0.6174661", "0.610466", "0.6047479", "0.598376", "0.58821785", "0.58792245", "0.58375305", "0.5833678", "0.5823899", "0.5821095", "0.57591885", "0.57549226", "0.5688481", "0.56665254", "0.5654957", "0.56445843", "0.5622237", "0.5621385"...
0.79935586
0
Check that the time difference between the visual stimulus offsetcommand being triggered and the visual stimulus effectively turning off on the screen is smaller than 150 ms.
def check_stimOff_delays(data, **_): metric = np.nan_to_num(data["stimOff_times"] - data["stimOffTrigger_times"], nan=np.inf) passed = (metric <= 0.15) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed) return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time():\n times = get_times()\n time_difference = abs((times['local'] - times['target']).total_seconds())\n return time_difference < post_time_tol_seconds", "def time_is_out(self):\n return self.get_simulation_time() > self.config.max_time", "def check_stimOn_delays(data, **_):\n m...
[ "0.58006537", "0.56599766", "0.5618854", "0.5499769", "0.5478083", "0.53942436", "0.53775084", "0.5348891", "0.5329084", "0.53289485", "0.5304241", "0.5275082", "0.52612203", "0.52390426", "0.5216157", "0.5191221", "0.51908827", "0.5189167", "0.51579493", "0.51578766", "0.514...
0.58672446
0
Check that the time difference between the visual stimulus freezecommand being triggered and the visual stimulus effectively freezing on the screen is smaller than 150 ms.
def check_stimFreeze_delays(data, **_): metric = np.nan_to_num(data["stimFreeze_times"] - data["stimFreezeTrigger_times"], nan=np.inf) passed = (metric <= 0.15) & (metric > 0) assert data["intervals"].shape[0] == len(metric) == len(passed) return metric, passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkUiFreeze(self):\r\n\r\n motionCountBefore = core.FW_conf['blackbox'].getCountMotionFrames()\r\n\r\n # swipe a bit to see if it causes motion\r\n yCoordinate = int(self.phone.uiState.getScreenHeight()/1.5)\r\n self.phone._touch.drawLine((self.phone.uiState.getScreenWidth()-2, y...
[ "0.6285543", "0.6078267", "0.59383905", "0.58365345", "0.5743292", "0.57134765", "0.5674565", "0.5663597", "0.5644523", "0.5638384", "0.55540234", "0.5553151", "0.55458677", "0.5534003", "0.55099857", "0.5495784", "0.54823756", "0.54745513", "0.547419", "0.54643154", "0.54413...
0.6246702
1
Check that the reward volume is between 1.5 and 3 uL for correct trials, 0 for incorrect.
def check_reward_volumes(data, **_): metric = data['rewardVolume'] correct = data['correct'] passed = np.zeros_like(metric, dtype=bool) # Check correct trials within correct range passed[correct] = (1.5 <= metric[correct]) & (metric[correct] <= 3.) # Check incorrect trials are 0 passed[~corr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_reward_volume_set(data, **_):\n metric = data[\"rewardVolume\"]\n passed = 0 < len(set(metric)) <= 2 and 0. in metric\n return metric, passed", "def reward_threshold(self) -> Optional[float]:", "def acquisition_function_expected_volume_removal(\n gp_reward_model: BasicGPRewardModel,\n) ->...
[ "0.74345225", "0.6066089", "0.60463685", "0.5764846", "0.56886953", "0.56773823", "0.5655682", "0.557835", "0.557422", "0.5477881", "0.54463166", "0.5427771", "0.5410125", "0.5407789", "0.53777486", "0.5369534", "0.5368286", "0.53387535", "0.5324725", "0.5320856", "0.5311284"...
0.7724097
0