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
Evaluate or condition. Returns list of ages.
def resolve_condition(self, condition, dtype_key=None): if not condition: return self.ages elif condition.startswith('@AGE'): lo, hi = [int(a) for a in condition[5:-1].split('..')] return list(range(lo, hi+1)) elif condition.startswith('@YLD'): arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def animal_ages(self):\n herb_ages = []\n carn_ages = []\n for cell in self.land_cells.values():\n for herb in cell.herbivores:\n herb_ages.append(herb.age)\n for carn in cell.carnivores:\n carn_ages.append(carn.age)\n if not herb_ages...
[ "0.6060742", "0.57022697", "0.542271", "0.5421404", "0.5418673", "0.5235343", "0.52259606", "0.51494235", "0.51035005", "0.5013606", "0.49719635", "0.4963671", "0.49629402", "0.49459755", "0.4863029", "0.485231", "0.4851674", "0.4797446", "0.47605956", "0.47264624", "0.471895...
0.58466744
1
Imports TRANSITIONS section from a Forest model.
def import_transitions_section(self, filename_suffix='trn', mask_func=None, nthemes=None): nthemes = nthemes if nthemes else self.nthemes # local utility function #################################### def flush_transitions(acode, sources): if not acode: return # nothing to flush on fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_trans(self, fname):\n info = read_trans(fname)\n head_mri_trans = info['trans']\n self.set_trans(head_mri_trans)", "def import_model(file):\n file = os.path.expanduser(file)\n obj = IsolationForest()\n metadata = obj._cpp_obj.deserialize_obj(file)\n metad...
[ "0.53676784", "0.5281564", "0.51801884", "0.5052432", "0.50156265", "0.4887942", "0.48115516", "0.4765124", "0.47544178", "0.47514316", "0.4729882", "0.47235718", "0.4717336", "0.4686338", "0.46727479", "0.46714732", "0.46607983", "0.4659733", "0.46552992", "0.46516144", "0.4...
0.55575687
0
Imports OPTIMIZE section from a Forest model.
def import_optimize_section(self, filename_suffix='opt'): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def importOptimizer():\n module_path = os.path.join(path, \"optimization\")\n module_path = os.path.join(module_path, \"optimizer.py\")\n optimizer_class = importClass(\"Optimizer\", \"optimizer\", module_path)\n return optimizer_class", "def propose_optimize():\n pass", "def opt(args=None):\n ...
[ "0.5404466", "0.51572615", "0.4979792", "0.4952588", "0.4932208", "0.48700806", "0.4774907", "0.47736415", "0.47676384", "0.47644493", "0.47472405", "0.47320157", "0.47314382", "0.46865952", "0.46738452", "0.4661025", "0.46567672", "0.46370807", "0.46314874", "0.46305743", "0...
0.58376044
0
Imports SCHEDULE section from a Forest model.
def import_schedule_section(self, filename_suffix='seq', replace_commas=True, filename_prefix=None): filename_prefix = self.model_name if filename_prefix is None else filename_prefix schedule = [] n = self.nthemes with open('%s/%s.%s' % (self.model_path, filename_prefix, filename_suffix)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dynamic_import_scheduler(module):\n model_class = dynamic_import(module, SCHEDULER_DICT)\n assert issubclass(\n model_class, SchedulerInterface\n ), f\"{module} does not implement SchedulerInterface\"\n return model_class", "def _create_schedules(self):\n\n ''''''", "def load_sche...
[ "0.5821488", "0.54937524", "0.546136", "0.52250695", "0.51722974", "0.5131467", "0.5100007", "0.5018346", "0.4996085", "0.49801293", "0.4953004", "0.4934237", "0.49331635", "0.49311554", "0.49285278", "0.49178943", "0.4861656", "0.47977823", "0.47920322", "0.47803098", "0.474...
0.6421155
0
Imports CONTROL section from a Forest model.
def import_control_section(self, filename_suffix='run'): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadAdjustedModel(self):\r\n # Load model in GUI\r\n addModel(self.trcFilePath.replace('.trc','.osim'))", "def import_model(file):\n file = os.path.expanduser(file)\n obj = IsolationForest()\n metadata = obj._cpp_obj.deserialize_obj(file)\n metadata = json.loads(meta...
[ "0.5417595", "0.5234527", "0.5153335", "0.5077865", "0.50696856", "0.4877675", "0.48645094", "0.47992077", "0.47944608", "0.4767967", "0.47650477", "0.4716759", "0.4702605", "0.46917543", "0.46843314", "0.4679504", "0.46423692", "0.46179074", "0.46032137", "0.46022874", "0.45...
0.59828895
0
performs an asynchronous (nonblocking) request
def async_request(self, callback, *args): seq = self.send_request(*args) self.async_replies[seq] = callback
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def request(self) -> Any:\n raise NotImplementedError()", "async def do_request_async(\n self,\n version: str,\n action: str,\n protocol: str,\n method: str,\n pathname: str,\n request: dict,\n headers: Dict[str, str],\n runtime: util_mo...
[ "0.6878606", "0.6695856", "0.66759574", "0.6648927", "0.66422206", "0.6596879", "0.65182877", "0.6448629", "0.6408404", "0.6406751", "0.6387327", "0.60422945", "0.60215354", "0.6020072", "0.60137933", "0.60121167", "0.60068214", "0.60068214", "0.59893805", "0.59388447", "0.59...
0.68477684
1
serves a single request or reply (may block)
def serve(self): self.channel.wait() handler, seq, obj = self._recv() if handler == "result": self.dispatch_result(seq, obj) elif handler == "exception": self.dispatch_exception(seq, obj) else: self.dispatch_request(handler, seq, obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self):\n data = self.request.recv(1024)\n self.request.send(data)", "def serve(self, rq):\n # Call callback by key directly from socket\n request = rq['request']\n\n if request in self.callbacks :\n self.callbacks[request](rq)\n else :\n ...
[ "0.6422724", "0.6360835", "0.6360835", "0.6222002", "0.61481726", "0.61084306", "0.60891813", "0.5847095", "0.5812034", "0.58015573", "0.57482684", "0.5725463", "0.571976", "0.5706915", "0.56816524", "0.5675519", "0.56739676", "0.563241", "0.56114376", "0.5608814", "0.5597805...
0.68908423
0
Eventually call a command to get the value, if the value starts and ends with quotes "`".
def eventually_call_command(value): if value.startswith(u'`') and value.endswith(u'`'): cmd = value[1:-1] try: processed_value = subprocess.check_output(cmd, shell=True) except subprocess.CalledProcessError as e: raise ValueError(u'The call to the external tool failed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(command):\n if is_get(command) or is_delete(command):\n return None\n elif is_insert(command) or is_update(command):\n return command.split(\" \")[2]", "def cmd_get(self):\n return self.text", "def GetCommand(name, database):\n value = database.GetValue(name)\n if(val...
[ "0.71729803", "0.6247826", "0.62198967", "0.60586387", "0.6024551", "0.58804554", "0.5865844", "0.5795917", "0.5788303", "0.5788303", "0.57508636", "0.57508636", "0.57405114", "0.5692189", "0.5661306", "0.5661306", "0.5661306", "0.56568086", "0.55756986", "0.5568812", "0.5553...
0.7295391
0
get_originating_ray returns the ray (if any) which originated from this location
def get_originating_ray(self): return self._originating_ray
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ray(self):\n return self._ray", "def get_mouse_ray(self, context, event):\n region, rv3d = context.region, context.region_data\n coord = event.mouse_region_x, event.mouse_region_y\n ray_direction = view3d_utils.region_2d_to_vector_3d(region, rv3d, coord)\n ray_origin = view3d_u...
[ "0.70388234", "0.6458147", "0.6309068", "0.6209993", "0.61021036", "0.6026461", "0.602222", "0.6013943", "0.5986228", "0.59228706", "0.5916567", "0.5909179", "0.584077", "0.58291894", "0.5826403", "0.57874554", "0.5777603", "0.5774029", "0.5742175", "0.57238567", "0.57109827"...
0.8530597
0
set_originating_ray sets the set_originating_ray property
def set_originating_ray(self, ray): self._originating_ray = ray
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_originating_ray(self):\n return self._originating_ray", "def set_terminating_ray(self, location):\n self._terminating_ray = location", "def ray(self):\n return self._ray", "def point_on_ray(self, t=0.5):\n\n assert 0. <= t <=1., 't must be between 0 and 1'\n\n\n return ...
[ "0.72144455", "0.6681745", "0.6215104", "0.59327817", "0.5840927", "0.5840927", "0.5813904", "0.5761837", "0.56944907", "0.5666887", "0.558584", "0.5563734", "0.5508235", "0.5507894", "0.54436094", "0.53985435", "0.53907156", "0.5372683", "0.5319124", "0.5303428", "0.52745974...
0.81742865
0
get_terminating_ray returns the origin of any ray terminating at the square
def get_terminating_ray(self): return self._terminating_ray
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_originating_ray(self):\n return self._originating_ray", "def ray(self):\n return self._ray", "def shoot_ray(self, origin_row, origin_column):\n\n # get the the square object at row x column\n origin = self._board.get_board_square((origin_row, origin_column))\n\n # check t...
[ "0.7080093", "0.6689031", "0.60737425", "0.60132277", "0.59275526", "0.5894822", "0.58169794", "0.57478637", "0.5603203", "0.5527192", "0.5496069", "0.5477859", "0.5449312", "0.5435432", "0.5428692", "0.54256403", "0.5361024", "0.5361024", "0.5336261", "0.53320104", "0.526836...
0.8000595
0
set_terminating_ray Records that a ray terminates at the square
def set_terminating_ray(self, location): self._terminating_ray = location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_terminating_ray(self):\n return self._terminating_ray", "def set_originating_ray(self, ray):\n\n self._originating_ray = ray", "def shoot_ray(self, origin_row, origin_column):\n\n # get the the square object at row x column\n origin = self._board.get_board_square((origin_row...
[ "0.68550503", "0.6318925", "0.5794162", "0.55499816", "0.5506354", "0.5460057", "0.5423678", "0.53472203", "0.5330477", "0.53046733", "0.5260349", "0.52583677", "0.5219982", "0.5219982", "0.52059335", "0.516216", "0.5116987", "0.49663", "0.49073812", "0.48991486", "0.48910064...
0.8006345
0
is_edge returns whether or not the square is an "edge" of the board from which a ray can be shot
def is_edge(self): if self._row == 0 or self._row == 9 or self._column == 0 or self._column == 9: # check that the edge is not actually a corner square if not self.is_corner(): # If not a corner and in a border row return True return True return F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isEdge(self,x,y):\r\n return self.matr[x][y]", "def isEdge(self,x,y):\n\t\treturn self._matr[x][y]", "def _is_screen(grid):\n for e in range(grid.edges.shape[1]):\n if len([j for i in grid.element_edges for j in i if j == e]) < 2:\n return True\n return False", "def valid_r...
[ "0.6902393", "0.68805236", "0.6796221", "0.6682839", "0.6675429", "0.6651517", "0.66055274", "0.659563", "0.65838647", "0.65759474", "0.64784", "0.64487964", "0.64467686", "0.63029957", "0.6280272", "0.6263967", "0.62126255", "0.620655", "0.61989677", "0.61959946", "0.6169596...
0.74388653
0
set_atom sets the status of a square regarding containing an atom
def set_atom(self, status): self._atom = status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_atom(self, locant, atom):\n atom.set_id(locant)\n if locant >= self._next_locant:\n self._next_locant = locant + 1\n self._atom_index[locant] = atom\n self._graph.add_vertex(atom)", "def test_set_molecule(self):\n mol = Molecule.from_smiles(\"CCO\")\n ...
[ "0.6608052", "0.62169755", "0.61685354", "0.6105118", "0.5669361", "0.56532556", "0.5644982", "0.55664825", "0.5475031", "0.5475031", "0.5388777", "0.53863263", "0.5384021", "0.53201526", "0.53038645", "0.5299925", "0.5298742", "0.5284221", "0.52536845", "0.5223796", "0.52123...
0.793647
0
is_atom returns a Bool indicating whether or not a square contains an atom
def is_atom(self): return self._atom
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_equal_to_atom(self, atom):\n\n return (self.type == atom.type and self.shape == atom.shape\n and self.itemsize == atom.itemsize\n and np.all(self.dflt == atom.dflt))", "def is_atom_convex(self) -> bool:\n return False", "def is_atom_convex(self):\n ret...
[ "0.67377186", "0.6721572", "0.66839784", "0.6636997", "0.6563064", "0.6563064", "0.64563525", "0.6166441", "0.6157789", "0.6153469", "0.6111263", "0.61034507", "0.60968655", "0.6080108", "0.6048892", "0.59975153", "0.5886742", "0.5886742", "0.5864862", "0.58492863", "0.580039...
0.70451814
0
toggle_selected toggles the current value of a square's _selected property
def toggle_selected(self): self._selected = not self._selected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle_select(self):\r\n if not len(self.items):\r\n return\r\n item = self.items[self.item_sel]\r\n if item in self.selected:\r\n self.selected.remove(item)\r\n else:\r\n self.selected.append(item)\r\n self.do_paint()", "def set_selected(se...
[ "0.7148492", "0.68425924", "0.68048835", "0.6712426", "0.6623626", "0.6623626", "0.65721935", "0.65721935", "0.6571805", "0.6571805", "0.6488927", "0.6466025", "0.63619906", "0.6311746", "0.62811536", "0.6271514", "0.61098504", "0.60944426", "0.60868436", "0.60441846", "0.600...
0.7676974
0
Generate an assembled solid shaft using the BRepBuilderAPI_MakeSolid algorithm. This method requires PythonOCC to be installed.
def generate_solid(self): ext = os.path.splitext(self.filename)[1][1:] if ext == 'stl': shaft_compound = read_stl_file(self.filename) elif ext == 'iges': iges_reader = IGESControl_Reader() iges_reader.ReadFile(self.filename) iges_reader.TransferRoo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_schematic(self, bg=None):", "def storefront_generate():\n\n\tfrom pyrevit import script\n\n\ttol = 0.001\n\n\tversion = __revit__.Application.VersionNumber.ToString()\n\tuidoc = __revit__.ActiveUIDocument\n\tdoc = uidoc.Document\n\tcurrentView = uidoc.ActiveView\n\n\tstorefrontFull = []\n\tstorefrontPa...
[ "0.54307187", "0.5252917", "0.51901776", "0.5188057", "0.5141623", "0.5082265", "0.50431466", "0.5029711", "0.500106", "0.49995252", "0.49955285", "0.49915597", "0.49845573", "0.49811015", "0.49779114", "0.4976469", "0.4976198", "0.49730155", "0.49709055", "0.49465495", "0.49...
0.77718675
0
Representation of this atom
def __repr__(self): x, y, z = self.coord return f'Atom({self.label}, {x:.4f}, {y:.4f}, {z:.4f})'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return (\n f\"<Element: {self.name}, symbol: {self.symbol}, \"\n f\"atomic number: {self.atomic_number}, mass: {self.mass.to('amu')}>\"\n )", "def __repr__(self):\r\n return self.value", "def Atom(self):\n return \" \".join(\n m...
[ "0.71923965", "0.67156804", "0.6698402", "0.6670874", "0.65765846", "0.6566061", "0.6566061", "0.6562762", "0.65519303", "0.65519303", "0.65503716", "0.6529385", "0.6522417", "0.64952725", "0.64952725", "0.64952725", "0.64952725", "0.64952725", "0.64952725", "0.64952725", "0....
0.7215674
0
Atomic numbers are the position in the elements (indexed from zero),
def atomic_number(self) -> int: return elements.index(self.label) + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enumerate(self):\r\n return enumerate(self, 1)", "def atomic_number(self):\n return 0", "def ordered_indices(self):\r\n return np.arange(len(self), dtype=np.int64)", "def occ_indices(self):\n indices = []\n for index,item in enumerate(self):\n if item==1:\n ...
[ "0.62760454", "0.624858", "0.62365", "0.5993121", "0.594987", "0.5932413", "0.59269375", "0.58762074", "0.58713466", "0.5870463", "0.5869009", "0.5802339", "0.5802131", "0.5798909", "0.573835", "0.5724446", "0.56904936", "0.5667566", "0.5652006", "0.565055", "0.5638232", "0...
0.6941171
0
Row of transition metals that this element is in. Returns None if
def tm_row(self) -> Optional[int]: for row in [1, 2, 3]: if self.label in PeriodicTable.transition_metals(row): return row return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transition_entry(self):\n return self.container['transition_entry']", "def transition_metals(cls, row: int):\n if row < 1 or row > 3:\n raise ValueError('Not a valid row of TMs. Must be 1-3')\n\n tms = [elem for elem in cls.period(row+3) if elem in metals]\n return np.a...
[ "0.58004534", "0.56507796", "0.553028", "0.53191304", "0.52230406", "0.51441866", "0.51369417", "0.5100894", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486", "0.5064486"...
0.73572206
0
The maximum/maximal valance that this atom supports in any charge state (most commonly). i.e. for H the maximal_valance=1. Useful for generating molecular graphs
def maximal_valance(self) -> int: max_valances = {'H': 1, 'B': 4, 'C': 4, 'N': 4, 'O': 3, 'F': 1, 'Si': 4, 'P': 6, 'S': 6, 'Cl': 4, 'Br': 4, 'I': 6} if self.label in max_valances: return max_valances[self.label] else: logger.warning(f'Could not f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _maximum(self) -> float:\n if self._type == \"power\":\n return 5.0\n elif self._type == \"setpoint\":\n return self._product.get_data_config_json()[\"_value_setpoint_max\"]\n elif self._type == \"fan1\":\n fan = 1\n return self._product.get_data...
[ "0.7010324", "0.69215894", "0.6906343", "0.6823443", "0.6792038", "0.6761789", "0.6748865", "0.674552", "0.6688681", "0.6652332", "0.6634773", "0.65999526", "0.65732384", "0.65634406", "0.65634406", "0.65627587", "0.6547573", "0.6527057", "0.65153474", "0.64900184", "0.648273...
0.7687195
0
The atomic number is defined as 0 for a dummy atom
def atomic_number(self): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atomic_number(self) -> int:\n return self._particle.atomic_number", "def atomic_number(self):\n return atomic_number(self.sym)", "def atomic_number(self) -> int:\n return elements.index(self.label) + 1", "def test_counter_start_at_zero(self):\n pass", "def zero(self):\n ...
[ "0.6582689", "0.6415214", "0.6095549", "0.6028033", "0.60193104", "0.5994006", "0.5967346", "0.5927657", "0.5916504", "0.59052706", "0.5853979", "0.5835015", "0.5795136", "0.57549226", "0.57484525", "0.57377887", "0.5733872", "0.5692271", "0.5678179", "0.5675269", "0.5646824"...
0.7739366
0
Add another set of Atoms to this one. Can add None
def __add__(self, other): if other is None: return self return super().__add__(other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other: Any) -> None:\n self.add(item = other)\n return", "def _add(self, other):\n return None", "def __iadd__(self, other: Any) -> None:\n self.add(item = other)\n return", "def __iadd__(self, other):\n #print \"adding \", other, \" to \", self\n ...
[ "0.67929536", "0.6648605", "0.6514002", "0.64574236", "0.6380326", "0.63435996", "0.62108535", "0.6193311", "0.6193311", "0.6186544", "0.6138766", "0.61365926", "0.61365926", "0.6119194", "0.6116214", "0.6116214", "0.61114514", "0.61110467", "0.6110722", "0.60986125", "0.6095...
0.6816626
0
Copy these atoms, deeply
def copy(self) -> 'Atoms': return deepcopy(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):\n sc=copy.copy(self)\n sc.farms=list()\n for f in self.farms:\n sc.farms.append(f.clone(f.name, f.size))\n sc.airborne=list()\n for a in self.airborne:\n sc.airborne.append(a.clone(a.farma, a.farmb, a.distance))\n return sc", "def c...
[ "0.68190306", "0.6676668", "0.663552", "0.65544903", "0.6516988", "0.6474647", "0.64187294", "0.6404059", "0.6394203", "0.63364613", "0.63038737", "0.629617", "0.62892246", "0.61919016", "0.6178311", "0.6177163", "0.61667347", "0.61641395", "0.61563265", "0.6140553", "0.61298...
0.7524496
0
Remove all the dummy atoms from this list of atoms
def remove_dummy(self) -> None: for i, atom in enumerate(self): if isinstance(atom, DummyAtom): del self[i] return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_dummy_obj(self):\n for d in self.dummies:\n self.map.remove_node(d)\n\n self.dummies = []", "def clear(self):\n\n\t\tself.atomid = []\n\t\tself.resi = []\n\t\tself.resn = []\n\t\tself.atom = []\n\t\tself.element = []\n\t\tself.chain = []\n\t\tself.type = [...
[ "0.703683", "0.6677161", "0.6563313", "0.6513345", "0.6455647", "0.6352315", "0.63034874", "0.62717366", "0.6266092", "0.61597055", "0.6113306", "0.60784346", "0.6068542", "0.6011996", "0.6007793", "0.59902287", "0.5979001", "0.59623146", "0.59599376", "0.5959506", "0.5947881...
0.81387115
0
Vector from atom i to atom j
def vector(self, i: int, j: int) -> np.ndarray: return self[j].coord - self[i].coord
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column (self, i):\n return Vector(tuple(zip(*self._m))[i])", "def vec_swap_entries(x, i, j):\n xi = x[i]\n xj = x[j]\n x = x.at[i].set(xj)\n x = x.at[j].set(xi)\n return x", "def unit_vector(i, j):\n magnitude = np.sqrt(i ** 2 + j ** 2)\n unit_i = i / magnitude\n unit_j = j /...
[ "0.63833874", "0.6342188", "0.6334987", "0.63121414", "0.6104075", "0.6068359", "0.59780794", "0.596865", "0.57758844", "0.5768705", "0.57558364", "0.5744413", "0.5726418", "0.57253623", "0.57203126", "0.57136893", "0.56876564", "0.567846", "0.56744224", "0.56717384", "0.5657...
0.69054914
0
Normalised vector from atom i to atom j
def nvector(self, i: int, j: int) -> np.ndarray: vec = self.vector(i, j) return vec / np.linalg.norm(vec)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector(self,\n i: int,\n j: int) -> np.ndarray:\n return self[j].coord - self[i].coord", "def unit_vectors(x):\n xnew = x.copy()\n for v in range(x.shape[-1]):\n xnew[:, v] = x[:, v] / np.linalg.norm(x[:, v])\n return xnew", "def vectorize(self):\n ...
[ "0.676285", "0.6376572", "0.63570833", "0.618427", "0.61584485", "0.6132474", "0.5991627", "0.5951488", "0.59386784", "0.5891915", "0.5863619", "0.58608013", "0.5859907", "0.58586115", "0.58493614", "0.5848583", "0.5836466", "0.58242536", "0.58045954", "0.5796056", "0.5793173...
0.7287087
0
Set the coordinates from a numpy array
def coordinates(self, value: np.ndarray): if self.atoms is None: raise ValueError('Must have atoms set to be able to set the ' 'coordinates of them') if value.ndim == 1: assert value.shape == (3 * self.n_atoms,) value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_coords(self,coords):\n [self.x,self.y,self.w,self.h] = coords", "def set_coordinates(self, coordinates):\n self.coordinates = coordinates", "def position(self, array):\n self.app.position = array", "def setCoords(self, coords):\n\n self.coords = coords", "def set_coordin...
[ "0.66778135", "0.65497565", "0.6495149", "0.6449632", "0.6433435", "0.6237174", "0.62232316", "0.62203544", "0.6210939", "0.6182615", "0.6153114", "0.6081661", "0.6067157", "0.5929444", "0.59130067", "0.58707035", "0.5846341", "0.58391523", "0.5833851", "0.5807219", "0.579900...
0.6860435
0
Are a set of indexes present in the collection of atoms?
def _idxs_are_present(self, *args): return set(args).issubset(set(range(self.n_atoms)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_indexes(self):\n return set(k.index for k in self if k.has_index)", "def is_index(self, key):\n if key not in self:\n return False\n match = key.base.label if self[key].is_tensor else key\n for i in self.extract(key, readby=True):\n for e in retrieve_inde...
[ "0.6758198", "0.64317036", "0.6403109", "0.62320143", "0.62259275", "0.62044746", "0.61514366", "0.61498445", "0.61146784", "0.6067121", "0.59955674", "0.599491", "0.597619", "0.5956092", "0.5947549", "0.5915965", "0.5907899", "0.5900556", "0.5900536", "0.5868295", "0.5839369...
0.76043683
0
Collection of transition metals (TMs) of a defined row. e.g. row = 1 > [Sc, Ti .. Zn]
def transition_metals(cls, row: int): if row < 1 or row > 3: raise ValueError('Not a valid row of TMs. Must be 1-3') tms = [elem for elem in cls.period(row+3) if elem in metals] return np.array(tms, dtype=str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transitions(self):\n transitions = []\n for row in self.states:\n t_row = []\n for column in self.states:\n t_row.append([row, column])\n transitions.append(t_row)\n return sorted(transitions)", "def get_LT_TM_trafo(self, row):\r\n ...
[ "0.5867413", "0.5703003", "0.5661736", "0.5545012", "0.5463264", "0.5419989", "0.5371257", "0.5360374", "0.5352698", "0.5328747", "0.5320186", "0.52640486", "0.52626085", "0.52588475", "0.52345514", "0.51489663", "0.5132497", "0.51284224", "0.51244444", "0.5119824", "0.511689...
0.816652
0
Compute gammaln(x + n) gammaln(x) parametrized with sparse weights.
def sparse_gammaln_ratio(x, weights, deriv=0): if deriv == 0: func = gammaln elif deriv == 1: func = digamma else: raise NotImplementedError('Only derivatives up to first order supported') res = weights.tocoo(copy=True) x_row = x[res.row] res.data = func(x_row + res.col) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gammaln(F):\n def compute(value):\n \"\"\"Return log(gamma(value))\n \"\"\"\n if isinstance(value, Number):\n if sc is not None:\n return sc.gammaln(value, dtype='float32')\n else:\n raise ValueError('Numbers are not supported as input...
[ "0.69704896", "0.6161062", "0.5967751", "0.5953777", "0.5832879", "0.5832879", "0.58216053", "0.56906635", "0.5599893", "0.5586807", "0.55806977", "0.55253166", "0.55242586", "0.5510062", "0.54754394", "0.5469179", "0.5467045", "0.5421988", "0.54153705", "0.54094857", "0.5378...
0.69861484
0
Compute gammaln(x + n) gammaln(x) parametrized with dense weights.
def dense_gammaln_ratio(x, weights, deriv=0): if deriv == 0: func = gammaln elif deriv == 1: func = digamma else: raise NotImplementedError('Only derivatives up to first order supported') counts = np.where(weights)[0] weights = weights[counts] return func(x[:, None] + cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gammaln(F):\n def compute(value):\n \"\"\"Return log(gamma(value))\n \"\"\"\n if isinstance(value, Number):\n if sc is not None:\n return sc.gammaln(value, dtype='float32')\n else:\n raise ValueError('Numbers are not supported as input...
[ "0.6744548", "0.64799684", "0.6433885", "0.60788447", "0.60788447", "0.58692044", "0.5779788", "0.576733", "0.5762545", "0.57539815", "0.570463", "0.57031673", "0.5696955", "0.56921744", "0.5678826", "0.56709397", "0.5668334", "0.56638116", "0.56431335", "0.5636268", "0.55743...
0.68782336
0
Gradient of BetaBinomial likelihood
def beta_binomial_log_likelihood_grad( alpha, beta, positive_weights, negative_weights, total_weights ): res = np.empty((2, alpha.size)) res[0] = sparse_gammaln_ratio(alpha, positive_weights, deriv=1) res[1] = sparse_gammaln_ratio(beta, negative_weights, deriv=1) res -= dense_gammaln_rat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def L1_log_likelihood_gradient(X, y, B, lmbda):\n pass", "def b_gradient_descent(self, LB,UB,eta, tol,iter):\n bgd=[]\n bgd_x=[LB]\n iteration=0\n # current_pt=X\n first_derivative=sym.diff(self.gdfunc)\n #print(first_derivative)\n x=sym.Symbol('x')\n fi...
[ "0.7099036", "0.70112157", "0.6905523", "0.6782027", "0.6755098", "0.6708831", "0.6683291", "0.66521126", "0.6586814", "0.6552915", "0.65490675", "0.65065795", "0.64943236", "0.64518476", "0.6375408", "0.635544", "0.63421196", "0.6289401", "0.6288298", "0.6284241", "0.6269159...
0.74494475
0
Preprocess Isophonics dataset. Divide spectrogram features geenrated from self.DATA audio waveforms to n_frames frames long sequences and do the same with targets from self.CHORDS.
def get_preprocessed_dataset(self, hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500, from_song_ind = 0, to_song_ind = 225, separately = False) -> tuple: FEATURESs = [] CHORDs = self.CHORDS TIME_BINSs = [] KEYs = [] i = 0 separate_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_preprocessed_dataset(self, hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500, separately = True) -> tuple:\n FEATURESs = []\n CHORDs = self.CHORDS\n TIME_BINSs = []\n KEYs = []\n k = 0\n separate_data, separate_targets = [], [...
[ "0.71070224", "0.6801811", "0.6739187", "0.65712094", "0.6254738", "0.6168261", "0.6131628", "0.6108813", "0.60186857", "0.6003059", "0.58899826", "0.58670706", "0.5865005", "0.5857538", "0.5856312", "0.5856184", "0.5837776", "0.5775586", "0.5772172", "0.57537293", "0.5751030...
0.7159184
0
Preprocess audio waveform, shift pitches to C major key (and its modes ... dorian, phrygian, aiolian, lydian, ...) and generate mel and log spectrograms.
def preprocess_audio(waveform, sample_rate, spectrogram_generator, nfft, hop_length, norm_to_C=False, key='C') -> list: # Get number of half tones to transpose if norm_to_C: splited_key = key.split(":") if len(splited_key) == 1: mode_shift = 0 elif len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_sound(data, sample_rate):\n # Convert to mono.\n\n if len(data.shape) > 1:\n data = np.mean(data, axis=1)\n # Resample to the rate assumed by VGGish.\n if sample_rate != params.SAMPLE_RATE:\n data = resampy.resample(data, sample_rate, params.SAMPLE_RATE)\n\n # Compute log mel spectrogram ...
[ "0.59680957", "0.56942093", "0.5645592", "0.5597689", "0.5580645", "0.5568083", "0.547099", "0.54162973", "0.53967595", "0.53771096", "0.536462", "0.532954", "0.5315779", "0.5312413", "0.531233", "0.5310279", "0.5302535", "0.5268178", "0.52484316", "0.52299833", "0.52208", ...
0.6574922
0
Save preprocessed data from this dataset to destination path 'dest' by default as a .ds file.
def save_preprocessed_dataset(self, dest = "./Datasets/preprocessed_IsophonicsDataset.ds", hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500): # Serialize the dataset. with lzma.open(dest, "wb") as dataset_file: pickle.dump((self.get_preprocessed_datase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_preprocessed_dataset(self, dest = \"./Datasets/preprocessed_BillboardDataset.ds\", hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500):\n\n # Serialize the dataset.\n with lzma.open(dest, \"wb\") as dataset_file:\n pickle.dump((self.get_prepro...
[ "0.7253745", "0.69731134", "0.6148082", "0.6069065", "0.6069065", "0.60013837", "0.59501654", "0.5909846", "0.5879368", "0.58432066", "0.5813429", "0.58024454", "0.57516724", "0.5727757", "0.5674547", "0.5668671", "0.56280965", "0.5618494", "0.56055284", "0.56050515", "0.5602...
0.7255541
0
Load preprocessed data from this dataset from destination path 'dest'. Targets and preprocessed Data are stored by default as a .ds file.
def load_preprocessed_dataset(dest = "./Datasets/preprocessed_IsophonicsDataset.ds") -> tuple: with lzma.open(dest, "rb") as dataset_file: dataset = pickle.load(dataset_file) print("[INFO] The Preprocessed Isophonics Dataset was loaded successfully.") return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_preprocessed_dataset(dest = \"./Datasets/preprocessed_BillboardDataset.ds\") -> tuple:\n with lzma.open(dest, \"rb\") as dataset_file:\n dataset = pickle.load(dataset_file)\n\n print(\"[INFO] The Preprocessed Billboard Dataset was loaded successfully.\")\n return dataset", ...
[ "0.6824284", "0.58856475", "0.57128316", "0.5478641", "0.54210347", "0.5388152", "0.535845", "0.5352548", "0.53234315", "0.53091574", "0.52954763", "0.5244254", "0.5219277", "0.5217466", "0.52047336", "0.52032524", "0.51821834", "0.5165654", "0.5069236", "0.5052367", "0.50267...
0.6826887
0
Save data from this dataset to destination path 'dest' by default as a .ds file.
def save_dataset(self, dest = "./Datasets/IsophonicsDataset.ds"): # Serialize the dataset. with lzma.open(dest, "wb") as dataset_file: pickle.dump((self.DATA, self.CHORDS, self.KEYS, self.SAMPLE_RATE, self.NFFT), dataset_file) print("[INFO] The Isophonics Dataset was saved successfu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_preprocessed_dataset(self, dest = \"./Datasets/preprocessed_BillboardDataset.ds\", hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500):\n\n # Serialize the dataset.\n with lzma.open(dest, \"wb\") as dataset_file:\n pickle.dump((self.get_prepro...
[ "0.65199006", "0.6518348", "0.6477637", "0.64448494", "0.62957853", "0.624145", "0.60995364", "0.606863", "0.606863", "0.5972988", "0.59278774", "0.59069496", "0.5901777", "0.5900257", "0.58749866", "0.58707273", "0.58415663", "0.58133155", "0.580638", "0.57862854", "0.576453...
0.74923766
0
Load data from this dataset from destination path 'dest'. Targets and Data are stored by default as a .ds file.
def load_dataset(dest = "./Datasets/IsophonicsDataset.ds") -> 'IsophonicsDataset': with lzma.open(dest, "rb") as dataset_file: loaded_dataset = pickle.load(dataset_file) data, chords, keys, sample_rate, nfft = loaded_dataset dataset = IsophonicsDataset() dataset.DATA = da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_dest(self, destination_id):\n self.data_dest = destination_id", "def load_preprocessed_dataset(dest = \"./Datasets/preprocessed_BillboardDataset.ds\") -> tuple:\n with lzma.open(dest, \"rb\") as dataset_file:\n dataset = pickle.load(dataset_file)\n\n print(\"[INFO] Th...
[ "0.6298279", "0.59002584", "0.58586097", "0.5756639", "0.5521724", "0.5495812", "0.5417562", "0.53647274", "0.5361234", "0.5319349", "0.5307339", "0.52616847", "0.5215508", "0.52151924", "0.52069604", "0.51848274", "0.51626956", "0.51477534", "0.50910956", "0.5072241", "0.506...
0.6052309
1
Save preprocessed data from this dataset with its target and chord changes to destination path 'dest' by default as a .seg file.
def save_segmentation_samples(self, dest="./Datasets/IsophonicsSegmentation.seg", song_indices=[0, 10, 20, 30, 40, 50, 60, 70], hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500): data = [] chords = [] gold_targets = [] # Iterate over all song indic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_segmentation_samples(self, dest=\"./Datasets/BillboardSegmentation.seg\", song_indices=[0, 10, 20, 30, 40, 50, 60, 70], n_frames=500):\n data = []\n chords = []\n gold_targets = []\n # Iterate over all song indices on the input\n for song_ind in song_indices:\n\n ...
[ "0.6384866", "0.61252254", "0.5916129", "0.5916129", "0.58666384", "0.57704085", "0.5535232", "0.5203998", "0.520294", "0.51891756", "0.517986", "0.5152492", "0.5128308", "0.51202774", "0.5083056", "0.5080495", "0.5052492", "0.5013724", "0.4997064", "0.4974835", "0.4952844", ...
0.662115
0
Load preprocessed data and targets with its chord changes points from destination path 'dest'. This kind of data are stored by default as a .seg file.
def load_segmentation_samples(dest = "./Datasets/IsophonicsSegmentation.seg") -> tuple: with lzma.open(dest, "rb") as segmentation_samles: loaded_samples = pickle.load(segmentation_samles) print("[INFO] The Isophonics segmentation samples was loaded successfully.") return loaded_sam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_segmentation_samples(self, dest=\"./Datasets/IsophonicsSegmentation.seg\", song_indices=[0, 10, 20, 30, 40, 50, 60, 70], hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500):\n data = []\n chords = []\n gold_targets = []\n # Iterate over all...
[ "0.58333194", "0.5584685", "0.5496487", "0.54060304", "0.5267583", "0.5231401", "0.5177998", "0.5043666", "0.5037906", "0.50173223", "0.49955183", "0.487029", "0.48388383", "0.48084807", "0.47927123", "0.47824198", "0.47763547", "0.47656497", "0.47595406", "0.47592342", "0.47...
0.58597326
0
Preprocess Billboard dataset. Divide spectrogram features generated from self.DATA audio waveforms to n_frames frames long sequences and do the same with targets from self.CHORDS.
def get_preprocessed_dataset(self, hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500, separately = True) -> tuple: FEATURESs = [] CHORDs = self.CHORDS TIME_BINSs = [] KEYs = [] k = 0 separate_data, separate_targets = [], [] f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pack_features(data_type):\n workspace = config.workspace\n\n if data_type == 'train':\n snr = config.Tr_SNR\n elif data_type == 'test':\n snr = config.Te_SNR \n else:\n raise Exception(\"data_type must be train | test!\")\n \n n_concat = config.n_concat\n n_hop ...
[ "0.63426286", "0.61748374", "0.6103874", "0.6051883", "0.60413986", "0.59987134", "0.5998658", "0.5978574", "0.5947206", "0.59113634", "0.5909047", "0.5907793", "0.58308333", "0.5792267", "0.57871366", "0.57734436", "0.5728063", "0.5728063", "0.5728063", "0.5728063", "0.57280...
0.6498118
0
Save preprocessed data from this dataset to destination path 'dest' by default as a .ds file.
def save_preprocessed_dataset(self, dest = "./Datasets/preprocessed_BillboardDataset.ds", hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500): # Serialize the dataset. with lzma.open(dest, "wb") as dataset_file: pickle.dump((self.get_preprocessed_datase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_preprocessed_dataset(self, dest = \"./Datasets/preprocessed_IsophonicsDataset.ds\", hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500):\n # Serialize the dataset.\n with lzma.open(dest, \"wb\") as dataset_file:\n pickle.dump((self.get_preproc...
[ "0.7255541", "0.69731134", "0.6148082", "0.6069065", "0.6069065", "0.60013837", "0.59501654", "0.5909846", "0.5879368", "0.58432066", "0.5813429", "0.58024454", "0.57516724", "0.5727757", "0.5674547", "0.5668671", "0.56280965", "0.5618494", "0.56055284", "0.56050515", "0.5602...
0.7253745
1
Load preprocessed data from this dataset from destination path 'dest'. Targets and preprocessed Data are stored by default as a .ds file.
def load_preprocessed_dataset(dest = "./Datasets/preprocessed_BillboardDataset.ds") -> tuple: with lzma.open(dest, "rb") as dataset_file: dataset = pickle.load(dataset_file) print("[INFO] The Preprocessed Billboard Dataset was loaded successfully.") return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_preprocessed_dataset(dest = \"./Datasets/preprocessed_IsophonicsDataset.ds\") -> tuple:\n with lzma.open(dest, \"rb\") as dataset_file:\n dataset = pickle.load(dataset_file)\n\n print(\"[INFO] The Preprocessed Isophonics Dataset was loaded successfully.\")\n return dataset"...
[ "0.6826887", "0.58856475", "0.57128316", "0.5478641", "0.54210347", "0.5388152", "0.535845", "0.5352548", "0.53234315", "0.53091574", "0.52954763", "0.5244254", "0.5219277", "0.5217466", "0.52047336", "0.52032524", "0.51821834", "0.5165654", "0.5069236", "0.5052367", "0.50267...
0.6824284
1
Save preprocessed data from this dataset with its target and chord changes to destination path 'dest' by default as a .seg file.
def save_segmentation_samples(self, dest="./Datasets/BillboardSegmentation.seg", song_indices=[0, 10, 20, 30, 40, 50, 60, 70], n_frames=500): data = [] chords = [] gold_targets = [] # Iterate over all song indices on the input for song_ind in song_indices: # Convert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_segmentation_samples(self, dest=\"./Datasets/IsophonicsSegmentation.seg\", song_indices=[0, 10, 20, 30, 40, 50, 60, 70], hop_length=512, norm_to_C=False, spectrogram_generator=log_mel_spectrogram, n_frames=500):\n data = []\n chords = []\n gold_targets = []\n # Iterate over all...
[ "0.66217256", "0.6127549", "0.59157044", "0.59157044", "0.58669096", "0.57722545", "0.5535363", "0.52052116", "0.5201937", "0.5188658", "0.5179817", "0.5151367", "0.51264536", "0.51215047", "0.5082567", "0.5081099", "0.5051752", "0.50146383", "0.49966154", "0.4976991", "0.495...
0.6384916
1
This command will output a hello message.
async def hello(self): # << This is the actual command, or input # << Info await self.bot.say("Hi there!") # << This is the output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hello():\n return 'Hello I like to make AI Apps'", "def say_hello():\n return \"Hello World!\"", "async def hello(ctx):\n await ctx.send(\"Well, hello there.\")", "def say_hello():\n return \"Hello!\"", "def say_hello():\n return \"Hello!\"", "def hello():\r\n return 'Hello World!'"...
[ "0.73738515", "0.72814924", "0.72402346", "0.7214518", "0.7214518", "0.71621656", "0.7151204", "0.71488607", "0.7141472", "0.71225595", "0.7118884", "0.7036994", "0.70077825", "0.70077825", "0.70077825", "0.6989061", "0.6989061", "0.6980692", "0.694105", "0.69321775", "0.6917...
0.74102217
0
Normalizes html to remove expected differences between AsciiDoc's output and Asciidoctor's output.
def normalize_html(html): # Replace many whitespace characters with a single space in some elements # kind of like a browser does. soup = BeautifulSoup(html, 'lxml') for e in soup.select(':not(script,pre,code,style)'): for part in e: if isinstance(part, NavigableString): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm_html_from_html(html):\n if not isinstance(html, unicode):\n html = html.decode('utf-8')\n html = _markdown_email_link_re.sub(\n _markdown_email_link_sub, html)\n if sys.platform == \"win32\":\n html = html.replace('\\r\\n', '\\n')\n return html", "def normalised_html(htm...
[ "0.7226615", "0.70607543", "0.6773655", "0.66665196", "0.655038", "0.64958316", "0.6482322", "0.64780337", "0.63515466", "0.62745714", "0.62568706", "0.62412864", "0.6235375", "0.6201425", "0.61558855", "0.6124349", "0.6124169", "0.6072712", "0.6047778", "0.6038612", "0.60340...
0.7669794
0
Compare two html files, ignoring expected differences between AsciiDoc and Asciidoctor. The result is a generator for lines in the diff report. If it is entirely empty then there is no diff.
def html_file_diff(lhs, rhs): with open(lhs, encoding='utf-8') as lhs_file: lhs_text = lhs_file.read() with open(rhs, encoding='utf-8') as rhs_file: rhs_text = rhs_file.read() return html_diff(lhs, lhs_text, rhs, rhs_text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gen_diff_html(mock_diff):\n from_title = \"from_title_content\"\n from_lines = \"left content here\"\n to_title = \"to_title_content\"\n to_lines = \"different content on the right here\"\n mock_diff.return_value.make_table.return_value = \"<t>{} {}</t>\".format(\n from_lines, to_lin...
[ "0.6925306", "0.67688054", "0.6733134", "0.644781", "0.64447236", "0.6438787", "0.63714814", "0.62798643", "0.620622", "0.61791795", "0.616214", "0.61600137", "0.61223567", "0.6121083", "0.6105454", "0.5971382", "0.59469956", "0.58431786", "0.58206594", "0.58197254", "0.58146...
0.76265216
0
Based on a list of fields to fill, run inputs. Loop while the user has said they're not happy.
def accept_inputs(fields): user_is_not_happy = True while user_is_not_happy: # store the response provisionally until we know the user wants to keep it provisional_response_dict = {} for field in fields: provisional_response_dict[field] = str(raw_input("%s: " % field)) response = str(raw_input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_inputs(email_input, password_input, name, password):\n time.sleep(1)\n email_input.send_keys(name)\n time.sleep(1)\n password_input.send_keys(password)\n time.sleep(1)\n password_input.send_keys(Keys.ENTER)\n time.sleep(5)", "def get_inputs(list_labels, title):\n inputs = []\n ...
[ "0.60976857", "0.59905374", "0.5808559", "0.5802726", "0.5787118", "0.57736903", "0.57132685", "0.5672127", "0.55928314", "0.55848694", "0.55226654", "0.55198973", "0.5513339", "0.54929703", "0.5480566", "0.54691696", "0.53950393", "0.5387774", "0.5374328", "0.53631866", "0.5...
0.6741608
0
Show the tree of tasks top level function
def show_tasks(): top_level_tasks = query_with_results("select label, description from task where parent = ''", []) for task in top_level_tasks: _show_task(task)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _show_task(task, depth=0):\n indent = \" \"*depth\n # get people associated with this task\n people = query_with_results(\"select person.name from (person inner join task_person_pair on person.id = task_person_pair.person) where task_person_pair.task = ?\", [task[0]])\n people_string = \", \".join(map(lam...
[ "0.7044505", "0.67073137", "0.6536981", "0.64080375", "0.633106", "0.63079345", "0.6297647", "0.6233051", "0.62177956", "0.6172413", "0.613349", "0.6120806", "0.6114182", "0.60690165", "0.5977071", "0.5971409", "0.5947189", "0.5933019", "0.5930396", "0.58835137", "0.58541894"...
0.7472607
0
Show the tree of tasks recursive part
def _show_task(task, depth=0): indent = " "*depth # get people associated with this task people = query_with_results("select person.name from (person inner join task_person_pair on person.id = task_person_pair.person) where task_person_pair.task = ?", [task[0]]) people_string = ", ".join(map(lambda person : pe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tasks():\n top_level_tasks = query_with_results(\"select label, description from task where parent = ''\", [])\n for task in top_level_tasks:\n _show_task(task)", "def print_tree(self):\n\t\tprint(self.__print_tree('', True, ''))", "def print_tree(self):\n out = \"\"\n for i in rang...
[ "0.76383716", "0.69205135", "0.6789237", "0.6702529", "0.6687722", "0.660464", "0.6594061", "0.65522873", "0.6533424", "0.6528042", "0.6484721", "0.6475178", "0.6447434", "0.63996994", "0.63996965", "0.63838845", "0.6286321", "0.62779856", "0.6277855", "0.62693936", "0.625445...
0.7681245
0
Take the user through the procedure for adding a new task.
def add_task(): # get values from user responses = accept_inputs(["Task label", "Short task description", "Parent task label"]) # insert into db query_no_results("insert into task values(?, ?, ?)", [responses["Task label"], responses["Short task description"], responses["Parent task label"]]) print("New t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_task(self):\n task_title = self.display.ask_user_title()\n task_description = self.display.ask_user_description()\n task_due = self.display.ask_user_due()\n\n # Call the db function to add data\n self.db_link.add_task(task_title, task_description, task_due)\n self....
[ "0.8319998", "0.801765", "0.7859755", "0.78211033", "0.7652544", "0.74394053", "0.73149204", "0.7308537", "0.7295723", "0.7283501", "0.7275082", "0.7260795", "0.7260795", "0.7260795", "0.7260795", "0.7260658", "0.7243174", "0.7175701", "0.71754456", "0.7165377", "0.71570396",...
0.8676922
0
Take the user through the procedure for adding a new person.
def add_person(): # get values from user responses = accept_inputs(["Name"]) # insert into db query_no_results("insert into person (name) values(?)", [responses["Name"]]) print("New person created")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ui_add_new_person(self):\n person_id = int(input(\"ID: \"))\n person_name = input(\"Name: \").strip()\n person_phone_number = input(\"Phone number: \").strip()\n self.__person_service.service_add_person(person_id, person_name, person_phone_number)\n print(\"Person successfu...
[ "0.8266788", "0.7531729", "0.7427053", "0.7197951", "0.71685225", "0.70676327", "0.68244237", "0.68030035", "0.67906564", "0.6754829", "0.67105526", "0.6701279", "0.6699702", "0.6687814", "0.65530586", "0.6503334", "0.6475413", "0.6434299", "0.64241064", "0.6416769", "0.64026...
0.82465893
1
Take the user through the procedure for associating a person with a task.
def add_person_to_task(): # get values from user responses = accept_inputs(["Person", "Task label"]) # get the person's ID id = query_with_results("select id from person where name = ?", [responses["Person"]])[0][0] # insert into db query_no_results("insert into task_person_pair (person, task) values(?, ?)"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_task():\n # get values from user\n responses = accept_inputs([\"Task label\", \"Short task description\", \"Parent task label\"])\n # insert into db\n query_no_results(\"insert into task values(?, ?, ?)\",\n [responses[\"Task label\"], responses[\"Short task description\"], responses[\"Parent task l...
[ "0.6195056", "0.6187896", "0.61140096", "0.60363734", "0.5920606", "0.5895575", "0.587976", "0.5859144", "0.5848608", "0.583323", "0.58042115", "0.570696", "0.565306", "0.5646097", "0.5611895", "0.5539207", "0.55348647", "0.5513706", "0.55069244", "0.54870987", "0.54747903", ...
0.7814902
0
Take the user through the procedure for adding a task to a new parent task.
def add_task_to_task(): # get task label from user responses = accept_inputs(["Task label"]) child_label = responses["Task label"] # check for existence of task results = query_with_results("select * from task where label = ?", [child_label]) if len(results) == 0: print("No task found with label '%s' th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_task():\n # get values from user\n responses = accept_inputs([\"Task label\", \"Short task description\", \"Parent task label\"])\n # insert into db\n query_no_results(\"insert into task values(?, ?, ?)\",\n [responses[\"Task label\"], responses[\"Short task description\"], responses[\"Parent task l...
[ "0.7622146", "0.73781115", "0.72345597", "0.72043455", "0.6822807", "0.68113405", "0.6804074", "0.67634505", "0.6610751", "0.6555786", "0.65484196", "0.6514955", "0.65042365", "0.64841986", "0.6469457", "0.64347225", "0.64005804", "0.6384417", "0.6373623", "0.63465774", "0.63...
0.8647378
0
Take the user through the procedure for editing an existing task.
def edit_task(): # get task label from user responses = accept_inputs(["Task label"]) label = responses["Task label"] # check for existence of task results = query_with_results("select * from task where label = ?", [label]) if len(results) == 0: print("No task found with label '%s'." % label) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_task(self,tid, **kwargs):\n self.task_controller.edit(tid, **kwargs)", "def task_edit(request, pk):\n task_manager = TaskManager.objects.get(id=pk)\n task = task_manager.task\n if request.method == 'POST':\n \ttask_form = TaskForm(request.POST)\n \ttask_owner = request.user\n\n ...
[ "0.78095317", "0.77057576", "0.7560475", "0.7467295", "0.7326083", "0.72747135", "0.72349364", "0.7225282", "0.71876585", "0.71502537", "0.71157575", "0.7073465", "0.7037808", "0.6973069", "0.68761957", "0.68530136", "0.68360823", "0.68323207", "0.6821583", "0.6811447", "0.67...
0.8179092
0
Take the user through the procedure for editing an existing person.
def edit_person(): # get person name from user responses = accept_inputs(["Person's name"]) person_name = responses["Person's name"] # check for existence results = query_with_results("select * from person where name = ?", [person_name]) if len(results) == 0: print("No person found with name '%s'." % pe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_person(self, pk):", "def edit_person(self, treeview):\n model, iter_ = treeview.get_selection().get_selected()\n if iter_:\n handle = model.get_value(iter_, 0)\n try:\n person = self.dbstate.db.get_person_from_handle(handle)\n EditPerson(...
[ "0.7943012", "0.72333646", "0.7216424", "0.71270156", "0.6986396", "0.69486916", "0.68581593", "0.6826911", "0.6771125", "0.66811764", "0.65121484", "0.64661336", "0.6465752", "0.6440391", "0.638555", "0.6360115", "0.6320146", "0.63127846", "0.6290187", "0.62846655", "0.62787...
0.819586
0
Take the user through the procedure for removing a person.
def rm_person(): # get person name from user responses = accept_inputs(["Person name"]) person_name = responses["Person name"] # check for existence of person results = query_with_results("select id from person where name = ?", [person_name]) if len(results) == 0: print("No person found with name '%s' t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ui_remove_person(self):\n remove_person_id = int(input(\"Introduce the ID of the person you want to remove: \"))\n self.__person_service.service_remove_person(remove_person_id)\n print(\"Person successfully removed from your agenda!\\n\")", "def remove_person(self, document):\n del ...
[ "0.8078172", "0.7589216", "0.75408614", "0.7425795", "0.7279483", "0.71644247", "0.703097", "0.6840079", "0.68369186", "0.67468375", "0.6678084", "0.66488206", "0.66407055", "0.66148627", "0.65929705", "0.6590128", "0.65798676", "0.65356463", "0.65118", "0.6503782", "0.649910...
0.8214719
0
Take the user through the procedure for removing a person from a task.
def rm_person_from_task(): # get person name from user responses = accept_inputs(["Person name", "Task label"]) person_name = responses["Person name"] task_label = responses["Task label"] # check for existence of person person_results = query_with_results("select id from person where name = ?", [person_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rm_person():\n # get person name from user\n responses = accept_inputs([\"Person name\"])\n person_name = responses[\"Person name\"]\n # check for existence of person\n results = query_with_results(\"select id from person where name = ?\", [person_name])\n if len(results) == 0:\n print(\"No person fou...
[ "0.7877371", "0.76952815", "0.7494064", "0.7449308", "0.72214806", "0.6816996", "0.67832255", "0.67647344", "0.67566645", "0.6668571", "0.6655145", "0.6628239", "0.66275203", "0.65977645", "0.65602624", "0.6485847", "0.64714295", "0.64595115", "0.6443125", "0.64181465", "0.64...
0.8485624
0
Take the user through the procedure for removing a task from a parent task.
def rm_task_from_parent(): # get task label from user responses = accept_inputs(["Task label"]) label = responses["Task label"] # check for existence of task results = query_with_results("select * from task where label = ?", [label]) if len(results) == 0: print("No task found with label '%s' that we cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, task):\n pass", "def rm_task():\n # get task label from user\n responses = accept_inputs([\"Task label\"])\n label = responses[\"Task label\"]\n # check for existence of task\n results = query_with_results(\"select * from task where label = ?\", [label])\n if len(results) == 0:\n ...
[ "0.75242907", "0.7326703", "0.71698153", "0.707003", "0.70365524", "0.6742434", "0.67036813", "0.6678068", "0.6621496", "0.6597808", "0.6551793", "0.6544614", "0.64777744", "0.6443047", "0.64320797", "0.63818425", "0.6377859", "0.6310897", "0.6263072", "0.6259707", "0.6238845...
0.8250877
0
Helper function that fills in the missing learning parameters with default values, or with values that can be inferred from the variable `params`.
def fill_learner_params(params, inputs, targets, num_question_features=None, num_word_features=None): params_learn = params.learning if params_learn['model'] == RidgeWithLearnedAttention: params_learn['model_params']['num_outputs'] = [targets.shape[-1]] params_learn['mode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_params(self, params: Dict):\n\n if params['training_instances'] is not None:\n self.training_instances = params['training_instances']\n if params['n'] is not None:\n self.n = params['n']\n if params['lda'] is not None:\n self.lda = params['lda']\n ...
[ "0.6779191", "0.6508687", "0.632793", "0.6317856", "0.629677", "0.62886745", "0.6260974", "0.61868584", "0.61868584", "0.61695766", "0.6152758", "0.613024", "0.61279434", "0.6124757", "0.61204916", "0.6080499", "0.60776216", "0.606382", "0.6059168", "0.6048119", "0.59922236",...
0.68929183
0
Creates the crossvalidation data iterators. This takes into account if we are considering zeroshot setting for the words, questions or both, as specified by the experimental configuration in `params_learn`.
def create_iterators(params_learn, groups): word_ids = [w_q // 100 for w_q in groups] question_ids = [w_q % 100 for w_q in groups] num_words = len(set(word_ids)) num_questions = len(set(question_ids)) max_test_folds = params_learn.max_folds_test max_val_folds = params_learn.max_folds_param_valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_training_cross_validation(self) -> None:\n\n cfg = self.cfg_\n fit_kwargs = {'classes': list(self.data_.classes)}\n\n # Store all of the samples used during cross-validation\n self.y_training_set_all_ = list(self._generate_samples(self.train_ids_, 'y'))\n\n # Initialize l...
[ "0.63408995", "0.60224944", "0.59057134", "0.57457143", "0.57344276", "0.566754", "0.56633264", "0.5627756", "0.5601218", "0.5573879", "0.55418", "0.55258447", "0.5517589", "0.55092084", "0.5499536", "0.5483761", "0.547162", "0.5470456", "0.54574335", "0.5450169", "0.54460293...
0.6990317
0
Returns the name of the regularization parameters that we can tune.
def get_reg_params_name(params_learn): if params_learn['model'] == RidgeWithLearnedAttention: return 'reg_weights' elif params_learn['model'] in [regression.RidgeRegression, regression.LassoRegression]: return 'alpha' else: raise ValueError('Need to add here the regularization parame...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regularizer(self):\n \n # L2 regularization for the fully connected parameters.\n regularizers = (tf.nn.l2_loss(self.weights.wd1) + tf.nn.l2_loss(self.weights.bd1) + \n tf.nn.l2_loss(self.weights.wout) + tf.nn.l2_loss(self.weights.bout))\n return regularizers", "def get_model_p...
[ "0.635505", "0.6117179", "0.6112876", "0.6041491", "0.6035673", "0.59710723", "0.57392466", "0.57269883", "0.56935847", "0.56679744", "0.56551343", "0.5604737", "0.55875355", "0.55712897", "0.5556321", "0.55450284", "0.55325896", "0.5515889", "0.5511926", "0.55099237", "0.549...
0.7128665
0
Returns a set, giving the names of all leaves dominated by the given node.
def leaves(self): if self.keys(): return set().union(*[child.leaves() for child in self.itervalues()]) else: return set(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_leaves(self, node):\n if node not in self.nodes:\n raise PhyloValueError(\"Error: cannot get the leaves of an invalid node.\")\n if node in self.leaves:\n return set(node)\n children = set()\n for leaf in self.leaves:\n if node in self.paths...
[ "0.79526937", "0.7120343", "0.70375556", "0.6737785", "0.6730213", "0.66002625", "0.65471", "0.649664", "0.6376191", "0.6318902", "0.6317719", "0.62571555", "0.62052137", "0.6170512", "0.6165539", "0.61270416", "0.6116429", "0.61066914", "0.6067511", "0.6033919", "0.59639233"...
0.71470517
1
REQUIRES INTERNET CONNECTION !!!! (takes ~3mins with 1.8 MB/s) Downloads the language families and its children from and return it as a defaultdict(list).
def get_language_families(): from bs4 import BeautifulSoup as bs # If ethnologue language family html doesn't exist yet, download it. if not os.path.exists(ETHNO_DIR+'ethnologue-family.html'): fin = urllib2.urlopen(ETHNOLOGUE_DOMAIN+'browse/families')\ .read().decode('utf8') with codecs.open(ETH...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_language_families():\n # If languagefamilies.pk is not available, create it. \n if not os.path.exists(ETHNO_DIR+'languagefamilies.pk'):\n lfs = get_language_families()\n with codecs.open(ETHNO_DIR+'languagefamilies.pk','wb') as fout:\n pickle.dump(lfs, fout)\n # Loads the pickled file.\n wi...
[ "0.5851442", "0.57274973", "0.53564304", "0.5340155", "0.53106093", "0.52680093", "0.5239337", "0.52391064", "0.5221709", "0.5221163", "0.51987284", "0.51748794", "0.5168338", "0.51478034", "0.5147424", "0.5141555", "0.5134665", "0.5130542", "0.51050496", "0.509857", "0.50954...
0.6663061
0
Loads languagefamilies.pk and return it as a defaultdict(list).
def load_language_families(): # If languagefamilies.pk is not available, create it. if not os.path.exists(ETHNO_DIR+'languagefamilies.pk'): lfs = get_language_families() with codecs.open(ETHNO_DIR+'languagefamilies.pk','wb') as fout: pickle.dump(lfs, fout) # Loads the pickled file. with codecs.op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_families():\n from bs4 import BeautifulSoup as bs\n # If ethnologue language family html doesn't exist yet, download it.\n if not os.path.exists(ETHNO_DIR+'ethnologue-family.html'):\n fin = urllib2.urlopen(ETHNOLOGUE_DOMAIN+'browse/families')\\\n .read().decode('utf8')\n with cod...
[ "0.6595342", "0.565553", "0.56195384", "0.5600289", "0.5528234", "0.55024004", "0.5436394", "0.5417258", "0.53780496", "0.5344372", "0.53390366", "0.5297017", "0.52787334", "0.52525634", "0.52518684", "0.51703703", "0.5162035", "0.51201075", "0.5094637", "0.50869346", "0.5061...
0.78197306
0
test name exists in amenity instance
def test_name(self): inst = Amenity() self.assertTrue(hasattr(inst, "name")) self.assertEqual(inst.name, "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_name(self):\n insta = Amenity()\n self.assertTrue(hasattr(insta, \"name\"))\n self.assertEqual(insta.name, \"\")", "def test_attribute(self):\n\n new_jawn = Amenity()\n self.assertTrue(\"name\" in new_jawn.__dir__())", "def match(self):\n return 'test' in self...
[ "0.73733836", "0.6923786", "0.6681495", "0.65908104", "0.6483639", "0.64187825", "0.64127475", "0.64077127", "0.6341556", "0.6320183", "0.62570906", "0.6241113", "0.6209472", "0.61943656", "0.61763567", "0.61737466", "0.616262", "0.6105605", "0.60819215", "0.6076928", "0.6076...
0.7295459
1
Aquest metode retorna la matricula del cotxe
def getMatricula(self): return self._l[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMatrix(self) -> CMatrix4:\n ...", "def infoCotxeMatricula(matricula):\n if(_formatMatriculaValid(matricula)):\n con = lite.connect('parking.db')\n cur = con.cursor()\n try:\n cur.execute(\"SELECT * FROM cotxes WHERE id_cotxe=?;\",(matricula,))\n row = c...
[ "0.647282", "0.61792886", "0.613752", "0.61085063", "0.59816015", "0.59033704", "0.5870238", "0.5850609", "0.5846507", "0.5786833", "0.5737841", "0.5715838", "0.5714534", "0.57038313", "0.5700745", "0.5663389", "0.56623095", "0.5658171", "0.56527686", "0.5648715", "0.5618702"...
0.66449493
0
Aquest metode retorna la informacio sobre el motor del cotxe
def getMotor(self): return self._l[3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comando_informacao(self):\r\n return self.informacoes_ultima_nfce()", "def info(self):", "def info(self):", "def get_motor_position(self):\n print(\"voici la position du moteur\")", "def info(self):\n self.update_info()\n print('Number of electrodes: ' + str(self.n_elecs))\n...
[ "0.6118693", "0.6048672", "0.6048672", "0.6001387", "0.5977882", "0.5973108", "0.5926582", "0.5907006", "0.5824608", "0.58178777", "0.58152205", "0.5814742", "0.58122146", "0.5784579", "0.5784579", "0.5784579", "0.5784579", "0.5784579", "0.5784579", "0.5761271", "0.5761271", ...
0.6139061
0
store user's input in a list, by entering order, until the user logs a string that matches the stopper string.
def create_list(): input_list = [] input_from_user = input() while input_from_user != STOPPER_STRING: input_list.append(input_from_user) input_from_user = input() return input_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of(name_of_thing = \"thing\"):\n\n result_list = []\n\n item = input(\"Enter %s: \" % name_of_thing)\n\n while item != \"\":\n result_list.append(item)\n item = input(\"Enter another %s: \" % name_of_thing)\n\n return result_list", "def make_list():\n user_input = [0, 0,...
[ "0.647574", "0.6381833", "0.6233213", "0.59272236", "0.5913572", "0.58673495", "0.5732587", "0.56603175", "0.56477326", "0.5595033", "0.55807036", "0.55604726", "0.5533617", "0.551351", "0.54906994", "0.5484849", "0.54713345", "0.5454574", "0.54517484", "0.5446345", "0.537929...
0.76496786
0
concatenate the string's in the given list, and returns the outcome.
def concat_list(str_lst): concatenation = '' if len(str_lst) != 0: for string in str_lst: concatenation = concatenation + string return concatenation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat_strings(l_strings):\n if l_strings == []:\n return \"\"\n else: \n return l_strings[0] + \" \" + concat_strings(l_strings[1:])", "def brcadd(*args):\n \n #Find the list use a mask list.\n bargs=[isinstance(i,list) for i in args]\n \n #If all the elements are strings, ju...
[ "0.7216159", "0.6816362", "0.67876273", "0.67103904", "0.66851467", "0.6569269", "0.65227413", "0.6456808", "0.64212155", "0.6402938", "0.6359079", "0.6316838", "0.6306734", "0.61430025", "0.61308765", "0.611649", "0.60747725", "0.60667586", "0.6051911", "0.5993869", "0.59896...
0.7505594
0
sums all nums in the given list and returns their average in floating point (automatic on python 3), or None if the list is empty.
def average(num_list): nums_average = None nums_sum = 0 if len(num_list) != 0: for num in num_list: nums_sum = nums_sum + num nums_average = nums_sum / len(num_list) # average formula return nums_average
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean(lst):\n if len(lst) == 0:\n return None\n else:\n return float(sum(lst)) / len(lst)", "def average(l: List[float]) -> float:\n n = len(l)\n if n == 0:\n return 0\n return sum(l) / n", "def avg(lst: list):\n return sum(lst) / len(lst)", "def avg(list):\n ...
[ "0.8146937", "0.7942896", "0.773932", "0.77236325", "0.7709891", "0.76922756", "0.76788384", "0.76459634", "0.76405627", "0.75916183", "0.75477797", "0.7547326", "0.7471042", "0.7460745", "0.7456209", "0.7401513", "0.7401358", "0.7380244", "0.7363007", "0.73581374", "0.734070...
0.82661366
0
Open a url page in Splash, by sending a post request to your local running Splash service. If you are using Crawlera, you can reuse the current session, by setting the reuse_session flag to True. This method is intended to provide flexibility in link following, after the initial http_connection has been made with start...
def open(self, url, splash_args:dict=None, reuse_session=False, *args, **kwargs): timeout = kwargs.pop('timeout', self.http_session_timeout) if reuse_session: self._reuse_crawlera_session() if splash_args: self.splash_args = splash_args return self._stateful_po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _stateful_post(self, url, *args, **kwargs):\n timeout = kwargs.pop('timeout', self.http_session_timeout)\n keyword = kwargs.pop('keyword', None)\n splash_args = kwargs.pop('splash_args', self.splash_args)\n\n if not splash_args:\n self.splash_args = {\n 'lu...
[ "0.6871362", "0.57257164", "0.5681307", "0.56645125", "0.56468403", "0.56411433", "0.5610097", "0.5546779", "0.552779", "0.5497994", "0.5474397", "0.546589", "0.54652876", "0.54589224", "0.5407964", "0.5378824", "0.5363643", "0.5359008", "0.53581333", "0.5352008", "0.5324981"...
0.7982018
0
Execute sending the post request to the local running Splash service with our self.browser object.
def _stateful_post(self, url, *args, **kwargs): timeout = kwargs.pop('timeout', self.http_session_timeout) keyword = kwargs.pop('keyword', None) splash_args = kwargs.pop('splash_args', self.splash_args) if not splash_args: self.splash_args = { 'lua_source': s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit(self):\n url = self.__moss.send()\n\n self.home_url = url\n self.moss_results = self.__extract_info()", "def post(self):\n code, status = run_handlers.handle_data_post(self.request.headers, self.request.body)\n self.set_status(code)\n self.write(status)\n ...
[ "0.60861814", "0.60453665", "0.59208494", "0.5911187", "0.5741792", "0.5671413", "0.5552731", "0.5540543", "0.55233026", "0.55233026", "0.5494326", "0.5492917", "0.5473774", "0.5470735", "0.54404855", "0.54082626", "0.53971565", "0.5392622", "0.5344292", "0.53373486", "0.5307...
0.6518347
0
This is the crawlera session id which is returned by XCrawleraSession. Reusing the same crawlera session during the lifetime of this object may be useful, depending on your need.
def session_id(self): return self.browser.crawlera_session
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_id(self) -> str:\n return self._session_id", "def getSessionId(self):\n return self.sessionid", "def get_session_id(self):\n raise NotImplementedError()", "def get_session_id(self):\n return self.request_data['id']", "def getSessionId(self) -> int:\n return se...
[ "0.782119", "0.7630992", "0.7615945", "0.75861216", "0.72639245", "0.7248221", "0.6786882", "0.678265", "0.6763565", "0.672225", "0.6709095", "0.6673809", "0.6530494", "0.6527707", "0.6376892", "0.6314992", "0.62261325", "0.62242943", "0.62242943", "0.62242943", "0.62242943",...
0.8870526
0
Update the self.splash_json['session_id'] to the current session_id so that the current session will be extended with an self.open() request.
def _reuse_crawlera_session(self): self.splash_args['session_id'] = self.session_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_login_session(self, session_id=None):\r\n meta = self.get_meta()\r\n old_login = meta.get('session_id', None)\r\n if old_login:\r\n SessionStore(session_key=old_login).delete()\r\n meta['session_id'] = session_id\r\n self.set_meta(meta)\r\n self.save()",...
[ "0.53245854", "0.51046336", "0.50939554", "0.50076723", "0.49865118", "0.4974878", "0.49699277", "0.49648398", "0.496462", "0.49480373", "0.4924403", "0.4824135", "0.4814709", "0.48123083", "0.47847873", "0.47725746", "0.47625887", "0.4761439", "0.47604", "0.47552183", "0.469...
0.6295524
0
Sample nonIID client data from EMNIST dataset > FEMNIST
def femnist_star(dataset, num_users): print("Sampling dataset: FEMNIST*") dict_users = {i: [] for i in range(num_users)} total_len = len(dataset) labels = dataset.targets.numpy() idxs = np.argsort(labels) num_shards, num_imgs = 26 * num_users, total_len // (num_users * 26) label_selected ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_for_day(i,t0):\n t0 = UTCDateTime(t0)\n\n # open clients\n client = FDSNClient(\"GEONET\")\n client_nrt = FDSNClient('https://service-nrt.geonet.org.nz')\n \n daysec = 24*3600\n data_streams = [[2, 5], [4.5, 8], [8,16]]\n names = ['rsam','mf','hf']\n\n # download data\n d...
[ "0.5961029", "0.5843225", "0.56314903", "0.5612883", "0.5584505", "0.55610037", "0.5516918", "0.5504353", "0.5487736", "0.5423251", "0.53731495", "0.5357363", "0.5347949", "0.53471863", "0.5333448", "0.5322383", "0.52841866", "0.52840406", "0.5280769", "0.52681524", "0.526413...
0.62063557
0
Sample IID client data from CIFAR10 dataset
def cifar_iid(dataset, num_users): print("Sampling dataset: CIFAR-10 IID") num_items = int(len(dataset)/num_users) dict_users, all_idxs = {}, [i for i in range(len(dataset))] for i in range(num_users): dict_users[i] = set(np.random.choice(all_idxs, num_items, replace=False)) all_idxs = l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cifar_100_iid(dataset, num_users):\n print(\"Sampling dataset: CIFAR-100 IID\")\n num_items = int(len(dataset) / num_users)\n dict_users, all_idxs = {}, [i for i in range(len(dataset))]\n for i in range(num_users):\n dict_users[i] = set(np.random.choice(all_idxs, num_items, replace=False))\n...
[ "0.6428766", "0.6320033", "0.60457593", "0.57582295", "0.56375945", "0.5631267", "0.5606833", "0.55002564", "0.5445942", "0.53908944", "0.5315546", "0.53005326", "0.5263506", "0.5242838", "0.5223147", "0.5203237", "0.5188594", "0.51409876", "0.5115105", "0.5088381", "0.507770...
0.66765887
0
Sample nonIID client data from CIFAR10 dataset
def cifar_noniid_2(dataset, num_users): print("Sampling dataset: CIFAR-10 non-IID") dict_users = {i: np.array([], dtype='int64') for i in range(num_users)} total_len = len(dataset) num_shards, num_imgs = 2 * num_users, 25000 // num_users idx_shard = [i for i in range(num_shards)] idxs = np.arang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cifar_100_noniid(dataset, num_users):\n print(\"Sampling dataset: CIFAR-100 non-IID\")\n dict_users = {i: np.array([], dtype='int64') for i in range(num_users)}\n total_len = len(dataset)\n num_shards, num_imgs = 20 * num_users, total_len // (num_users * 20)\n\n labels = np.array(dataset.targets...
[ "0.63893026", "0.6215872", "0.60061324", "0.58459747", "0.56864333", "0.5542326", "0.5471752", "0.5424367", "0.541453", "0.53827065", "0.53823", "0.5354801", "0.5313292", "0.53005713", "0.5299799", "0.5298462", "0.52650374", "0.5264867", "0.5226781", "0.51943004", "0.51905197...
0.65762454
0
Sample nonIID client data from CIFAR100 dataset
def cifar_100_noniid(dataset, num_users): print("Sampling dataset: CIFAR-100 non-IID") dict_users = {i: np.array([], dtype='int64') for i in range(num_users)} total_len = len(dataset) num_shards, num_imgs = 20 * num_users, total_len // (num_users * 20) labels = np.array(dataset.targets) idxs = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cifar_noniid_2(dataset, num_users):\n print(\"Sampling dataset: CIFAR-10 non-IID\")\n dict_users = {i: np.array([], dtype='int64') for i in range(num_users)}\n total_len = len(dataset)\n num_shards, num_imgs = 2 * num_users, 25000 // num_users\n idx_shard = [i for i in range(num_shards)]\n id...
[ "0.6594425", "0.6310372", "0.6265065", "0.57760644", "0.565237", "0.55359393", "0.54047656", "0.54047596", "0.53467506", "0.53377044", "0.53188276", "0.531487", "0.52954453", "0.5281499", "0.52790797", "0.5271782", "0.5252955", "0.5249932", "0.5246562", "0.5181673", "0.516823...
0.663355
0
Sample IID client data from CIFAR100 dataset
def cifar_100_iid(dataset, num_users): print("Sampling dataset: CIFAR-100 IID") num_items = int(len(dataset) / num_users) dict_users, all_idxs = {}, [i for i in range(len(dataset))] for i in range(num_users): dict_users[i] = set(np.random.choice(all_idxs, num_items, replace=False)) all_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cifar_iid(dataset, num_users):\n print(\"Sampling dataset: CIFAR-10 IID\")\n num_items = int(len(dataset)/num_users)\n dict_users, all_idxs = {}, [i for i in range(len(dataset))]\n for i in range(num_users):\n dict_users[i] = set(np.random.choice(all_idxs, num_items, replace=False))\n ...
[ "0.6590248", "0.6221375", "0.6180533", "0.5706651", "0.5672003", "0.5604251", "0.5493395", "0.54040474", "0.53446835", "0.5301898", "0.52754885", "0.52348894", "0.52049655", "0.51795393", "0.51615316", "0.5134596", "0.5110959", "0.51078814", "0.50323033", "0.5011086", "0.4991...
0.6608405
0
pred_classif and gt_classif must be aligned
def validate(pred_classif, gt_classif, pred_nan=-1, gt_nan=-1, add_to_gtr=10000): gt_valid = np.logical_not(gt_classif == gt_nan) pred_valid = np.logical_not(pred_classif == pred_nan) valids = np.where(np.logical_and(gt_valid, pred_valid)) # make sure the labels of gt_classif and pred_classif are diffe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, pred_texture, gt_texture):\n pred_class = self.classifier.predict(pred_texture)\n gt_class = self.classifier.predict(gt_texture)\n if pred_class == gt_class:\n return 0\n else:\n return 1", "def mAP(pred_bboxes,\n pred_classes,\n ...
[ "0.6424507", "0.6372673", "0.6015859", "0.6013839", "0.59993905", "0.5982796", "0.5953727", "0.59494436", "0.5941758", "0.59316885", "0.5902158", "0.58941257", "0.5871876", "0.5861716", "0.5855205", "0.58523846", "0.5851852", "0.58448064", "0.5843607", "0.58428204", "0.582735...
0.65242887
0
Draw the GUI into the offscreen texture
def draw_offscreen(context): offscreen = SprytileGui.offscreen target_img = SprytileGui.texture_grid tex_size = SprytileGui.tex_size offscreen.bind() glClear(GL_COLOR_BUFFER_BIT) glDisable(GL_DEPTH_TEST) glEnable(GL_BLEND) glMatrixMode(GL_PROJECTION) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n self.screen.blit(self.image, self.rect)", "def draw(self, screen):", "def draw(self):\r\n self.screen.blit(self.image, self.image.get_rect())", "def draw(self):\n ui.clear()\n ui.draw_board(self)\n ui.output_buffer()", "def draw(self):\n self.game.screen.blit...
[ "0.71959436", "0.71646374", "0.7149062", "0.70004237", "0.6948424", "0.693547", "0.6933525", "0.69302493", "0.6910674", "0.68587756", "0.68422884", "0.6814107", "0.67942995", "0.6786039", "0.6781206", "0.67593044", "0.6743637", "0.6736702", "0.67250603", "0.6704635", "0.66906...
0.744677
0
Raise a ValidationError if both read and seen aren't present in the data on load.
def validate_read_and_seen(self, data, **kwargs): if "_read" not in data and "_seen" not in data: raise ValidationError( "Please provide at least one field to update. Valid fields to update are: read, seen" ) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_validation(self, data=empty):\n\n if data is not empty:\n unknown = set(data) - set(self.fields)\n if unknown:\n errors = ['Unknown field: {}'.format(f) for f in unknown]\n raise ValidationError({api_settings.NON_FIELD_ERRORS_KEY: errors})\n ...
[ "0.5979273", "0.59756815", "0.59148115", "0.5896454", "0.5861694", "0.58232266", "0.5729353", "0.57225645", "0.57207716", "0.57072765", "0.5692056", "0.56787133", "0.56617683", "0.56520987", "0.564185", "0.56379646", "0.5600832", "0.55941314", "0.55883497", "0.5584797", "0.55...
0.7580785
0
Remove unwanted fields from the input data before deserialization.
def strip_unwanted_fields(self, data, many, **kwargs): unwanted_fields = ["resource_type"] for field in unwanted_fields: if field in data: data.pop(field) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_without(self, fields):\n without = {}\n data = json.loads(self.data())\n for field, value in data.items():\n if field not in fields:\n without[field] = value\n return json.dumps(without)", "def _handle_load_unknown(self, data, original):\n for...
[ "0.6555097", "0.65335226", "0.648783", "0.6465724", "0.64547426", "0.63630354", "0.6291123", "0.62394714", "0.6230694", "0.617656", "0.61249834", "0.61099166", "0.60425276", "0.60180753", "0.5954726", "0.5933094", "0.5887662", "0.5869651", "0.5855113", "0.5816797", "0.5764964...
0.715984
0
Default handler for the 'upgradecharm' hook. This calls the charm.singleton.upgrade_charm() function as a default.
def default_upgrade_charm(): reactive.set_state('upgraded')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_upgrade_charm_and_config_changed():\n # if we are paused, delay doing any config changed hooks.\n # It is forced on the resume.\n if is_unit_paused_set():\n log(\"Unit is pause or upgrading. Skipping config_changed\", \"WARN\")\n return\n\n # If neutron is ready to be queried t...
[ "0.61215603", "0.5827736", "0.5827736", "0.5769417", "0.5552865", "0.5416802", "0.53070086", "0.5300575", "0.5300575", "0.52797246", "0.52411395", "0.5214594", "0.52124786", "0.5197446", "0.519422", "0.51887095", "0.51686233", "0.511813", "0.51136786", "0.5109636", "0.5072089...
0.73526126
0
Register a new serializer. ``serializer_module`` should be the fully qualified module name for the serializer. If ``serializers`` is provided, the registration will be added to the provided dictionary. If ``serializers`` is not provided, the registration will be made directly into the global register of serializers. Ad...
def register_serializer(format, serializer_module, serializers=None): module = importlib.import_module(serializer_module) if serializers is None: _test_serializers[format] = module else: serializers[format] = module
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_serializer(self, format, serializer_module, serializers=None):\n if serializers is None and not _serializers:\n _load_serializers() # noqa\n module = importlib.import_module(serializer_module)\n if serializers is None:\n _serializers[format] = module\n ...
[ "0.8097845", "0.64704186", "0.6335528", "0.6035935", "0.5834353", "0.560941", "0.560378", "0.55584794", "0.5555326", "0.54464227", "0.54352367", "0.539239", "0.53690106", "0.5201479", "0.51873523", "0.51735735", "0.51566696", "0.51259375", "0.51088816", "0.509993", "0.5051436...
0.7705777
1
Build a segment and upload it to the database
def storeSegment ( baseurl, fields, token ): # Create the segment and initialize it's fields ann = annotation.Annotation() ann.annid = int(fields[0]) # Exceptional cases if ann.annid in EXCEPTIONS: print "Skipping id ", ann.annid return descriptorstr = fields[40].split("\"") descriptor = desc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creating_a_new_segment(self):\n pass", "def upload_segment(self, upload_uri, _range, data, filetype):\n content_range = '%d-%d/%d' % (_range, len(data), len(data))\n upload_headers = {'Content-Type': 'video/%s' % filetype,\n 'Content-Length': len(data),\n ...
[ "0.5833868", "0.5765367", "0.5742429", "0.5674389", "0.5647412", "0.55634326", "0.5562862", "0.5561764", "0.5473224", "0.5463174", "0.53344667", "0.51844907", "0.51703966", "0.51339674", "0.5119455", "0.51095533", "0.5105669", "0.5104707", "0.5098783", "0.50784904", "0.506254...
0.68121916
0
Update histogram axis labels
def update_histogram_axis(self, param_z): if not isinstance(param_z, (Parameter, ArrayParameter)): raise TypeError("param_z must be a qcodes parameter") self.histogram.axis.label = param_z.label self.histogram.axis.units = param_z.unit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotHist(self):\n X = []\n Y = []\n for item in self.hist.items():\n X.append(int(item[0]))\n Y.append(int(item[1]))\n plt.bar(X,Y, align='center')\n plt.xticks([1,2,3,4,5,6,7])\n plt.ylim(0,len(self.responses))\n plt.title(self.text)\n ...
[ "0.6477337", "0.63621324", "0.6312074", "0.62236243", "0.61934793", "0.61705893", "0.61624444", "0.6160957", "0.6138542", "0.6047162", "0.60457915", "0.6002262", "0.59784037", "0.59702045", "0.5963506", "0.59363925", "0.5936097", "0.5902255", "0.58912313", "0.5886011", "0.588...
0.69672614
0
Set the next file to be readed open it and parse de file header
def setNextFile(self): if (self.nReadBlocks >= self.processingHeaderObj.dataBlocksPerFile): self.nReadFiles=self.nReadFiles+1 if self.nReadFiles > self.nTotalReadFiles: self.flagNoMoreFiles=1 raise schainpy.admin.SchainWarning('No more files to read') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_file(self):\n raise NotImplementedError()", "def _parseFileHeader(self):\n self.fileheader = FileHeader()\n self.fileheader.parse(self.f)\n #print('Parsed fileheader')", "def _load_next_file(self):\n\n if self._file_ptr == len(self.files):\n raise pipeline...
[ "0.73649985", "0.70942795", "0.67331856", "0.65562445", "0.64902055", "0.6425818", "0.6332165", "0.62662536", "0.621379", "0.6203025", "0.6197563", "0.6170621", "0.6066376", "0.6052729", "0.6031853", "0.60021645", "0.59682465", "0.58939487", "0.5889797", "0.5880308", "0.58764...
0.77205247
0
Method for retrieving a MongoClient according to the environment we are running on
def get_client(): return MongoClientManager().client
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mongo_client():\n return pymongo.MongoClient(mongo_uri)", "def mongo_client():\n return MongoClient(STRING_CONNECTION)", "def get_client() -> 'MongoCLient':\n client = pymongo.MongoClient()\n db = client['c3']\n c = db['json']\n return c", "def mongo_client(request):\n _client =...
[ "0.8341212", "0.8190621", "0.7837408", "0.78273493", "0.77715296", "0.7766948", "0.7732904", "0.7623258", "0.74750227", "0.7434855", "0.7319507", "0.73136675", "0.72610074", "0.72336066", "0.71915627", "0.7119741", "0.7084458", "0.7055482", "0.7012948", "0.70125276", "0.69796...
0.8293136
1
get start times of each window, rather than midpoint times
def window_start_times(self): window_length = self.window_length if window_length is not None: return np.array(self.times) - window_length / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_window_start_times(profileDict):\n assert isinstance(profileDict, dict) and \"samples\" in profileDict\n\n return profileDict[\"samples\"][\"window_start_offsets\"]", "def get_stamp_windows(self):\n early_window = self.get_earliest_stamp_window()\n late_window = self.get_latest_stamp...
[ "0.706582", "0.6949816", "0.69158256", "0.67766327", "0.6563551", "0.6440743", "0.6440743", "0.6440743", "0.641841", "0.6396794", "0.6240237", "0.6184359", "0.61674947", "0.6163281", "0.61608666", "0.61237836", "0.60875", "0.60331976", "0.6020793", "0.60102284", "0.5982363", ...
0.7801374
0
Limit the decibel values of the spectrogram to range from min_db to max_db values less than min_db are set to min_db values greater than max_db are set to max_db similar to Audacity's gain and range parameters
def limit_db_range(self, min_db=-100, max_db=-20): if max_db <= min_db: raise ValueError( f"max_db must be greater than min_db (got max_db={max_db} and min_db={min_db})" ) _spec = self.spectrogram.copy() _spec[_spec > max_db] = max_db _spec[_spec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bandpassFilter (self, lowerFreq, upperFreq):\n self.bandpassLimits = (lowerFreq, upperFreq)\n # stuff to do", "def test_amplitude_to_DB_top_db_clamp(self, shape):\n amplitude_mult = 20.0\n amin = 1e-10\n ref = 1.0\n db_mult = math.log10(max(amin, ref))\n top_d...
[ "0.6543088", "0.63455105", "0.59435076", "0.5900837", "0.5895303", "0.58287895", "0.58118963", "0.5693314", "0.5671849", "0.5605527", "0.5594989", "0.5594989", "0.55749387", "0.55442375", "0.553664", "0.5527325", "0.55126756", "0.5476304", "0.5475454", "0.5456993", "0.5440523...
0.7652851
0
create amplitude signal in signal_band and subtract amplitude from reject_bands rescale the signal and reject bands by dividing by their bandwidths in Hz (amplitude of each reject_band is divided by the total bandwidth of all reject_bands. amplitude of signal_band is divided by badwidth of signal_band. )
def net_amplitude( self, signal_band, reject_bands=None ): # used to be called "net_power_signal" which is misleading (not power) # find the amplitude signal for the desired frequency band signal_band_amplitude = self.amplitude(signal_band) signal_band_bandwidth = signal_band[1] -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resample(self, octave_bands):\n self.energy_absorption = {\n \"coeffs\": octave_bands(**self.energy_absorption),\n \"center_freqs\": octave_bands.centers,\n }\n self.scattering = {\n \"coeffs\": octave_bands(**self.scattering),\n \"center_freqs\"...
[ "0.5767293", "0.56970996", "0.5683578", "0.565826", "0.5516282", "0.55063117", "0.5480709", "0.5366859", "0.5358178", "0.53578806", "0.53535485", "0.53493917", "0.5343005", "0.53388214", "0.5336682", "0.526872", "0.5264879", "0.5259167", "0.5258626", "0.5216204", "0.5195795",...
0.76050895
0
Create an image from spectrogram (array, tensor, or PIL.Image) Linearly rescales values in the spectrogram from self.decibel_limits to [0,255] (PIL.Image) or [0,1] (array/tensor) Default of self.decibel_limits on load is [100, 20], so, e.g., 20 db is loudest > black, 100 db is quietest > white
def to_image( self, shape=None, channels=1, colormap=None, invert=False, return_type="pil" ): assert return_type in [ "pil", "np", "torch", ], f"Arg `return_type` must be one of 'pil', 'np', 'torch'. Got {return_type}." if colormap is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_scale(minfreq, maxfreq, f0, fs, NumVoices):\n a0 = 2**(1./NumVoices)\n minscale = 1.*f0/(maxfreq/(1.*fs))\n maxscale = 1.*f0/(minfreq/(1.*fs))\n minscale = numpy.floor(NumVoices*numpy.log2(minscale))\n maxscale = numpy.ceil(NumVoices*numpy.log2(maxscale))\n scales = a0**numpy.arange(mi...
[ "0.5606683", "0.5565871", "0.5537458", "0.55074537", "0.54754657", "0.53694624", "0.5366678", "0.5346742", "0.5346049", "0.52903324", "0.5286052", "0.5278703", "0.5197284", "0.51946443", "0.5176599", "0.51714975", "0.5162562", "0.5147684", "0.5136048", "0.5070113", "0.5057863...
0.58980805
0
Create a MelSpectrogram object from an Audio object First creates a spectrogram and a melfrequency filter bank, then computes the dot product of the filter bank with the spectrogram. A Mel spectgrogram is a spectrogram with a quasilogarithmic frequency axis that has often been used in langauge processing and other doma...
def from_audio( cls, audio, window_type="hann", window_samples=None, window_length_sec=None, overlap_samples=None, overlap_fraction=None, fft_size=None, decibel_limits=(-100, -20), dB_scale=True, scaling="spectrum", n_mels=6...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logmelfilterbank(\n audio,\n sampling_rate,\n fft_size=1024,\n hop_size=256,\n win_length=None,\n window=\"hann\",\n num_mels=80,\n fmin=None,\n fmax=None,\n eps=1e-10,\n):\n # # get amplitude spectrogram\n # x_stft = librosa.stft(audio, n_fft=fft_size, hop_length=hop_size,\...
[ "0.6986237", "0.6793099", "0.6440002", "0.6370468", "0.6307332", "0.62644506", "0.62172663", "0.6217062", "0.61560535", "0.6096429", "0.6089963", "0.607983", "0.60609484", "0.60468566", "0.60309696", "0.6005659", "0.59963155", "0.59907985", "0.5938237", "0.5927663", "0.585586...
0.7015561
0
Plot the mel spectrogram with matplotlib.pyplot We can't use pcolormesh because it will smash pixels to achieve a linear yaxis, rather than preserving the mel scale.
def plot(self, inline=True, fname=None, show_colorbar=False): color_norm = matplotlib.colors.Normalize( vmin=self.decibel_limits[0], vmax=self.decibel_limits[1] ) plt.imshow(self.spectrogram[::-1], cmap="Greys", norm=color_norm) # pick values to show on time and frequency a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotSpect(spec, sr):\r\n fig, ax = plt.subplots()\r\n img = librosa.display.specshow(spec, x_axis='time', y_axis='mel', sr=sr, fmax=8000, ax=ax) \r\n fig.colorbar(img, ax=ax, format='%+2.0f dB') \r\n ax.set(title='Mel-frequency spectrogram')", "def plotSpectrogram(image, ax=None, filename=...
[ "0.6526607", "0.6265646", "0.6243087", "0.6219029", "0.60919875", "0.6084113", "0.60510635", "0.6046127", "0.60325795", "0.6010605", "0.60043985", "0.59996504", "0.59831214", "0.5975759", "0.5924247", "0.5914894", "0.59055877", "0.5889122", "0.5854651", "0.58532804", "0.58160...
0.6283004
1
Returns a dictionary with gidvaluedictionary mappings. Each valuedictionary contains a "data" entry, which references a single satic value. {
def get_static_data(name): varinfo = get_varinfo(name) if varinfo["type"] == "static": data = get_data(varinfo["id"]) giddict = dict([ (valuedict["gid"],{"data":valuedict["value"]}) for valuedict in data["cells"] ]) return giddict els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_USDA(x, num):\n d = soildict\n maxlat,minlat, maxlon, minlon = maxmin(x['geometry']['coordinates'])\n d['UniqueID'] = num\n d['FAO_USDA'] = \"USDA\"\n d['Soil'] = x['properties']['SOIL_ORDER']\n d['Suborder'] = x['properties']['SUBORDER']\n d['Points'] = x['geometry']['coordi...
[ "0.5795908", "0.57550037", "0.5730892", "0.5685472", "0.5652545", "0.56521934", "0.56123805", "0.5593363", "0.5575099", "0.55283445", "0.55263656", "0.5524063", "0.5520968", "0.55030185", "0.55029625", "0.54775494", "0.5468004", "0.5462071", "0.5439897", "0.54182166", "0.5416...
0.619161
0
Check if a BagIt file is valid.
def validate_bagit_file(bagit_path): _assert_zip_file(bagit_path) bagit_zip = zipfile.ZipFile(bagit_path) manifest_info_list = _get_manifest_info_list(bagit_zip) _validate_checksums(bagit_zip, manifest_info_list) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_file(self, file_path):\n return True", "def is_valid(path):\n with open(path, 'rb') as handle:\n size = os.fstat(handle.fileno()).st_size\n try:\n mgz.header.parse_stream(handle)\n mgz.body.meta.parse_stream(handle)\n while handle.tell() < siz...
[ "0.7262959", "0.7018546", "0.69170135", "0.6661559", "0.66425854", "0.66045403", "0.6600143", "0.6394053", "0.63757855", "0.636247", "0.6352779", "0.6295391", "0.62760955", "0.62718934", "0.62690115", "0.6264291", "0.623363", "0.6229525", "0.6226784", "0.6223114", "0.62181854...
0.7836063
0
Create a stream containing a BagIt zip archive.
def create_bagit_stream(dir_name, payload_info_list): zip_file = zipstream.ZipFile(mode="w", compression=zipstream.ZIP_DEFLATED) _add_path(dir_name, payload_info_list) payload_byte_count, payload_file_count = _add_payload_files( zip_file, payload_info_list ) tag_info_list = _add_tag_files( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _open_zip(self):\n self.buffer = io.BytesIO()\n self.zf = zipfile.ZipFile(self.buffer, \"w\", zipfile.ZIP_DEFLATED)", "def make_empty_zip(self):\n buffer = BytesIO()\n file = ZipFile(buffer, 'w')\n file.close()\n return buffer", "def build_stream(\n self,\n ...
[ "0.7016167", "0.696086", "0.69191074", "0.68715894", "0.6276448", "0.6141783", "0.6107695", "0.60997033", "0.609386", "0.60406435", "0.59711933", "0.5850886", "0.57767236", "0.5726518", "0.57221675", "0.5686355", "0.5662348", "0.5662348", "0.5655217", "0.564611", "0.5634951",...
0.76873803
0