query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Apply scatter or scatterx markers. Permit up to 4 positional arguments including `s` and `c`.
def _apply_scatter( self, *args, vmin=None, vmax=None, smin=None, smax=None, cmap=None, cmap_kw=None, norm=None, norm_kw=None, extend='neither', levels=None, N=None, values=None, locator=None, locator_kw=None, discrete=None, symmetric=False, positive=False, negative=False, nozero=False, inbounds...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter(\n self,\n x: Hashable,\n y: Hashable,\n s: Hashable | Sequence[Hashable] | None = None,\n c: Hashable | Sequence[Hashable] | None = None,\n **kwargs,\n ) -> PlotAccessor:\n return self(kind=\"scatter\", x=x, y=y, s=s, c=c, **kwargs)", "def scatter_...
[ "0.73080397", "0.7147928", "0.6383184", "0.6152772", "0.61122864", "0.60580695", "0.60487276", "0.59739614", "0.595722", "0.59471047", "0.58845496", "0.5847677", "0.5771839", "0.57457244", "0.5737389", "0.5709712", "0.5641588", "0.56390935", "0.56127715", "0.56117004", "0.560...
0.60851175
5
Support convenient keyword arguments and change the default boxplot style. Important This function wraps `~matplotlib.axes.Axes.boxplot`.
def boxplot_extras( self, *args, mean=None, means=None, fill=True, fillcolor=None, fillalpha=None, lw=None, linewidth=None, color=None, edgecolor=None, boxcolor=None, boxlw=None, boxlinewidth=None, capcolor=None, caplw=None, caplinewidth=None, whiskercolor=None, whiskerlw=None, whiskerli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_boxplot(ax, x, y, error, xlims, ylims, mediancolor='magenta'):\n\n medianprops = {'color': mediancolor, 'linewidth': 2}\n boxprops = {'color': 'black', 'linestyle': '-'}\n whiskerprops = {'color': 'black', 'linestyle': '-'}\n capprops = {'color': 'black', 'linestyle': '-'}\n flierprops = ...
[ "0.70661396", "0.6717219", "0.6572081", "0.64261633", "0.6353482", "0.6249762", "0.6122135", "0.60474485", "0.60449153", "0.60111177", "0.59860617", "0.5971718", "0.59685916", "0.5964264", "0.5922844", "0.592033", "0.58533245", "0.58428067", "0.5830291", "0.58027494", "0.5772...
0.70291525
1
Determine if an object is a valid instance of a given GeoJSON type. Right now this is only used with the Feature GeoJSON type but this will be expanded.
def _is_instance_of(obj: dict, geojson_type: str) -> bool: try: schema_name = next(t + '.json' for t in GEOJSON_TYPES if t.lower() == geojson_type.lower()) except StopIteration: raise GeoJSONError(f'Specified geojson_type ({geojson_type}) does ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_type(self, obj):\n return isinstance(obj, self.type_)", "def is_type(obj: Any) -> bool:\n return type(obj).__name__ == \"type\"", "def _valid_typable_object(ui_object, platform=Platform.ANDROID):\n if platform == Platform.ANDROID:\n return ui_object.obj_type in _TYPABLE_OBJECT_DESC.key...
[ "0.7187538", "0.6600167", "0.65878046", "0.6538357", "0.6481669", "0.64806205", "0.6463608", "0.64477694", "0.64189196", "0.63908225", "0.6362091", "0.6348353", "0.63475704", "0.630314", "0.62129635", "0.62125003", "0.61813396", "0.6166474", "0.61458623", "0.6129726", "0.6123...
0.8293936
0
This is a factory function for creating the correct profile class
def assign_profile(name, properties): profile_dict = {'time': Time, 'streq': Streq, 'domain': Domain, 'use': Use} return profile_dict[name](properties)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data=None, **kw):\n def _get_class_by_id(profile_id):\n from solariat_bottle.db.user_profiles.social_profile import DELIMITER, TwitterProfile, FacebookProfile\n pos = unicode(profile_id).rfind(DELIMITER) + 1\n if pos == 0:\n return self.__cl...
[ "0.6842044", "0.67778605", "0.66458404", "0.6508503", "0.6463637", "0.63409054", "0.633302", "0.6195569", "0.61947244", "0.6172852", "0.61552906", "0.6130558", "0.6116768", "0.6093168", "0.6080638", "0.6045534", "0.6033012", "0.6008745", "0.6008745", "0.6007816", "0.6001435",...
0.5924465
33
Update a datasource connection based on id.
def update_datasource_connection(connection, id, body, error_msg=None): url = f"{connection.base_url}/api/datasources/connections/{id}" for op_dict in body["operationList"]: alter_patch_req_body(op_dict, "/datasourceLogin", "/databaseLoginId") response = connection.session.patch(url=url, json=body) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_datasource_instance(connection, id, body, error_msg=None):\n url = f\"{connection.base_url}/api/datasources/{id}\"\n for op_dict in body[\"operationList\"]:\n op_dict = alter_patch_req_body(op_dict, \"/datasourceConnection\", \"/databaseConnectionId\")\n op_dict = alter_patch_req_bod...
[ "0.6917262", "0.5575786", "0.54998964", "0.5476718", "0.52564263", "0.52509683", "0.52483374", "0.52230465", "0.51892686", "0.51857996", "0.51718533", "0.5149414", "0.51482207", "0.5143557", "0.51340216", "0.51308256", "0.51249486", "0.5115287", "0.5109345", "0.5092116", "0.5...
0.7393521
0
Method to return the indexes of the children link ids of a given link index.
def get_children_link_indexes(self, link_idx): indexes = [] for i in range(len(info_populator.InfoPopulator.LINK_PARENT_CHILD_RELATION)): if link_idx == info_populator.InfoPopulator.LINK_PARENT_CHILD_RELATION[ i][0]: indexes.append( sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_child_indices(self, current_index: int) -> List[int]:\n multiplier = current_index * 2\n left_index = multiplier + 1\n right_index = multiplier + 2\n\n return [left_index, right_index]", "def children_ids(self):\n return self._children_ids", "def get_child_indices(id...
[ "0.7037743", "0.6621831", "0.6541017", "0.6464701", "0.62523526", "0.61869526", "0.61356086", "0.6060696", "0.60183406", "0.5937082", "0.5887544", "0.5866574", "0.5838167", "0.5837109", "0.57871544", "0.5764572", "0.56717837", "0.5665025", "0.56470746", "0.56073725", "0.55945...
0.867098
0
Renders the application home page
def home(request): logging.info(request.POST) user = request.user user_permissions = 'allowed' if user.is_authenticated() else '' if not user_permissions: return render_to_response('intro.html', locals(), context_instance=RequestContext(request)) return HttpResponseRedirect("/groups/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n\n return render_template('home_page.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template(\"home.html\")", "def home():\n return render_template(\"home.html\")", "...
[ "0.865591", "0.85281825", "0.8400584", "0.8330568", "0.8330568", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "0.8322108", "...
0.0
-1
Renders the groups home
def groups(request): groups = GroupProfile.objects.all() user = request.user user_permissions = 'allowed' if user.is_authenticated() else '' show_errors_in_form = False group_form = GroupProfileForm() return render_to_response('home.html', locals())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n group = Group.objects.random()\n return render_to_response('group.html',\n locals(),\n context_instance=RequestContext(request))", "def group_home(request, group_slug):\n user = request.user\n group = GroupProfile.objects....
[ "0.7267726", "0.6881474", "0.6773615", "0.64007443", "0.6372308", "0.6366702", "0.6312354", "0.630933", "0.6249941", "0.62382644", "0.6216164", "0.62087464", "0.6160828", "0.61308545", "0.61278707", "0.61278707", "0.6117747", "0.6117747", "0.6117747", "0.6117747", "0.6117747"...
0.6666453
3
Homepage of a group, displaying the group's description & active content.
def group_home(request, group_slug): user = request.user group = GroupProfile.objects.get(slug=group_slug) user_permissions = '' if not group: raise Http404("Can't find a group with the slug: %s" % group_slug) else: user_permission_type = get_user_permissions(user, group) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n group = Group.objects.random()\n return render_to_response('group.html',\n locals(),\n context_instance=RequestContext(request))", "def show(self, group):\n self._current_group = group", "def a_homepage():\n\n\treturn r...
[ "0.6771717", "0.64504755", "0.6240646", "0.6039981", "0.60061455", "0.5985877", "0.59748685", "0.59410596", "0.58859944", "0.5858548", "0.58177614", "0.5777301", "0.57494056", "0.57359445", "0.5731679", "0.5668256", "0.566821", "0.5665454", "0.56565124", "0.5637726", "0.56297...
0.70152926
0
Returns a date string in the TXF format, which is MM/DD/YYYY.
def txfDate(date): return date.strftime('%m/%d/%Y')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_date_string(self, t):\n # TODO: Consider using datetime.utcfromtimestamp(timestamp).date() --> datetime.date(2014, 8, 8)\n return time.strftime(\"%m/%d/%Y\", time.gmtime(float(t)))", "def date() -> str:\n\n return datetime.strftime(datetime.today(), _fmt)", "def date_string(date):\n ...
[ "0.7233908", "0.7114718", "0.70269245", "0.6768055", "0.67452437", "0.67276955", "0.6631584", "0.65468127", "0.6497827", "0.6423727", "0.63926196", "0.6388991", "0.63318235", "0.6328677", "0.63170004", "0.6294702", "0.62929684", "0.6290279", "0.62850285", "0.6275938", "0.6244...
0.8131406
0
Sets the data_source_name of this ReportFilterConnection.
def data_source_name(self, data_source_name): self._data_source_name = data_source_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_source(self, source_id):\n self.data_source = source_id", "def data_source_display_name(self, data_source_display_name):\n\n self._data_source_display_name = data_source_display_name", "def set_source(self, source_name):\n self.source = source_name", "def default_DataSource(self...
[ "0.70039153", "0.68002874", "0.6757543", "0.63783085", "0.6329608", "0.61506903", "0.60687876", "0.6038596", "0.6005333", "0.5926186", "0.57952255", "0.57683146", "0.5733289", "0.56510305", "0.55500877", "0.5538222", "0.54760617", "0.5471781", "0.54453117", "0.5435626", "0.54...
0.8401654
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ReportFilterConnection): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
return the number of ways to change any given amount. Available coins are also passed as argument to the function. >>> count_change(10, [1, 5]) 3 >>> count_change(10, [1, 2]) 6 >>> count_change(100, [1, 5, 10, 25, 50]) 292 >>> count_change(200, [1, 2, 5, 10, 20, 50, 100, 200]) 73682
def count_change(amount, denominations): if amount == 0: return 1 elif denominations == []: return 0 else: count = 0 n = amount/denominations[0] for i in range(n+1): change = denominations[0]*i count += count_change(amount-change, denomination...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_change(amount):\n\toptions = [2**i for i in range(amount+1) if 2**i <= amount]\n\toptions = sorted(options, reverse = True)\n\tlength = len(options)\n\n\t# print(length)\n\tdef helper(remains, i, options, length):\n\t\t# loop until reaching the smallest coin\n\t\tif i >= length :\n\t\t\treturn 0\n\t\t# c...
[ "0.7798518", "0.7776868", "0.76432", "0.7214048", "0.7172765", "0.71469384", "0.6809384", "0.67461157", "0.6378696", "0.6347909", "0.6276754", "0.61886907", "0.6129294", "0.6061304", "0.5978411", "0.58619744", "0.5760776", "0.5733221", "0.5596031", "0.5583245", "0.55715746", ...
0.7586695
3
Test the email for a new user is normalized
def test_new_user_email_normalized(self): email = 'test@TEST.com' user = get_user_model().objects.create_user( email=email, password=self.test_user_pass, name=self.test_user_name ) self.assertEqual(user.email, email.lower())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_user_email_normalized(self):\n email = 'test@GOOGLE.COM'\n user = get_user_model().objects.create_user(email, '212ds')\n\n self.assertEqual(user.email, email.lower())", "def test_new_email_normalised(self):\n\n email = \"test@RANDOMEMAIL.org\"\n user = get_user_mod...
[ "0.79984254", "0.7997281", "0.79201037", "0.78920823", "0.78920823", "0.78920823", "0.7871696", "0.78619236", "0.785927", "0.7858499", "0.7844939", "0.7773778", "0.7771046", "0.7745209", "0.7744957", "0.7702127", "0.75698525", "0.75344014", "0.74174696", "0.7257744", "0.71476...
0.7853585
10
Test creating user with no email raises error
def test_new_user_invalid_email(self): with self.assertRaises(ValueError): get_user_model().objects.create_user( email=None, password=self.test_user_pass, name=self.test_user_name, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_private_create_user_without_email(self):\n with pytest.raises(ValueError) as exinfo:\n EmailUser.objects._create_user(None, None, False, False)\n self.assertIn('email must be set', str(exinfo.value))", "def test_creating_a_new_user_without_email(self):\n\n with self.asser...
[ "0.90313256", "0.8963383", "0.8736711", "0.8736247", "0.87256855", "0.8717645", "0.87146974", "0.87146974", "0.87146974", "0.87146974", "0.87146974", "0.87053293", "0.87032956", "0.8700956", "0.869592", "0.86902976", "0.8681168", "0.86709315", "0.8597593", "0.85930586", "0.85...
0.8557775
21
Return an RGB colour array of the value placed on a linear colour gradient. The argument value should be a number between zero and one. The start and end colours can either be strings or RGB colour arrays.
def linear_gradient(value, start, end, colour_list=None): # Translate the end colour to RGB arrays if necessary. if isinstance(start, str): # Default (search the molmol list then the X11 list). if colour_list == None: try: start = molmol_colours(start) ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linearGradient(self,start_rgb, finish_rgb, n):\n rgb_list = [start_rgb]\n\n for t in range(1, n):\n current_color = [int((start_rgb[j]) + (float(t)/(n-1))*(finish_rgb[j] - start_rgb[j])) for j in range(3)]\n rgb_list.append(current_color)\n\n return rgb_list", "def ...
[ "0.6797874", "0.64000934", "0.62669384", "0.6248822", "0.61992866", "0.6170552", "0.59006846", "0.5836825", "0.5718993", "0.5718993", "0.5718993", "0.5718993", "0.57020015", "0.5634084", "0.5573756", "0.55539155", "0.5540418", "0.5517445", "0.5508028", "0.54978454", "0.545114...
0.81829035
0
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key
def get(self, k: int) -> int: i = k % self.capacity cur = self.data[i] while cur: if cur.pair[0] == k: return cur.pair[1] else: cur = cur.next return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]", "def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1", "def get(self, key: int) -> int:\n sh = key % 37\n if ...
[ "0.80042744", "0.7910075", "0.7629806", "0.7565862", "0.75574356", "0.7530217", "0.75266016", "0.7493717", "0.7374892", "0.72957647", "0.72944045", "0.7222471", "0.7217407", "0.718173", "0.7178819", "0.7163424", "0.6981922", "0.6929469", "0.6786084", "0.6757723", "0.67340237"...
0.0
-1
Removes lines with '' keyword and removes parts, like $ab24b, from words
def remove_generated_parts(message): all_lines = [] for line in message.split("\n"): if "<generated>" in line.lower(): continue if has_stacktrace_keywords(line) or has_more_lines_pattern(line): continue for symbol in [r"\$", "@"]: all_found_parts = set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(word):\n word = word.lower()\n stopwords = ['of', 'and','to', 'at', 'in', '@']\n word = re.sub(r'[\\&/\\-\\(\\)\\|\\@,\\]\\[]+', ' ', word)\n for stopword in stopwords:\n pattern = r'\\b' + stopword + r'\\b'\n pattern = re.compile(pattern)\n word = re.sub(pattern, '', wor...
[ "0.6548206", "0.6403611", "0.6256447", "0.6228192", "0.6182673", "0.61396646", "0.6102278", "0.6072348", "0.6037634", "0.6030601", "0.6030601", "0.6030601", "0.6030601", "0.6030601", "0.6030601", "0.59951806", "0.594404", "0.59264064", "0.5916763", "0.5906881", "0.5902903", ...
0.0
-1
Updates the boundary condition of pressure based on the flow field.
def _update_pressure_bc( self, states: FlowFieldMap, additional_states: FlowFieldMap, ): bc_p = [[None, None], [None, None], [None, None]] velocity_keys = ['u', 'v', 'w'] grid_spacing = (self._params.dx, self._params.dy, self._params.dz) def grad_per_dim(f, dim): """Computes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, applyTo='global', conditions='True', param=\"None\"):\n if applyTo == 'inside':\n super(DirichletBoundary, self).update('conditions',\n conditions, \"None\")\n self.on = False\n self.applyTo = 'inside'\n ...
[ "0.59902203", "0.58896095", "0.58589864", "0.58041596", "0.5701504", "0.5700715", "0.5629401", "0.55757767", "0.552746", "0.54171693", "0.5392108", "0.53157026", "0.52962834", "0.52475595", "0.5196572", "0.51666063", "0.51650226", "0.5154833", "0.51129824", "0.507854", "0.505...
0.5516662
9
Computes the diffusion term at walls.
def diff_fn( mu_i: tf.Tensor, ddu_n_i: tf.Tensor, ddu_t_i: tf.Tensor, ) -> tf.Tensor: return mu_i * (4.0 / 3.0 * ddu_n_i + 1.0 / 3.0 * ddu_t_i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_wall_distance(self):\n phi = sp.ones(self.image_red.shape)\n if (len(self.mask_id[0])>0):\n phi[self.mask_id] = 0\n self.wall_distance = skfmm.distance(phi, dx=self.pixel_size)\n grad = sp.gradient(self.wall_distance,edge_order=2)\n grad_X = gra...
[ "0.66568696", "0.6012638", "0.56698394", "0.56135094", "0.553084", "0.5471315", "0.5401082", "0.5390548", "0.53496104", "0.5349468", "0.53459954", "0.5319868", "0.5314257", "0.5308811", "0.5250063", "0.5243277", "0.52415586", "0.52352196", "0.5232406", "0.52219284", "0.521995...
0.0
-1
Init linked list object with optioanl itterable.
def __init__(self, iterable=None): self.head = None self.iterable = iterable if iterable is not None: try: for i in iterable: self.insert(i) except TypeError: print('value is not an interable')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, init):\n self.stepforward = int(init)\n self.data = Linkedlist()", "def __init__(self, lst=[]):\n self.__length = 0 # current length of the linked list\n self.__head = None # pointer to the first node in the list\n for e in lst: # initialize the list,\n ...
[ "0.66827315", "0.6606495", "0.65991396", "0.65904737", "0.6537204", "0.6537204", "0.64759624", "0.6452128", "0.6452128", "0.6452128", "0.64513457", "0.64356077", "0.6431038", "0.6423537", "0.64079875", "0.64079875", "0.64079875", "0.64079875", "0.64079875", "0.64079875", "0.6...
0.0
-1
Insert new node at head of list.
def insert(self, val): new_node = Node(val) new_node.next = self.head self.head = new_node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_start(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n self.head = ListNode(data)\n self.head.next = temp", "def insert_head(self, data):\n node = Node(data)\n if self.is_empty():\n ...
[ "0.7990548", "0.78612727", "0.750257", "0.74800813", "0.7466171", "0.74588954", "0.7441015", "0.74356997", "0.7426098", "0.73962426", "0.73894817", "0.7388376", "0.73828065", "0.7376425", "0.7363219", "0.73528856", "0.73235005", "0.7303536", "0.728345", "0.7266461", "0.726568...
0.70561796
33
Return converted to UTC.
def _get_datetime(object_id, str_format="%m/%d/%Y %I:%M:%S %p"): object_id = ObjectId(object_id) from_zone = tz.tzutc() to_zone = tz.tzlocal() datetime_utc = object_id.generation_time datetime_utc = datetime_utc.replace(tzinfo=from_zone) datetime_local = datetime_utc.astimezone(to_zone) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utc(self):\n return self._utc", "def date_to_utc(self, date):\n if date.tzinfo is not None:\n # date is timezone-aware\n date = date.astimezone(self.tz_utc)\n\n else:\n # date is a naive date: assume expressed in local time\n date = date.replac...
[ "0.7237011", "0.72318196", "0.69607633", "0.69415265", "0.6914583", "0.67269593", "0.6687664", "0.6680496", "0.6631392", "0.6629553", "0.661339", "0.65730214", "0.65478396", "0.65169936", "0.6507937", "0.6506579", "0.6502555", "0.6496025", "0.6490228", "0.64823437", "0.643121...
0.0
-1
Timeseries binning (w/overlapping windows).
def binning(x, y, xmin=None, xmax=None, dx=1 / 12., window=3 / 12., interp=False, median=False): if xmin is None: xmin = np.nanmin(x) if xmax is None: xmax = np.nanmax(x) steps = np.arange(xmin, xmax, dx) # time steps bins = [(ti, ti + window) for ti in steps] # b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_the_data(neuron_spikes, first, last, bin_size):\n neuron_activity = []\n timebins = range(first, int(last) + int(last) % bin_size, bin_size)\n for spike in neuron_spikes:\n activity = []\n spike_time = spike[0]\n i = 0\n for bin_size in timebins:\n k = 0\n ...
[ "0.7328357", "0.7048977", "0.66366595", "0.66277015", "0.6603396", "0.6476304", "0.6432733", "0.64197123", "0.6341331", "0.6329092", "0.63268715", "0.62762606", "0.61979806", "0.61776334", "0.61697716", "0.6157338", "0.61491776", "0.613122", "0.61219186", "0.61166567", "0.609...
0.6728555
2
Adjust the parameter validator range based on the dac resolution. The dac's of the IVVI have a finite resolution. If the validator range min and max values are not values the dac's can actually have, then it can occur that a set command results in the dac's going to a value just outside the validator range. Adjusting t...
def adjust_parameter_validator(self, param): if not isinstance(param.vals, Numbers): raise Exception('Only the Numbers validator is supported.') min_val = param.vals._min_value max_val = param.vals._max_value min_val_upd = self.round_dac(min_val, param.name) max_val_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_output_limits(self, min_value, max_value):\n self.out_min = min_value\n self.out_max = max_value\n if self.out_min > self.out_max:\n print(\"set_output_limits(): min must be smaller than max.\")\n self.iterm = self.clip_to_output_limits(self.iterm)\n self.outpu...
[ "0.6407683", "0.61399066", "0.60842466", "0.6050281", "0.60262334", "0.5997609", "0.5955112", "0.5934583", "0.5894086", "0.58611035", "0.5822199", "0.58186823", "0.5766734", "0.57579446", "0.57494354", "0.5724898", "0.5713188", "0.5711295", "0.56835717", "0.5676955", "0.56657...
0.7090329
0
Create a coordinate dimension feed that correctly incorperates partial batches.
def __init__(self, coord_feed:CoordinateFeed, num_parallel_calls=10): self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32) self.coord_feed = coord_feed self.dim_feed = self.coord_feed.feed.map(self.correct_dims, num_parallel_calls=self.num_parallel_calls) self.fee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_dummy_batch_dim(x):\n return x.view(1, x.size()[0], x.size()[1], x.size()[2])", "def correct_dims(self, X):\n N = tf.shape(X)[0]\n N_slice = tf.reduce_prod(self.coord_feed.dims[1:])\n return tf.concat([[tf.math.floordiv(N, N_slice)], self.coord_feed.dims[1:]], axis=0)", "def __i...
[ "0.63455623", "0.6150244", "0.6049258", "0.59853786", "0.57852656", "0.57556283", "0.5726321", "0.5698989", "0.5675836", "0.56741816", "0.5671982", "0.56666076", "0.56292367", "0.55923486", "0.5589679", "0.5556767", "0.5554053", "0.555086", "0.5530958", "0.55226696", "0.55159...
0.6581349
0
Set axes for the diagram. All data will be plotted in these axes.
def setAxes(self, ax): self.ax = ax ax.grid() yStr = self.ylabel if self.yunit: yStr += ' [' + self.yunit + ']' ax.set_ylabel(yStr) xStr = self.xlabel if self.xunit: xStr += ' [' + self.xunit + ']' ax.set_xlabel(xStr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_axes(axes, xlabel, ylabel, xlim, ylim, xscale, yscale, legend):\n axes.set_xlabel(xlabel)\n axes.set_ylabel(ylabel)\n axes.set_xscale(xscale)\n axes.set_yscale(yscale)\n axes.set_xlim(xlim)\n axes.set_ylim(ylim)\n if legend:\n axes.legend(legend)\n axes.grid()", "def set_ax...
[ "0.77359694", "0.77359694", "0.77359694", "0.76407284", "0.7521462", "0.73066485", "0.7247325", "0.71703887", "0.6859074", "0.67967325", "0.67759585", "0.67585105", "0.6744162", "0.6675193", "0.6644966", "0.6560692", "0.65567523", "0.6531188", "0.65248716", "0.6468362", "0.64...
0.7144131
8
Customizes the output of a quaternion as a tuple given a particular representation. Since all quaternions 'look the same', the q_type after the tuple tries to summarize how this quaternions came into being. Quiet turns off printing the q_type.
def __str__(self, quiet: bool = True) -> str: q_type = self.q_type if quiet: q_type = "" string = "" if self.representation == "": string = f"({self.t}, {self.x}, {self.y}, {self.z}) {q_type}" elif self.representation == "polar": rep = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return \"Quaternion({}, {}, {}, {})\".format(repr(self.q[0]), repr(self.q[1]), repr(self.q[2]), repr(self.q[3]))", "def encode(self):\n # Will we want to truncate the numbers so we will have a constant word length?\n type_as_str = \"\".join(self.type)\n # q3_as_s...
[ "0.6524928", "0.64062375", "0.6283876", "0.61663806", "0.59474236", "0.5882001", "0.5708939", "0.56912714", "0.5656753", "0.56407225", "0.5631747", "0.5555115", "0.5553596", "0.5544212", "0.5521067", "0.5462875", "0.5461042", "0.5458273", "0.5426453", "0.5407121", "0.5382408"...
0.6303258
2
Figures out if a quaternion has any symbolic terms.
def is_symbolic(self: Q) -> bool: symbolic = False if ( hasattr(self.t, "free_symbols") or hasattr(self.x, "free_symbols") or hasattr(self.y, "free_symbols") or hasattr(self.z, "free_symbols") ): symbolic = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_atom_quasiconvex(self) -> bool:\n return True", "def is_atom_quasiconvex(self):\n return True", "def is_quantitative(self):\n return self._type == 'quantitative'", "def has_u(term):\n return term.amp.has(u)", "def get_is_term(self):\n \n approx_Z = self.add_is_a...
[ "0.6043409", "0.6011447", "0.5764965", "0.568501", "0.5570009", "0.55281055", "0.55281055", "0.55233943", "0.55019015", "0.5499581", "0.54727083", "0.5467233", "0.546152", "0.545237", "0.54388046", "0.54303145", "0.5427237", "0.538874", "0.53866243", "0.5382736", "0.53798455"...
0.72237664
0
Set all quaternion series bra form.
def bras(self: Qss) -> Qss: new_qs = [] for qs in self.qss: new_qs.append(qs.bra()) return Qss(new_qs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_qmat(self):\n if self.model == 'ER':\n self.qmat = np.array([\n [-self.alpha, self.alpha],\n [self.alpha, -self.alpha],\n ])\n \n elif self.model == 'ARD':\n self.qmat = np.array([\n [-self.alpha, self.a...
[ "0.61410964", "0.5715195", "0.55923265", "0.5495401", "0.54597956", "0.5422661", "0.5381698", "0.5291765", "0.52527124", "0.5252584", "0.5251618", "0.5242818", "0.52161485", "0.5211967", "0.5201752", "0.5196765", "0.5196118", "0.5180949", "0.5176742", "0.5175206", "0.51435053...
0.0
-1
Set all the quaterion series to ket form.
def kets(self: Qss) -> Qss: new_qs = [] for qs in self.qss: new_qs.append(qs.ket()) return Qss(new_qs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ket(self: Qs) -> Qs:\n\n if self.qs_type == \"ket\":\n return self\n\n ket = conjs(deepcopy(self))\n ket.rows = self.dim\n ket.columns = 1\n\n ket.qs_type = \"ket\" if self.dim > 1 else \"scalar_q\"\n\n return ket", "def convert_to_q(self):\n if sel...
[ "0.6680758", "0.55697674", "0.5437599", "0.54181635", "0.53981864", "0.5367952", "0.5313734", "0.528576", "0.5276949", "0.52114594", "0.5194057", "0.5194057", "0.5180754", "0.51418716", "0.5138399", "0.5121381", "0.5104161", "0.50895226", "0.5085692", "0.5074917", "0.503624",...
0.58236873
1
Utility to transform quaternion series functions to a quaternion function.
def qs_to_q_function(func: FunctionType, q_1: Qs) -> Q: scalar = func(q_1) if scalar.qs_type != "scalar_q": raise Exception(f"Oops, does not evaluate to a scalar: {scalar}") return scalar.qs[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quat2transform(q):\n x, y, z, w = q\n xx2 = 2 * x * x\n yy2 = 2 * y * y\n zz2 = 2 * z * z\n xy2 = 2 * x * y\n wz2 = 2 * w * z\n zx2 = 2 * z * x\n wy2 = 2 * w * y\n yz2 = 2 * y * z\n wx2 = 2 * w * x\n\n rmat = np.empty((3, 3), float)\n rmat[0,0] = 1. - yy2 - zz2\n rmat[0,1...
[ "0.65554875", "0.6296953", "0.6283742", "0.6170736", "0.6120653", "0.60778403", "0.5983986", "0.5957472", "0.59477943", "0.5895493", "0.58823514", "0.58788633", "0.58645964", "0.58453166", "0.5819475", "0.57913166", "0.57682115", "0.5766263", "0.5760604", "0.5745013", "0.5726...
0.5444301
53
Utility to transform quaternion series functions to a quaternion function.
def qs_qs_to_q_function(func: FunctionType, q_1: Qs, q_2: Qs) -> Q: scalar = func(q_1, q_2) if scalar.qs_type != "scalar_q": raise Exception(f"Oops, does not evaluate to a scalar: {scalar}") return scalar.qs[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quat2transform(q):\n x, y, z, w = q\n xx2 = 2 * x * x\n yy2 = 2 * y * y\n zz2 = 2 * z * z\n xy2 = 2 * x * y\n wz2 = 2 * w * z\n zx2 = 2 * z * x\n wy2 = 2 * w * y\n yz2 = 2 * y * z\n wx2 = 2 * w * x\n\n rmat = np.empty((3, 3), float)\n rmat[0,0] = 1. - yy2 - zz2\n rmat[0,1...
[ "0.65554875", "0.6296953", "0.6283742", "0.6170736", "0.6120653", "0.60778403", "0.5983986", "0.5957472", "0.59477943", "0.5895493", "0.58823514", "0.58788633", "0.58645964", "0.58453166", "0.5819475", "0.57913166", "0.57682115", "0.5766263", "0.5760604", "0.5745013", "0.5726...
0.5408319
58
Returns the scalar_q part of a quaternion as a quaternion. $ \rm{scalar_q(q)} = (q + q^)/2 = (t, 0) $
def scalar_q(q_1: Q) -> Q: end_q_type = f"scalar_q({q_1.q_type})" s = Q([q_1.t, 0, 0, 0], q_type=end_q_type, representation=q_1.representation) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quatreal(q):\n a = q[0,0]\n b = q[0,1]\n c = q[0,2]\n d = q[0,3]\n amat = a*np.identity(4)\n bmat = b*np.array([[0,1,0,0],[-1,0,0,0],[0,0,0,-1],[0,0,1,0]])\n cmat = c*np.array([[0,0,1,0],[0,0,0,1],[-1,0,0,0],[0,-1,0,0]])\n dmat = d*np.array([[0,0,0,1],[0,0,-1,0],[0,1,0,0],[-1,0,0,0]])\n...
[ "0.717215", "0.71252763", "0.7085677", "0.68149334", "0.6790606", "0.67434067", "0.6703528", "0.6591438", "0.65540475", "0.63793147", "0.62942255", "0.62499434", "0.6232498", "0.6217254", "0.6167394", "0.61596555", "0.61083883", "0.6020081", "0.60105115", "0.59995216", "0.599...
0.767325
0
Return a zero quaternion. $ q\_0() = 0 = (0, 0) $
def q0(q_type: str = "0", representation: str = "") -> Q: return Q([0, 0, 0, 0], q_type=q_type, representation=representation)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero() -> Quaternion:\n return Quaternion(0, np.array([0, 0, 0]))", "def qzero_like(qobj):\n from .cy.qobjevo import QobjEvo\n if isinstance(qobj, QobjEvo):\n qobj = qobj(0)\n return Qobj(\n _data.zeros_like(qobj.data), dims=qobj.dims, type=qobj.type,\n superrep=qobj.supe...
[ "0.857457", "0.7198851", "0.6935834", "0.6877154", "0.6855088", "0.6625694", "0.6423152", "0.64208454", "0.6408899", "0.631035", "0.6303581", "0.6267747", "0.62498343", "0.62418693", "0.6224846", "0.62101185", "0.6110579", "0.60706556", "0.60494864", "0.6038135", "0.602128", ...
0.7035556
2
Return a realvalued quaternion multiplied by n. $ q\_1(n) = n = (n, 0) $
def q1(n: float = 1.0, q_type: str = "1", representation: str = "") -> Q: return Q([n, 0, 0, 0], q_type=q_type, representation=representation)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quatreal(q):\n a = q[0,0]\n b = q[0,1]\n c = q[0,2]\n d = q[0,3]\n amat = a*np.identity(4)\n bmat = b*np.array([[0,1,0,0],[-1,0,0,0],[0,0,0,-1],[0,0,1,0]])\n cmat = c*np.array([[0,0,1,0],[0,0,0,1],[-1,0,0,0],[0,-1,0,0]])\n dmat = d*np.array([[0,0,0,1],[0,0,-1,0],[0,1,0,0],[-1,0,0,0]])\n...
[ "0.7521747", "0.6882829", "0.6801781", "0.66688246", "0.6667387", "0.6613043", "0.65514314", "0.6518592", "0.65183645", "0.64424217", "0.64181757", "0.6355957", "0.63497275", "0.63067836", "0.6286795", "0.62692976", "0.62481505", "0.6223839", "0.6215716", "0.6203606", "0.6170...
0.6954427
1
Return a quaternion with $ i n $. $ q\_i(n) = n i = (0, n i) $
def qi(n: float = 1.0, q_type: str = "i", representation: str = "") -> Q: return Q([0, n, 0, 0], q_type=q_type, representation=representation)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quatreal(q):\n a = q[0,0]\n b = q[0,1]\n c = q[0,2]\n d = q[0,3]\n amat = a*np.identity(4)\n bmat = b*np.array([[0,1,0,0],[-1,0,0,0],[0,0,0,-1],[0,0,1,0]])\n cmat = c*np.array([[0,0,1,0],[0,0,0,1],[-1,0,0,0],[0,-1,0,0]])\n dmat = d*np.array([[0,0,0,1],[0,0,-1,0],[0,1,0,0],[-1,0,0,0]])\n...
[ "0.7798379", "0.7256524", "0.71169364", "0.6974901", "0.69720376", "0.69220084", "0.69177634", "0.69116133", "0.6846539", "0.6837501", "0.6780964", "0.6780964", "0.67560273", "0.6707586", "0.66808885", "0.6651122", "0.66359764", "0.66078216", "0.6581401", "0.6517365", "0.6496...
0.6898428
8
Return a quaternion with $ j n $. $ q\_j(n) = n j = (0, n j) $
def qj(n: float = 1.0, q_type: str = "j", representation: str = "") -> Q: return Q([0, 0, n, 0], q_type=q_type, representation=representation)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quatreal(q):\n a = q[0,0]\n b = q[0,1]\n c = q[0,2]\n d = q[0,3]\n amat = a*np.identity(4)\n bmat = b*np.array([[0,1,0,0],[-1,0,0,0],[0,0,0,-1],[0,0,1,0]])\n cmat = c*np.array([[0,0,1,0],[0,0,0,1],[-1,0,0,0],[0,-1,0,0]])\n dmat = d*np.array([[0,0,0,1],[0,0,-1,0],[0,1,0,0],[-1,0,0,0]])\n...
[ "0.74863", "0.69811416", "0.694357", "0.6844857", "0.6835749", "0.6835749", "0.6830955", "0.6802375", "0.675877", "0.67521226", "0.67171556", "0.6712101", "0.6684766", "0.66334873", "0.66085315", "0.6608401", "0.660655", "0.65806353", "0.6553026", "0.6525411", "0.65198517", ...
0.6998271
1
Tests if q1 and q_2 quaternions are close to equal. If vector_q is set to False, will compare only the scalar_q. If scalar_q is set to False, will compare 3vectors. $ q.equal(q\_2) = q == q\_2 = True $
def equal(q_1: Q, q_2: Q, scalar: bool = True, vector: bool = True) -> bool: q_1.check_representations(q_2) q_1_t, q_1_x, q_1_y, q_1_z = ( sp.expand(q_1.t), sp.expand(q_1.x), sp.expand(q_1.y), sp.expand(q_1.z), ) q_2_t, q_2_x, q_2_y, q_2_z = ( sp.expand(q_2.t), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_same_quaternion(q0, q1):\r\n q0 = numpy.array(q0)\r\n q1 = numpy.array(q1)\r\n return numpy.allclose(q0, q1) or numpy.allclose(q0, -q1)", "def quat_diff(q1, q2):\n q1 = np.asarray(q1)\n if np.dot(q1, q2) < 0:\n # Quaternions have opposite handedness, flip q1 since it's already an nda...
[ "0.76702076", "0.682529", "0.67538345", "0.6682755", "0.66737276", "0.65974015", "0.6562964", "0.6520759", "0.6492502", "0.6410654", "0.64059484", "0.6389305", "0.6345217", "0.6300591", "0.6252963", "0.62419194", "0.621168", "0.6203158", "0.6201494", "0.61856306", "0.6184245"...
0.82517725
0
All products, commuting and anticommuting products as a dictionary. For internal use.
def _all_products(q_1: Q, q_2: Q) -> Dict: all_dict = _commuting_products(q_1, q_2) all_dict.update(_anti_commuting_products(q_1, q_2)) return all_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products_dict(products):\n # lang = get_language()[:2]\n lang = ''\n products_dict = {}\n try:\n if products and products[0].get('source') == 'greedy':\n for product in products:\n key = product['name']\n products_dict[key] = products_dict.get(key...
[ "0.71844846", "0.68288", "0.67625904", "0.660549", "0.65869725", "0.6579608", "0.6419453", "0.6417805", "0.64040154", "0.62374485", "0.61897355", "0.6128711", "0.60962653", "0.6074124", "0.6065237", "0.60371697", "0.6031735", "0.6006508", "0.5995897", "0.59792846", "0.5974384...
0.76783925
0
Given a quaternion series, returns an orthonormal basis.
def orthonormalize(self: Qs) -> Qs: last_q = self.qs.pop(0).normalize(math.sqrt(1 / self.dim), ) orthonormal_qs = [last_q] for q in self.qs: qp = product(conj(q), last_q) orthonormal_q = normalize(dif(q, qp), math.sqrt(1 / self.dim), ) orthonormal_qs.append(orthonormal_q) l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invert_quaternion(quaternion):\n norm = np.linalg.norm(quaternion)\n quaternion[1:] = -1.0 * quaternion[1:]\n return quaternion / norm", "def quaternion_inv(quaternion):\r\n q = numpy.array(quaternion, dtype=numpy.float64, copy=True)\r\n numpy.negative(q[1:], q[1:])\r\n return q / numpy.dot...
[ "0.6208364", "0.6161251", "0.60390615", "0.58623403", "0.58344173", "0.5829891", "0.5811015", "0.5793587", "0.5782253", "0.57772124", "0.57660985", "0.5697357", "0.5688721", "0.5680396", "0.5614574", "0.5610573", "0.55925995", "0.5582461", "0.55633867", "0.5558345", "0.550302...
0.58097345
7
The absolute value of the vector_q, the square root of the norm_squared of the vector_q. $ q.abs_of_vector() = \sqrt{(q\_1 q\_1^)(q\_1 q\_1^)/4} = (\sqrt{R.R}, 0) $
def abs_of_vector(q_1: Q) -> Q: end_q_type = f"|V({q_1.q_type})|" av = norm_squared_of_vector(q_1) sqrt_t = av.t ** (1 / 2) av.t = sqrt_t av.representation = q_1.representation av.q_type = end_q_type return av
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm_squared_of_vector(q_1: Q):\n\n end_q_type = f\"|V({q_1.q_type})|²\"\n\n qxq = _commuting_products(q_1, q_1)\n\n nv_q = Q(q_type=end_q_type, representation=q_1.representation)\n nv_q.t = qxq[\"xx+yy+zz\"]\n\n return nv_q", "def magnitude_of_vector(v):\n return math.sqrt(sum_of_squares(v...
[ "0.7167906", "0.6757346", "0.6741619", "0.66816074", "0.6628338", "0.66203743", "0.6553449", "0.6508252", "0.64899415", "0.6487914", "0.64693314", "0.6375257", "0.63640314", "0.6312741", "0.6304442", "0.62795985", "0.62677765", "0.62397444", "0.62322617", "0.62240183", "0.621...
0.7865251
0
Forms the quaternion product for each state. The details for handling the variety of cases for lengths of rows, states, and operators makes this code the most complex in this library.
def products(q_1: Qs, q_2: Qs, kind: str = "", reverse: bool = False) -> Qs: q_1_copy = deepcopy(q_1) q_2_copy = deepcopy(q_2) qs_left, qs_right = Qs(), Qs() # Diagonalize if need be. if ((q_1.rows == q_2.rows) and (q_1.columns == q_2.columns)) or ( "scalar_q" in [q_1.qs_type, q_2.qs_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quatreal(q):\n a = q[0,0]\n b = q[0,1]\n c = q[0,2]\n d = q[0,3]\n amat = a*np.identity(4)\n bmat = b*np.array([[0,1,0,0],[-1,0,0,0],[0,0,0,-1],[0,0,1,0]])\n cmat = c*np.array([[0,0,1,0],[0,0,0,1],[-1,0,0,0],[0,-1,0,0]])\n dmat = d*np.array([[0,0,0,1],[0,0,-1,0],[0,1,0,0],[-1,0,0,0]])\n...
[ "0.62322927", "0.6051086", "0.6051086", "0.6009166", "0.60064405", "0.5782727", "0.56831545", "0.5682501", "0.5617213", "0.56117606", "0.5596163", "0.5593366", "0.55868787", "0.5558347", "0.5546437", "0.5527421", "0.5494381", "0.54865175", "0.54483265", "0.5425174", "0.539799...
0.52673453
37
The method for doing a rotation in 3D space discovered by Rodrigues in the 1840s used a quaternion triple product. After Minkowski characterized Einstein's work in special relativity as a 4D rotation, efforts were made to do the same with one quaternion triple product. Two people were able to do the trick with complexv...
def rotation_and_or_boost(q_1: Q, h: Q, verbose=False) -> Q: q_1.check_representations(h) end_q_type = f"{q_1.q_type}rotation/boost" if not h.is_symbolic(): if (not math.isclose(h.t, 0) and not equal(q0(), vector_q(h))) or equal(h, q0()): if not math.isclose(square(h).t, 1): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quaternion2rot3d(quat):\n q01 = quat[0] * quat[1]\n q02 = quat[0] * quat[2]\n q03 = quat[0] * quat[3]\n q11 = quat[1] * quat[1]\n q12 = quat[1] * quat[2]\n q13 = quat[1] * quat[3]\n q22 = quat[2] * quat[2]\n q23 = quat[2] * quat[3]\n q33 = quat[3] * quat[3]\n\n # Obtain the rotati...
[ "0.75289774", "0.71448755", "0.70329356", "0.69880587", "0.6938521", "0.68504506", "0.68383646", "0.6833967", "0.66445416", "0.6613585", "0.66107804", "0.6602442", "0.6582722", "0.6577267", "0.6550019", "0.6540202", "0.6508703", "0.65000266", "0.64974034", "0.648309", "0.6475...
0.0
-1
Given 2 quaternions, creates a new quaternion to do a rotation in the triple triple quaternion function by using a normalized cross product. To assure that repeated calls cover the sphere, multiply by a random factor.
def next_rotation_randomized(q_1: Q, q_2: Q) -> Q: q_1.check_representations(q_2) if not math.isclose(q_1.t, q_2.t): raise ValueError(f"Oops, to be a rotation, the first values must be the same: {q_1.t} != {q_2.t}") if not math.isclose(norm_squared(q_1).t, norm_squared(q_2).t): raise Value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_quaternion_rotation_consistent_with_multiplication():\n random_state = np.random.RandomState(1)\n for _ in range(5):\n v = pr.random_vector(random_state)\n q = pr.random_quaternion(random_state)\n v_im = np.hstack(((0.0,), v))\n qv_mult = pr.concatenate_quaternions(\n ...
[ "0.70592076", "0.6883676", "0.6820069", "0.6783644", "0.67098737", "0.67028195", "0.66328484", "0.6582449", "0.65420824", "0.64483", "0.6422524", "0.64155704", "0.6331616", "0.6327634", "0.63138086", "0.62226886", "0.6184733", "0.617074", "0.6156372", "0.6147959", "0.6127897"...
0.61131823
21
Given 2 quaternions, creates a new quaternion to do a boost/rotation using the triple triple quaternion product by using the scalar_q of an even product to form (cosh(x), i sinh(x)). $ next_boost(q, q_2) = q q\_2 + q\_2 q
def next_boost(q_1: Q, q_2: Q) -> Q: q_1.check_representations(q_2) if not (q_1.t >= 1.0 and q_2.t >= 1.0): raise ValueError(f"Oops, to be a boost, the first values must both be greater than one: {q_1.t}, {q_2.t}") if not math.isclose(square(q_1).t, square(q_2).t): raise ValueError(f"Oops...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_and_or_boost(q_1: Q, h: Q, verbose=False) -> Q:\n q_1.check_representations(h)\n end_q_type = f\"{q_1.q_type}rotation/boost\"\n\n if not h.is_symbolic():\n\n if (not math.isclose(h.t, 0) and not equal(q0(), vector_q(h))) or equal(h, q0()):\n\n if not math.isclose(square(h).t...
[ "0.72395223", "0.6804851", "0.6801011", "0.6698621", "0.666588", "0.662718", "0.6601146", "0.6484366", "0.63255465", "0.62989676", "0.61446613", "0.6105331", "0.60643524", "0.5894326", "0.5886501", "0.58668226", "0.58362406", "0.573688", "0.5671994", "0.56676805", "0.5632296"...
0.6805635
1
Returns all permutations as a quaternion series. Can be made unique.
def all_permutations(q_1: Q) -> Qs: results = [] for perm in itertools.permutations("txyz"): results.append(permutation(q_1, perm=perm)) return Qs(results)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_q(self, method: str = 'chiaverini', **kw) -> np.ndarray:\n return self.to_quaternion(method=method, **kw)", "def quatreal(q):\n a = q[0,0]\n b = q[0,1]\n c = q[0,2]\n d = q[0,3]\n amat = a*np.identity(4)\n bmat = b*np.array([[0,1,0,0],[-1,0,0,0],[0,0,0,-1],[0,0,1,0]])\n cmat = ...
[ "0.62859166", "0.6236495", "0.61805236", "0.6156702", "0.6146067", "0.605096", "0.6009002", "0.5941925", "0.5940175", "0.59393823", "0.5923452", "0.58531964", "0.5847137", "0.58404344", "0.5831987", "0.5807379", "0.5807379", "0.5800481", "0.5800481", "0.5767766", "0.5738827",...
0.63913
0
Shift an observation based on a dimensionless GM/c^2 dR.
def g_shift(q_1: Q, dimensionless_g, g_form="exp"): end_q_type = f"{q_1.q_type} gshift" if g_form == "exp": g_factor = sp.exp(dimensionless_g) elif g_form == "minimal": g_factor = 1 + 2 * dimensionless_g + 2 * dimensionless_g ** 2 else: print("g_form not defined, should be 'exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift(self, da, dim, shift):\n # TODO: generalize rolling function, allow custom shifts, handle\n # boundary conditions, etc.\n return da.roll(**{dim: shift})", "def shift(self, g, d, n):\n return g[n:] + g[:n], d[n:] + d[:n]", "def shift(self, ds):\n p = np.array(self.Ge...
[ "0.6679757", "0.6243065", "0.6199622", "0.59737504", "0.58980966", "0.587591", "0.58522874", "0.5799389", "0.5778618", "0.57204634", "0.57198524", "0.5691801", "0.5676666", "0.56053025", "0.55712456", "0.5566595", "0.5487443", "0.5487311", "0.54213893", "0.5420869", "0.538255...
0.0
-1
Take the exponential of a quaternion. $ q.exp() = (\exp(t) \cos(|R|, \exp(t) \sin(|R|) R/|R|) $
def exp(q_1: Q) -> Q: end_q_type = f"exp({q_1.q_type})" abs_v = abs_of_vector(q_1) et = math.exp(q_1.t) if abs_v.t == 0: return Q([et, 0, 0, 0], q_type=end_q_type, representation=q_1.representation) cosR = math.cos(abs_v.t) sinR = math.sin(abs_v.t) k = et * sinR / abs_v.t q_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp(cls, q):\n tolerance = 1e-17\n v_norm = np.linalg.norm(q.vector)\n vec = q.vector\n if v_norm > tolerance:\n vec = vec / v_norm\n magnitude = exp(q.scalar)\n return Quaternion(scalar = magnitude * cos(v_norm), vector = magnitude * sin(v_norm) * vec)", ...
[ "0.81771994", "0.7597778", "0.72476107", "0.71873426", "0.7081528", "0.70164", "0.6970375", "0.65774494", "0.65312207", "0.65231395", "0.6463936", "0.6382586", "0.6357746", "0.6302652", "0.6239572", "0.6238405", "0.6204436", "0.6194309", "0.61632216", "0.6157842", "0.6126599"...
0.7778536
1
Tests if a series is Hermitian.
def is_Hermitian(q_1: Qs) -> bool: hc = Hermitian_conj(q_1, q_1.rows, q_1.columns) return equals(q_1, hc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_hermitian(self, eps = 0):\n return (self - self.hc()).absmax() <= eps", "def is_hermitian(self):\n return self.args[0].is_hermitian()", "def is_hermitian(self):\n return False # by default, solvers are non-Hermitian", "def IsHermitian(self):\n \n Hermitian=True\n ...
[ "0.6984844", "0.69657934", "0.6958487", "0.66933256", "0.61677265", "0.6133391", "0.6120859", "0.6048154", "0.60093164", "0.5919004", "0.58672166", "0.58102256", "0.574486", "0.57302445", "0.57079214", "0.56296575", "0.56296575", "0.5525307", "0.55209273", "0.5507452", "0.542...
0.6721774
3
Make a state dim dim with q or qs along the 'diagonal'. Always returns an operator.
def diagonal(q_1: Qs, dim: int) -> Qs: the_diagonal = [] if len(q_1.qs) == 1: q_values = [q_1.qs[0]] * dim elif len(q_1.qs) == dim: q_values = q_1.qs elif q_1.qs is None: raise ValueError("Oops, the qs here is None.") else: raise ValueError("Oops, need the length to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal(d, axis=0):\n assert d.ndim == 1\n n = d.shape[0]\n times = lambda x: d * x\n trans = lambda x: _hermitian(d) * x\n times, trans = apply_along_axis(times, trans, axis)\n return Operator(times=times, trans=trans, shape=(n,n))", "def qdiags(diagonals, offsets=None, dims=None, shape=N...
[ "0.59706414", "0.5862557", "0.5807918", "0.5789221", "0.56782097", "0.5673857", "0.5599533", "0.55487275", "0.54673314", "0.5379068", "0.53330135", "0.53220415", "0.5314008", "0.5264948", "0.52278036", "0.5189053", "0.51831144", "0.517409", "0.5139516", "0.51315624", "0.51173...
0.64012635
0
Return the trace as a scalar_q quaternion series.
def trace(q_1: Qs) -> Qs: if q_1.rows != q_1.columns: raise ValueError(f"Oops, not a square quaternion series: {q_1.rows}/{q_1.columns}") else: tr = q_1.qs[0] for i in range(1, q_1.rows): tr = add(tr, q_1.qs[i * (q_1.rows + 1)]) return Qs([tr])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quatreal(q):\n a = q[0,0]\n b = q[0,1]\n c = q[0,2]\n d = q[0,3]\n amat = a*np.identity(4)\n bmat = b*np.array([[0,1,0,0],[-1,0,0,0],[0,0,0,-1],[0,0,1,0]])\n cmat = c*np.array([[0,0,1,0],[0,0,0,1],[-1,0,0,0],[0,-1,0,0]])\n dmat = d*np.array([[0,0,0,1],[0,0,-1,0],[0,1,0,0],[-1,0,0,0]])\n...
[ "0.6993904", "0.68892056", "0.68086374", "0.67782146", "0.6755165", "0.6257342", "0.6237571", "0.61933625", "0.61874753", "0.6073178", "0.60701495", "0.60665095", "0.6051848", "0.6041605", "0.6040673", "0.6040085", "0.60359335", "0.6033472", "0.6027379", "0.5964323", "0.59337...
0.6756054
4
Puts a zero in one or more of the four places.
def zero_out(q_1: Q, t: bool = False, x: bool = False, y: bool = False, z: bool = False) -> Q: new_q = deepcopy(q_1) if t: new_q.t = 0 if x: new_q.x = 0 if y: new_q.y = 0 if z: new_q.z = 0 return new_q
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeroPad(numberString, zeros, left = True):\n for i in range(zeros):\n if left:\n numberString = '0' + numberString\n else:\n numberString = numberString + '0'\n return numberString", "def add_zeros(zipcode):\n return '0' * (5 - len(zipcode)) + zipcode", "def add...
[ "0.6647017", "0.6278069", "0.6278069", "0.6237634", "0.60879666", "0.6086591", "0.6069621", "0.6059842", "0.6047781", "0.60457253", "0.600575", "0.6000682", "0.59299487", "0.5881821", "0.584906", "0.5836479", "0.58116835", "0.58069575", "0.57998055", "0.5799315", "0.57892287"...
0.0
-1
One quaternion cannot tell a story. generate_QQs provides a general way to create a quaternion series given a function and two other quaternions/functions. The function is applied to each subsequent value of the function. If q_1 or q_2 is itself a function, it will be called each time. This function was written for the...
def generate_QQs(func, q_1: Union[Q, Qs, FunctionType], q_2: Union[Q, Qs, FunctionType], dim: int = 10, qs_type: str = "ket") -> Qs: if (type(q_1) == Q) and (type(q_2) == Q): new_qs = [func(q_1, q_2)] for _ in range(dim - 1): new_qs.append(func(new_qs[-1], q_2)) elif ((type(q_1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_Qs(func: FunctionType, q_1: Union[Q, Qs, FunctionType], dim: int = 10, qs_type: str = \"ket\") -> Qs:\n\n if type(q_1) == Q:\n new_qs = [func(q_1)]\n\n for _ in range(dim - 1):\n new_qs.append(func(new_qs[-1]))\n\n elif type(q_1) == Qs:\n new_qs = q_1.qs\n\n el...
[ "0.72977334", "0.7151165", "0.70990133", "0.6716457", "0.65685415", "0.64292264", "0.6414638", "0.63871956", "0.6379296", "0.6345492", "0.62507963", "0.6236191", "0.62279254", "0.6103509", "0.6085932", "0.6056096", "0.5960466", "0.5949796", "0.5913844", "0.58967113", "0.58898...
0.7726626
0
Map get_scaling_factor to an iterable of Pyomo components, and get the minimum scaling factor.
def min_scaling_factor(components, default=1, warning=True, hint=None): return map_scaling_factor( components, default=default, warning=warning, func=min, hint=hint )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_scaling_factor(components, default=1, warning=False, func=min, hint=None):\n return func(\n map(\n lambda x: get_scaling_factor(\n x, default=default, warning=warning, hint=hint\n ),\n components,\n )\n )", "def scale_quantity_gen(stock_...
[ "0.66975385", "0.62198126", "0.61575323", "0.5954587", "0.5935592", "0.5853562", "0.5813986", "0.5813986", "0.5610619", "0.5591579", "0.55654174", "0.55492085", "0.5508268", "0.54814416", "0.54364556", "0.54269034", "0.54132116", "0.53932166", "0.5385479", "0.5347045", "0.534...
0.71901256
0
Checks whether a scaling factor exists for a component, sets the scaling factor if it doesn't exist, then returns the scaling factor on the component (which is the default value if it wasn't set originally).
def set_and_get_scaling_factor(c, default, warning=False, exception=False, hint=None): if c.is_indexed(): raise AttributeError( f"Ambiguous which scaling factor to return for indexed component {c.name}." ) sf = get_scaling_factor(c, warning=warning, exception=exception, hint=hint) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scaling_factor(c, default=None, warning=False, exception=False, hint=None):\n try:\n sf = c.parent_block().scaling_factor[c]\n except (AttributeError, KeyError):\n if not isinstance(c, (pyo.Param, _ParamData)):\n if hint is None:\n h = \"\"\n else:\n...
[ "0.6981034", "0.6870924", "0.68532175", "0.6702471", "0.6652382", "0.6164827", "0.61411226", "0.60545605", "0.5901884", "0.5896981", "0.5881751", "0.5827386", "0.58061856", "0.58061117", "0.5799844", "0.5764372", "0.5727742", "0.56283545", "0.55919677", "0.55786616", "0.55406...
0.7231372
0
Get the condition number of the scaled or unscaled Jacobian matrix of a model.
def jacobian_cond(m=None, scaled=True, order=None, pinv=False, jac=None): if jac is None: jac, nlp = get_jacobian(m, scaled) # pylint: disable=unused-variable jac = jac.tocsc() if jac.shape[0] != jac.shape[1] and not pinv: _log.warning("Nonsquare Jacobian using pseudo inverse") pinv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _condition_number(self):\n ev = np.linalg.eig(np.matmul(self.x.swapaxes(-2, -1), self.x))[0]\n return np.sqrt(ev.max(axis=1) / ev.min(axis=1))", "def condition_number(self):\n return self._condition_number", "def _get_params(model):\n return model.coefs.shape[0]", "def get_active_...
[ "0.6870535", "0.62093955", "0.554546", "0.5533118", "0.54135406", "0.53102195", "0.5264093", "0.5191693", "0.5119608", "0.51145804", "0.50887513", "0.5083704", "0.5067496", "0.50660807", "0.5054505", "0.50435746", "0.50100577", "0.50001043", "0.4989965", "0.49897817", "0.4987...
0.5331519
5
Returns the length of the representation data.
def __len__(self): return self._vector.degree()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self) -> int:\n if self.serialize_data:\n return len(self.data_address)\n else:\n return len(self.data_infos)", "def getLen(self):\n return len(self.data)", "def length(self):\n return len(self.data)", "def length(self):\n return len(self.d...
[ "0.84285057", "0.84224397", "0.8306152", "0.8306152", "0.8306152", "0.8246603", "0.8228574", "0.81836927", "0.8140855", "0.80608314", "0.80348", "0.80348", "0.80348", "0.8022426", "0.8022426", "0.8007244", "0.79690796", "0.7964973", "0.7964973", "0.7964973", "0.7964973", "0...
0.0
-1
Compare two representation objects They are equal if and only if they define the same vertex/ray/line or inequality/equation in the ambient space, regardless of the polyhedron that they belong to.
def __cmp__(self, other): if not isinstance(other, PolyhedronRepresentation): return -1 return cmp(type(self), type(other)) or cmp(self._vector, other._vector)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if self.__class__ != other.__class__:\n return False\n return self.mesh == other.mesh and \\\n npw.equal(self.shape, other.shape).all() and \\\n self.domain == other.domain", "def __eq__(self, other):\n return (self.vertices == othe...
[ "0.70931184", "0.707725", "0.6997339", "0.693597", "0.6831588", "0.67984223", "0.6754586", "0.6686086", "0.66633564", "0.66520786", "0.66215545", "0.6593427", "0.65858656", "0.6584871", "0.6561854", "0.6545514", "0.6541163", "0.6522954", "0.6516866", "0.6471603", "0.64689296"...
0.650891
19
r""" Returns the coefficient vector `A` in `A\vec{x}+b`.
def A(self): return self._A
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acoeff(self):\n return np.dot(self.mmi,np.dot(self.mmatrix.T,self.bvec))", "def coefA(x0,y0,x1,y1):\n return -(y1-y0)/(x1-x0)", "def scalar_vector_ext(alpha, v, a, b):\n return [alpha * v[0],\n alpha * v[0] * a + b]", "def coefC(x0,y0,x1,y1):\n return (x1*y0-x0*y1)/(x1-x0)", ...
[ "0.6487584", "0.6200551", "0.61877954", "0.60225594", "0.5954652", "0.59371483", "0.5923177", "0.58879757", "0.5877291", "0.5840082", "0.58288395", "0.580525", "0.5791447", "0.5781102", "0.57738835", "0.57735187", "0.5767798", "0.5755862", "0.57530284", "0.5749266", "0.573391...
0.0
-1
r""" Returns the constant `b` in `A\vec{x}+b`.
def b(self): return self._b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constant_equation(funct):\n return funct + \"x\"", "def loc_eval(x, b):\r\n loc_est = 0\r\n for i in enumerate(b): loc_est+=i[1]*(x**i[0])\r\n return(loc_est)", "def get_b(self):\n return ((self.b_plus_bstar / self.n_pos) + (self.b_minus_bstar / self.n_neg)) / 2", "def _vB0(self,x):\n ...
[ "0.60010844", "0.5991505", "0.59718937", "0.59611386", "0.58366007", "0.57271534", "0.5716266", "0.5657437", "0.56378216", "0.5630788", "0.56223536", "0.56185055", "0.55930847", "0.55581474", "0.55565435", "0.55104935", "0.5507975", "0.5502621", "0.5496439", "0.548395", "0.54...
0.0
-1
Returns a generator for the incident Hrepresentation objects, that is, the vertices/rays/lines satisfying the (in)equality.
def incident(self): incidence_matrix = self.polyhedron().incidence_matrix() for V in self.polyhedron().Vrep_generator(): if incidence_matrix[V.index(), self.index()] == 1: yield V
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inequality_generator(self):\n for H in self.Hrepresentation():\n if H.is_inequality():\n yield H", "def incident(self):\n incidence_matrix = self.polyhedron().incidence_matrix()\n for H in self.polyhedron().Hrep_generator():\n if incidence_matrix[self...
[ "0.7777177", "0.7013645", "0.7013645", "0.6560997", "0.63826954", "0.5790397", "0.5778307", "0.5750455", "0.5736811", "0.5733838", "0.5695189", "0.56856066", "0.56191826", "0.55779564", "0.55004585", "0.5490121", "0.54790866", "0.54151535", "0.5406401", "0.5406401", "0.537942...
0.6664428
3
Returns True since this is, by construction, an inequality.
def is_inequality(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return self <= other and self >= other", "def __eq__(self, other):\n return abs(self - other) < 10e-10", "def __eq__(self, other: 'LTL'):\n if self.formula == other.formula:\n return True\n implied_a = self >= other\n implied_b = self <= ...
[ "0.73918694", "0.7246016", "0.71810424", "0.7138526", "0.7128823", "0.70941985", "0.69961643", "0.6971562", "0.6922299", "0.6922299", "0.6914022", "0.6906384", "0.6903671", "0.6885709", "0.68856484", "0.6867292", "0.68635046", "0.6863378", "0.6847223", "0.6829796", "0.6824519...
0.0
-1
Tests whether the halfspace (including its boundary) defined by the inequality contains the given vertex/ray/line.
def contains(self, Vobj): try: if Vobj.is_vector(): # assume we were passed a point return self.polyhedron()._is_nonneg( self.eval(Vobj) ) except AttributeError: pass if Vobj.is_line(): return self.polyhedron()._is_zero( self.eval(Vobj) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, line):\n \n return abs( 1 - np.dot(sm.unitvec(self.vec), sm.unitvec(line.vec))) < 10*_eps", "def has_vertex(self, x, y):\n\n return min(x, y) > 0 and x <= self.width and y <= self.height", "def isOnInteriorSide(self, v):\n n = self.normalVect()\n return n.dot...
[ "0.6536128", "0.6496033", "0.6494047", "0.6335195", "0.6320186", "0.6274402", "0.62453073", "0.6225817", "0.621746", "0.6181447", "0.613335", "0.613335", "0.612196", "0.61027455", "0.61023873", "0.6089343", "0.60530204", "0.6048497", "0.6034406", "0.6032514", "0.6025317", "...
0.0
-1
Tests whether the interior of the halfspace (excluding its boundary) defined by the inequality contains the given vertex/ray/line.
def interior_contains(self, Vobj): try: if Vobj.is_vector(): # assume we were passed a point return self.polyhedron()._is_positive( self.eval(Vobj) ) except AttributeError: pass if Vobj.is_line(): return self.polyhedron()._is_zero( self.eval(V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interior_contains(self, Vobj):\n try:\n if Vobj.is_vector(): # assume we were passed a point\n return self.polyhedron()._is_positive( self.eval(Vobj) ) \n except AttributeError:\n pass\n \n if Vobj.is_line(): \n return self.pol...
[ "0.6856249", "0.68367535", "0.6756498", "0.6495758", "0.63621867", "0.63452864", "0.63452864", "0.6317414", "0.6298225", "0.6240851", "0.6224518", "0.6204938", "0.60850036", "0.60743046", "0.60278106", "0.60268193", "0.60267866", "0.59926176", "0.59926176", "0.5988038", "0.59...
0.67429256
3
A string representation of this object.
def _repr_(self): s = 'An equation ' have_A = not self.A().is_zero() if have_A: s += repr(self.A()) + ' x ' if self.b()>=0: if have_A: s += '+' else: s += '-' if have_A: s += ' ' s += repr(abs(self.b(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n\n\t\treturn str(self)", "def serialize(self):\n\n return str(self)", "def as_string(self):\n return self.__repr__()", "def to_string(self):\r\n return self.__str__()", "def __str__(self):\n return str(self.serialize())", "def __repr__(self) -> str:\n ...
[ "0.8800803", "0.87775826", "0.87286794", "0.86172676", "0.8576114", "0.85605913", "0.85497683", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315", "0.8507315"...
0.0
-1
Tests whether the interior of the halfspace (excluding its boundary) defined by the inequality contains the given vertex/ray/line.
def interior_contains(self, Vobj): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interior_contains(self, Vobj):\n try:\n if Vobj.is_vector(): # assume we were passed a point\n return self.polyhedron()._is_positive( self.eval(Vobj) ) \n except AttributeError:\n pass\n \n if Vobj.is_line(): \n return self.pol...
[ "0.6856249", "0.68367535", "0.6756498", "0.67429256", "0.6495758", "0.63621867", "0.63452864", "0.63452864", "0.6317414", "0.6298225", "0.6240851", "0.6224518", "0.6204938", "0.60850036", "0.60743046", "0.60278106", "0.60268193", "0.60267866", "0.5988038", "0.5979449", "0.597...
0.59926176
18
Returns True if the object is a line of the Vrepresentation. This method is overridden by the corresponding method in the derived class Line.
def is_line(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_line(self):\n return True", "def is_line(self):\n return True", "def _isLine(self):\n return (self.width == 0 and self.height > 1) or (self.height == 0 and self.width > 1)", "def _isLine(self):\n return (self.width == 0 and self.height > 1) or (self.height == 0 and self.wid...
[ "0.7388121", "0.7388121", "0.73410785", "0.73410785", "0.7011581", "0.6722692", "0.6676307", "0.6624805", "0.6534737", "0.6346986", "0.63411146", "0.63411146", "0.6264687", "0.6248591", "0.6223669", "0.61652696", "0.61327696", "0.6091249", "0.60201836", "0.6014802", "0.601480...
0.7129625
4
Tests if this object is a ray. Always True by construction.
def is_ray(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ray(self):\n return False", "def is_ray(self): \n return False", "def is_intersecting(self, ray):\n\n intersecting_point = self._sympy_plane.intersection(ray.sympy_line)[0]\n\n if 'x' in self._name:\n\n if self._within_y_bounds(intersecting_point.y) and self...
[ "0.76152766", "0.7405027", "0.62074465", "0.62074393", "0.6090226", "0.5951388", "0.5738135", "0.56904054", "0.5686524", "0.55778086", "0.55746454", "0.55088705", "0.54987615", "0.54564613", "0.5426838", "0.5402613", "0.54001117", "0.5375659", "0.53559256", "0.53277266", "0.5...
0.7633362
0
Return homogeneous coordinates for this ray. Since a ray is given by a direction, this is the vector with a 0 appended.
def homogeneous_vector(self, base_ring=None): v = list(self._vector) + [0] return vector(base_ring or self._base_ring, v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector(self) -> Vector:\n return self._normal * self._distance_from_origin", "def normalized(self):\n len = self.length\n return Vector(self.x / len, self.y / len)", "def normalize(self):\n return Vector(self.args + []) / self.magnitude()", "def direction(self):\n len =...
[ "0.674088", "0.6487137", "0.636597", "0.6308724", "0.6288384", "0.6276714", "0.6189621", "0.6166267", "0.6141056", "0.6134772", "0.6127229", "0.60706735", "0.6064615", "0.6059691", "0.60559094", "0.6054334", "0.60053873", "0.6002481", "0.5974752", "0.59605396", "0.5948805", ...
0.6078393
11
Return homogeneous coordinates for this line. Since a line is given by a direction, this is the vector with a 0 appended.
def homogeneous_vector(self, base_ring=None): v = list(self._vector) + [0] return vector(base_ring or self._base_ring, v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_line(self):\n assert len(self.xcoords) == 2\n diff_x = self.xcoords[1] - self.xcoords[0]\n diff_z = self.zcoords[1] - self.zcoords[0]\n vec = np.hstack((diff_x, diff_z))\n return vec", "def find_direction_vector(line):\n pt1, pt2 = line\n pt...
[ "0.7026541", "0.65598226", "0.64231944", "0.6282823", "0.6254565", "0.61447936", "0.6099765", "0.60990334", "0.60587686", "0.60543925", "0.60395837", "0.5987114", "0.59836656", "0.5914958", "0.59121704", "0.590353", "0.59023505", "0.58962023", "0.58874446", "0.588617", "0.588...
0.0
-1
Composes output model name from parameters (e.g., epoch, dim)
def compute_model_name(self, params, folder=None): folder = folder or self.output_dir prefix = os.path.basename(params['graph']) name = "_".join(["{}-{}".format(k, v) for k, v in sorted(params.items()) if k not in ["graph"]]) model_name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_name(name, batch_size, learning_rate, epoch):\n path = \"model_{0}_bs{1}_lr{2}_epoch{3}\".format(name,\n batch_size,\n learning_rate,\n epoch)\n ...
[ "0.74429864", "0.72057253", "0.69994664", "0.6677099", "0.6649023", "0.6631111", "0.6569316", "0.6394026", "0.6380789", "0.6289959", "0.62626195", "0.6258919", "0.6252059", "0.6244986", "0.62184376", "0.6157125", "0.6134587", "0.6129205", "0.6097231", "0.6021453", "0.5972881"...
0.7108442
2
Return full command as a string.
def toRadString(self, relativePath=False): cmdPath = self.normspace(os.path.join(self.radbinPath, 'vwrays')) vwraysParam = self.vwraysParameters.toRadString() viewFilePath = self.viewFile.toRadString() viewFile = "-vf %s" % self.normspace(viewFilePath) if viewFilePath else '' out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fullCmdStr(self):\n return \"%s %s\" % (self.locCmdID, self.cmdStr)", "def command(self) -> str:\n cmd = ''\n if self.argv:\n cmd = self.argv[0]\n return cmd", "def to_string(self):\r\n return self.command()", "def command_and_args(self) -> str:\n if s...
[ "0.7929019", "0.76947993", "0.75896114", "0.73736864", "0.72241807", "0.7209419", "0.71863997", "0.70160794", "0.70093304", "0.7002492", "0.6999356", "0.6935535", "0.68380296", "0.6802123", "0.6795638", "0.6779141", "0.67695796", "0.67394435", "0.67380077", "0.6728414", "0.67...
0.0
-1
Return or set the opacity unit distance. This is the unit distance on which the scalar opacity transfer function is defined. By default this is 1.0, meaning that over a distance of 1.0 units, a given opacity (from the transfer function) is accumulated. This is adjusted for the actual sampling distance during rendering.
def opacity_unit_distance(self) -> float: return self.GetScalarOpacityUnitDistance()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_factor(self):\n return self._distancefactor", "def distmeter(self):\n return self._distance.to(\"m\").value", "def opacity(self):\n # type: () -> float\n return self._opacity", "def opacity( self ):\n if ( self.isIsolateHidden() ):\n return 0.1\n ...
[ "0.6021545", "0.60052586", "0.59463155", "0.59113526", "0.5679345", "0.56293315", "0.55702055", "0.55371463", "0.55226016", "0.55165875", "0.54744136", "0.54594374", "0.5451639", "0.54311574", "0.54164565", "0.5378316", "0.537608", "0.5356985", "0.5351597", "0.534961", "0.530...
0.83455896
0
Return the zero 'c' of a monotonically increasing or decreasing function f. p1 is an estimate of where the zero might be. d is the accuracy of the zero.
def find_zero(f,p1,d): if p1 > 10: p1 = 0.5 c = p1 - f(p1)*d/(f(p1+d)-f(p1)) # simple # we can do this in case derivative diverges because our function is symmetric if c < 0: c = -c global n_of_zeros if n_of_zeros > 8: print('Go linear') return find...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExpectedGainOdds(p,f,c):\r\n ExpGain = p*np.log((c*f+1)) + (1-p)*np.log(1-f)\r\n return ExpGain", "def zzX_zero_of(f, d=0):\n return zzX_zero(poly_level(f)-d)", "def find_zero(f, df):\n def near_zero(x):\n return approx_eq(f(x), 0)\n return improve(newton_update(f, df), near_zero)", ...
[ "0.6610811", "0.6511553", "0.63952225", "0.632142", "0.62610245", "0.6245834", "0.62457925", "0.6188658", "0.6177814", "0.6125175", "0.61160517", "0.6085673", "0.6080162", "0.60407656", "0.59930676", "0.59856665", "0.5980398", "0.5951933", "0.5947896", "0.59473944", "0.590243...
0.7543794
0
Returns the maximum value of the slider
def get_max(self): return self._max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_value(self):\n max_value = max(self.values)\n return max_value", "def max(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"max\")", "def max(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"max\")", "def max_value(self) -> Union[int, float]:\n retu...
[ "0.7829588", "0.7669991", "0.7669991", "0.76484126", "0.76390016", "0.7621435", "0.7591141", "0.7559055", "0.75529355", "0.7534582", "0.7522369", "0.75211614", "0.748256", "0.7479021", "0.7422845", "0.73591536", "0.7324688", "0.7324688", "0.73149556", "0.7268559", "0.72485715...
0.75088876
12
The minium value allowed for the spinner widget Default value is 0
def min(self): return self._min
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_minimum(self):\n self._level_gen.minimum_length = self._minimum_length_spinbox.value()\n self._refresh_view()", "def getMinValue(self):\n return self.MIN_VALUE", "def setMinValue(self, min_value):\r\n\t\tself.MinValue = min_value", "def setMinValue(self, min_value):\r\n\t\tself....
[ "0.7130366", "0.6803748", "0.6700968", "0.6700968", "0.6543529", "0.6510713", "0.64939106", "0.6387477", "0.6387477", "0.6372935", "0.63195014", "0.62872", "0.6282415", "0.61994827", "0.6196452", "0.6196452", "0.6185861", "0.6183966", "0.6182906", "0.6182906", "0.6164927", ...
0.59388626
37
The maximum value of spinner widget. Once it is reached, the number will not increment anymore Default value is 100
def max(self): return self._max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMaximumValue(self, value: int):\n self.ui.progress.setMaximum(value)", "def _set_maximum(self):\n self._level_gen.maximum_length = self._maximum_length_spinbox.value()\n self._refresh_view()", "def set_progress_range(self, maximum):\r\n\r\n pass", "def setMaxValue(self, max...
[ "0.6864508", "0.683982", "0.66321975", "0.66049486", "0.66049486", "0.64841473", "0.64389175", "0.63920945", "0.63920945", "0.6389086", "0.62657475", "0.6238493", "0.61642694", "0.61586636", "0.61361337", "0.6113973", "0.6109282", "0.60782576", "0.6014228", "0.5979747", "0.59...
0.5521722
70
Removing every second byte (zero bytes)
def bytes_to_chars(passwd): return passwd[1::2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stripBufferZero(str):\n if str[-2] == '0':\n return (str[:-2] + str[-1])\n else:\n return str", "def bytes_strip(buf: bytes) -> bytes:\n if b'\\x00' in buf:\n return buf[:buf.find(b'\\x00')]\n else:\n return buf", "def delete_first_zeros(digit_with_zeros): \n ...
[ "0.6938106", "0.64974314", "0.6294952", "0.61731875", "0.599833", "0.5949248", "0.59282553", "0.59173125", "0.59087926", "0.583918", "0.58099204", "0.5802338", "0.57768404", "0.56720996", "0.56127536", "0.5595838", "0.5573313", "0.5526444", "0.5514258", "0.55090463", "0.55073...
0.0
-1
Return the path to the scratch dir that we build within.
def get_scratch_dir(): scratch_dir = os.path.join(get_repo_dir(), "target", "compat-check") if not os.path.exists(scratch_dir): os.makedirs(scratch_dir) return scratch_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scratch_dir():\n try:\n return os.environ['_CONDOR_SCRATCH_DIR']\n except KeyError:\n return tempfile.gettempdir()", "def create_scratch_dir():\n dirname = os.path.join(BUILD_DIR, \"scratch\")\n if os.path.isdir(dirname):\n shutil.rmtree(dirname)\n package_dir = os.pat...
[ "0.7874509", "0.73542386", "0.7059514", "0.7011762", "0.69112", "0.6793722", "0.67156285", "0.67156285", "0.6668115", "0.66560936", "0.66535676", "0.6635887", "0.65948665", "0.6582831", "0.65750045", "0.657494", "0.6558456", "0.65521234", "0.65447366", "0.6519347", "0.6516594...
0.81557745
0
Return a list of jars within 'path' to be checked for compatibility.
def find_jars(path): all_jars = set(check_output(["find", path, "-type", "f", "-name", "*.jar"]).splitlines()) return [j for j in all_jars if ( "-tests" not in j and "-sources" not in j and "-with-dependencies" not in j)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_versions_from_path(self, path):\n if not path:\n return []\n\n # convert '\\\\' to '/'\n path = os.path.normpath(path).replace(\"\\\\\", \"/\")\n from stalker import Repository\n\n os_independent_path = Repository.to_os_independent_path(path)\n logger.de...
[ "0.65349346", "0.59373873", "0.591069", "0.5896378", "0.58784753", "0.58418304", "0.58042943", "0.5770394", "0.5747154", "0.5720439", "0.5700362", "0.56951386", "0.56943995", "0.56462574", "0.56116563", "0.5605039", "0.560152", "0.55683714", "0.5562325", "0.55297786", "0.5518...
0.76639944
0
Iterate through a dictionary of data and convert all unicode to ascii. This method was taken from stackoverflow.com/questions/9590382/forcingpythonjsonmoduletoworkwithascii
def ascii_encode_dict(data): ascii_encode = lambda x: x.encode('ascii') if isinstance(x, str) else x return dict(list(map(ascii_encode, pair)) for pair in list(data.items()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_utf8(data):\n if isinstance(data, unicode):\n return data.encode(\"utf-8\")\n elif isinstance(data, list):\n return [force_utf8(i) for i in data]\n elif isinstance(data, dict):\n return {force_utf8(i): force_utf8(data[i]) for i in data}\n return data", "def unicode_dic(...
[ "0.6858892", "0.6737289", "0.6659699", "0.6389398", "0.6347448", "0.63167745", "0.6223812", "0.6054062", "0.60408324", "0.60205984", "0.5995308", "0.5964103", "0.59601754", "0.59434044", "0.58674103", "0.5853518", "0.5828692", "0.5798811", "0.57858664", "0.5754281", "0.573376...
0.71262044
0
Concert velocities from a cartesian system to proper motions and radial velocities
def velocity_cartesian2pmvr(self, x="x", y="y", z="z", vx="vx", vy="vy", vz="vz", vr="vr", pm_long="pm_long", pm_lat="pm_lat", distance=None, inplace=False): df = self.df if inplace else self.df.copy() if distance is None: distance = "sqrt({x}**2+{y}**2+{z}**2)".format(**locals()) k ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _velocity_cylindrical2cartesian(pos,vel):\n \n \n #save cartesian position of each particle\n theta=pos[:,1]\n\n #save cyindrical velocities\n vr=vel[:,0]\n vtheta=vel[:,1]\n vz=vel[:,2]\n\n #compute cartesian velocities\n vx = vr*np.cos(theta) - vtheta*np.sin(theta)\n vy = vr*...
[ "0.70039296", "0.6899888", "0.6809417", "0.6808413", "0.67012864", "0.6659838", "0.66525424", "0.6649446", "0.6543619", "0.6489814", "0.6444669", "0.63781625", "0.6373441", "0.6368298", "0.6353544", "0.6345697", "0.6301086", "0.6227903", "0.62184757", "0.6198961", "0.61959374...
0.0
-1
Get a partitioner for VariableScope to keep shards below `max_shard_bytes`. This partitioner will shard a Variable along one axis, attempting to keep the maximum shard size below `max_shard_bytes`. In practice, this is not always possible when sharding along only one axis. When this happens, this axis is sharded as muc...
def variable_axis_size_partitioner( max_shard_bytes, axis=0, bytes_per_string_element=16, max_shards=None): if max_shard_bytes < 1 or bytes_per_string_element < 1: raise ValueError( "Both max_shard_bytes and bytes_per_string_element must be positive. " f"Currently, max_shard_bytes is {max_shar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_max_variable_partitioner(max_partitions=1, axis=0,\n min_slice_size=256 << 10,\n bytes_per_string_element=16):\n def _partitioner(shape, dtype):\n \"\"\"Partitioner that partitions list for a variable of given shape and type.\n\n Ex: Co...
[ "0.6623838", "0.62530106", "0.55201674", "0.54448503", "0.54448503", "0.51812786", "0.51736367", "0.5124417", "0.50946194", "0.50946194", "0.5030613", "0.502311", "0.4902142", "0.4855417", "0.48331273", "0.48274654", "0.47569272", "0.47569272", "0.475025", "0.4748533", "0.474...
0.7404629
0
Partitioner to specify a fixed number of shards along given axis. (TF2) This API is deprecated in TF2. In TF2, partitioner is no longer part of the variable declaration via `tf.Variable`. [ParameterServer Training]
def fixed_size_partitioner(num_shards, axis=0): def _partitioner(shape, **unused_args): partitions_list = [1] * len(shape) partitions_list[axis] = min(num_shards, shape.dims[axis].value) return partitions_list return _partitioner
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variable_axis_size_partitioner(\n max_shard_bytes, axis=0, bytes_per_string_element=16, max_shards=None):\n if max_shard_bytes < 1 or bytes_per_string_element < 1:\n raise ValueError(\n \"Both max_shard_bytes and bytes_per_string_element must be positive. \"\n f\"Currently, max_shard_bytes...
[ "0.71160024", "0.67230225", "0.6004104", "0.5983609", "0.59258485", "0.58372605", "0.5734408", "0.573386", "0.5602343", "0.55887496", "0.5442609", "0.5370742", "0.5343927", "0.53321606", "0.5325889", "0.5325063", "0.5304298", "0.5288746", "0.5276637", "0.52260876", "0.5221612...
0.7204223
0
Create a list of partitioned variables according to the given `slicing`. Currently only one dimension of the full variable can be sliced, and the full variable can be reconstructed by the concatenation of the returned list along that dimension.
def create_partitioned_variables( shape, slicing, initializer, dtype=dtypes.float32, trainable=True, collections=None, name=None, reuse=None): if len(shape) != len(slicing): raise ValueError( "The 'shape' and 'slicing' of a partitioned Variable " f"must have the length: shape: {shape}, sli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_partitioned_variables(\n shape, slicing, initializer, dtype=dtypes.float32,\n trainable=True, collections=None, name=None, reuse=None):\n if len(shape) != len(slicing):\n raise ValueError(\"The 'shape' and 'slicing' of a partitioned Variable \"\n \"must have the length: sha...
[ "0.7369694", "0.6652528", "0.6155973", "0.6029614", "0.5984155", "0.58837646", "0.5727084", "0.55970305", "0.5594166", "0.5577348", "0.5574835", "0.5553544", "0.5545915", "0.5538713", "0.55150485", "0.5483339", "0.54592234", "0.54355204", "0.54292035", "0.5406725", "0.5389529...
0.7401687
0
Compute dx for flagging
def diff_flag(data): dp = np.abs(np.diff(data)) dp = np.concatenate(([0], dp)) return dp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dgdx(self, X):\n \n return 2*(X[0]) - 2", "def dgdy(self, X):\n \n return 3*X[1]**2", "def GetdXdx(Md,X):\n assert X.shape[1] == 1\n Xa = X.copy()\n Xb = X.copy()\n\n eps = -0.005\n Xb[iMP] = Xb[iMP] + eps\n\n\n Xa[Md.nX:Md.nXY] = Md.F(Xa[Md.interpstates])\n ...
[ "0.72657746", "0.7074264", "0.6892348", "0.6787691", "0.66890955", "0.66700083", "0.66700083", "0.6585489", "0.6524985", "0.6377786", "0.63741904", "0.6366356", "0.6341531", "0.6331538", "0.6305693", "0.6293501", "0.62756294", "0.6210766", "0.6206867", "0.619658", "0.61815155...
0.0
-1
Improve the target expression using enumerative synthesis. This function is a generator that yields increasingly better and better versions of the input expression `target`. Notes on internals of this algorithm follow.
def improve( target : Exp, context : Context, assumptions : Exp = T, stop_callback = never_stop, hints : [Exp] = (), examples : [{str:object}] = (), cost_model : CostModel = None): print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adapt_target(self, target):\n\n target = target.view(-1)\n new_target = [target.clone()]\n target_idxs = []\n\n for i in range(len(self.cutoff) - 1):\n mask = target.ge(self.cutoff[i]).mul(target.lt(self.cutoff[i + 1]))\n new_target[0][mask] = self.cutoff[0] + ...
[ "0.56272966", "0.5393609", "0.5156889", "0.51452154", "0.51155734", "0.5058315", "0.5033971", "0.5019287", "0.49965423", "0.49884284", "0.49804744", "0.49685565", "0.49530372", "0.49343356", "0.49212715", "0.4912529", "0.4912529", "0.48951694", "0.4859037", "0.48559305", "0.4...
0.5878677
0
Checks if lifespan is exceeded.
def is_old(self): return self.age > self.lifespan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exceeded(self):\r\n return int(time.time()) - self.start_time >= self.length", "def is_exceeded(self):\n\n if self.stopwatch.check_time() > self.duration:\n self.stopwatch.start()\n self.num_processed_this_interval = 0\n return False\n\n return self.num_p...
[ "0.70351404", "0.669618", "0.63818836", "0.6239733", "0.62282693", "0.6061441", "0.60462666", "0.5959913", "0.5946756", "0.590665", "0.58828735", "0.5848977", "0.5845199", "0.5825435", "0.5808674", "0.58052486", "0.5772699", "0.57675785", "0.5744262", "0.573884", "0.56843007"...
0.5926406
9
Take argmax of m along dimension 1 and apply RGB colorcode on it
def argmax_rgb(m, cmap=plt.cm.viridis): B, H, W, P = nn.shape_as_list(m) argmax_map = tf.arg_max(m, dimension=-1) colors = imageutils.make_colors(P, cmap=cmap) colors = colors.astype(np.float32) colors = tf.convert_to_tensor(colors) m_one_hot = tf.one_hot(argmax_map, P, axis=-1) mask_rgb = t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_max_rgb(img: np.ndarray):\n # split the image into its BGR components\n (B, G, R) = cv2.split(img)\n\n # find the maximum pixel intensity values for each\n # (x, y)-coordinate,, then set all pixel values less\n # than M to zero\n M = np.maximum(np.maximum(R, G), B)\n R[R < M] = 0\n ...
[ "0.64958453", "0.6463115", "0.6354029", "0.61667645", "0.6148527", "0.61483264", "0.61133534", "0.59769547", "0.5865522", "0.58518404", "0.58318317", "0.58041954", "0.5783557", "0.5643267", "0.56404704", "0.5563725", "0.5552524", "0.5498227", "0.54946125", "0.5484113", "0.546...
0.8083214
0
Get tables for this database It's common to want the Tables for a Database but the two models are separated by a Schema. This property aims to simply that lookup.
def tables(self): return Table.objects.filter(schema__database=self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTables(self):\n\treturn self.dbNames", "def tables(self) -> list:\n return self.list_tables()", "def get_tables(self, db_name):\n pass", "def tables(self):\n result = self.execute(self.commands.get_tables(self.name))\n return [x[0] for x in result]", "def meta_db_tables(s...
[ "0.74762964", "0.73759145", "0.73195535", "0.7315017", "0.7290738", "0.7186329", "0.7167253", "0.71611804", "0.7102203", "0.7065968", "0.70065594", "0.6973729", "0.6953535", "0.6931115", "0.69180757", "0.6884369", "0.67897344", "0.6778243", "0.67766654", "0.67132795", "0.6707...
0.866739
0
Create and save a user with the given username, email, and password.
def _create_user(self, email, password, **extra_fields): if not email: raise ValueError("The given email must be set") email = self.normalize_email(email) version = Version.objects.latest() user = self.model(email=email, current_version=version, **extra_fields) use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se...
[ "0.85967624", "0.8440654", "0.84264034", "0.8423257", "0.84063315", "0.8393488", "0.83878005", "0.8341707", "0.8334409", "0.8332718", "0.83224976", "0.8288854", "0.82819235", "0.827502", "0.8269521", "0.8267577", "0.81637603", "0.8159258", "0.8158126", "0.81423306", "0.813671...
0.0
-1
Returns a list containing all existing neighbors of a node. coord must be a valid coordinate i.e. self.check_coord(coord).
def neighbors(self, coord): if not self.check_coord(coord): raise ValueError("Invalid coordinates") x, y = coord n = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)] ret = [c for c in n if self.check_coord(c)] return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_neighbors(self, coord):\n neighbors = []\n for change in self._changes:\n neighbor_coord = np.array(coord) + change\n if np.logical_or(np.any(neighbor_coord < 0), np.any(neighbor_coord >= self._grid_shape)):\n continue\n neighbors.append(tuple(...
[ "0.8222512", "0.76888615", "0.75152946", "0.73720956", "0.72651494", "0.72308403", "0.7219055", "0.71015745", "0.69940096", "0.68836075", "0.68689543", "0.6854589", "0.68392444", "0.6829193", "0.6784378", "0.6774989", "0.676525", "0.6743326", "0.6721076", "0.670196", "0.66932...
0.84127307
0
Returns a list of near enemies that can be attacked without having to move.
def nearby_enemies(self, _unit=None, coord=None): if not _unit: _unit = self.curr_unit if not coord: coord = _unit.coord min_range, max_range = _unit.get_weapon_range() area = self.area(coord, max_range, min_range) nearby_list = [] for u in area: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEnemyGhost(self,gameState):\r\n enemyList = []\r\n for enemy in self.getOpponents(gameState):\r\n enemyState = gameState.getAgentState(enemy)\r\n if (not enemyState.isPacman) and enemyState.scaredTimer == 0:\r\n enemyPos = gameState.getAgentPosition(enemy)\...
[ "0.6828104", "0.6395965", "0.6236478", "0.6126563", "0.6104321", "0.6073693", "0.6032627", "0.5877156", "0.5864982", "0.5864709", "0.5852008", "0.5828249", "0.5810124", "0.5792871", "0.5772731", "0.57411236", "0.5739932", "0.5738728", "0.57237536", "0.56916803", "0.56865", ...
0.6751573
1
Returns the number of rows. Returns
def num_rows(self): if self._is_vertex_frame(): return self.__graph__.summary()['num_vertices'] elif self._is_edge_frame(): return self.__graph__.summary()['num_edges']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumRows(self) -> int:\n ...", "def num_rows(self):\n return (len(self.rows))", "def num_rows(self):\n return len(self.rows)", "def row_count(self) -> int:\n return len(self.rows)", "def row_count(self) -> int:\n return len(self.rows)", "def get_num_rows(self):\n ...
[ "0.917233", "0.88776004", "0.8820168", "0.8808889", "0.8808889", "0.8763773", "0.8707073", "0.86238533", "0.85704553", "0.85265195", "0.85248595", "0.8512828", "0.84496826", "0.84472466", "0.84370935", "0.83640385", "0.8261872", "0.8242015", "0.82058614", "0.819792", "0.81144...
0.76942885
41
Splits data into train/val/test subsets of a given size
def split_data(x: np.array, y: np.array, test_size: float = 0.2, val_size: float = 0.2, random_state: int = None ) -> List[Tuple[np.array]]: train_x, test_x, train_y, test_y = \ train_test_split(x, y, test_size=test_size, random_state=random_state) train_x, val_x, train_y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dataset(self, test_size=0.20):\n\t\t(self.training_data, self.test_data, self.training_labels, self.test_labels) = train_test_split(self.training_data, self.training_labels, test_size=test_size)", "def split_data(dataset, test_size=0.5):\n shuffled_data = np.random.RandomState(seed=721).permutation(...
[ "0.7967489", "0.7794083", "0.7695253", "0.7665634", "0.76424474", "0.7634289", "0.7623757", "0.7606727", "0.76020706", "0.75711954", "0.75218487", "0.7456067", "0.7451648", "0.74393195", "0.74052787", "0.7391813", "0.7373566", "0.7341726", "0.73327416", "0.73000014", "0.72996...
0.72409403
28
Returns activation method by a given name
def get_activation_by_name(name: str) -> Any: methods = { "elu": nn.ELU, "hardshrink": nn.Hardshrink, "hardtanh": nn.Hardtanh, "leakyrelu": nn.LeakyReLU, "logsigmoid": nn.LogSigmoid, "prelu": nn.PReLU, "relu": nn.ReLU, "relu6": nn.ReLU6, "rrel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_activation(name):\n if name not in _ACTIVATIONS.keys():\n raise ValueError(f\"{name} is not a valid activation function.\")\n return _ACTIVATIONS[name]", "def get_activation_fn(name: Optional[str]):\n if name in (None, 'linear'):\n return lambda x: x\n elif name in ('sigmoid', '...
[ "0.78163666", "0.7420318", "0.6877094", "0.6787138", "0.6785763", "0.6588628", "0.6580236", "0.65554845", "0.64501065", "0.6449193", "0.64339244", "0.64263684", "0.64145476", "0.6408341", "0.63686883", "0.63588804", "0.63510966", "0.6338946", "0.6334626", "0.63136685", "0.630...
0.82283616
0
Get the drag force (x) provided by the landing gear
def get_force(self): # @todo: Probably need to check the state of the landing gear for this (e.g. are they on the track?). # Note: you can get the state of the landing gear by going through self.sim return 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_x__(self):\n return self.Direction['x']", "def gravity():\n\tg = _scene.gravity()\n\treturn Vector3(g[0], g[1], g[2])", "def getAngVelX(self):\n return self.angvel.getX()", "def getXVelocity(self):\n return self.xvelocity", "def get_ship_x(self):\n return self.x", "d...
[ "0.6040731", "0.6020275", "0.60098517", "0.5933948", "0.5931478", "0.592996", "0.5922517", "0.59075683", "0.58817333", "0.58535206", "0.58410996", "0.58165467", "0.580162", "0.58009326", "0.57819986", "0.57819986", "0.5774227", "0.5736978", "0.5700994", "0.56988096", "0.56982...
0.6939582
0
Return a Version object from value.
def coerce_version(value): if not isinstance(value, Version): value = Version.from_string(value) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, value: str) -> None:\n try:\n id_part, version_part = self.split('v', 1)\n self.arxiv_id = Identifier(id_part)\n self.version = int(version_part)\n except ValueError as e:\n raise ValueError(f'Not a valid version identifier: {value}') fro...
[ "0.6354353", "0.6041936", "0.5958568", "0.592619", "0.58279985", "0.5767163", "0.5762127", "0.57187676", "0.5702731", "0.5698203", "0.5663772", "0.5656859", "0.56500906", "0.56151485", "0.55053675", "0.5493389", "0.54900426", "0.5461932", "0.5460508", "0.5460174", "0.5433595"...
0.752234
0