query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Execute the function task.
def run(self, *args, **kwargs): if self.task_loader is None: if 'task' not in kwargs: if len(args) == 0 or not isinstance(args[0], self.flow_class.task_class): raise FlowRuntimeError('Function {} should be called with task instance', self.name) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _execute_task(task, function, config):\n logging.debug('<Task-%s> started.' % task.get_id())\n start_time = time.time()\n try:\n function(task.get_data())\n logging.debug('<Task-%s> finished in %2.2f seconds with result: %s' % (task.get_id(),\n ...
[ "0.73130786", "0.727794", "0.727794", "0.7223112", "0.7086795", "0.7083772", "0.70426476", "0.69302607", "0.6923544", "0.6868409", "0.6854366", "0.67575186", "0.67484105", "0.67245996", "0.66799116", "0.66722405", "0.663224", "0.6616039", "0.6605105", "0.6604266", "0.659991",...
0.6494967
25
Summary for every series
def base_summary(series: pd.Series) -> dict: summary = { "frequencies": series.value_counts().to_dict(), "n_records": series.shape[0], "memory_size": series.memory_usage(index=True, deep=True), "dtype": series.dtype, "types": series.map(lambda x: type(x).__name__).value_count...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _summary(self, name=None):\n if name is None:\n if len(self._tracker_dict.keys()) > 1:\n dataframes = []\n for (_name, tracker) in self._tracker_dict.items():\n summary_df = tracker.series.summary()\n summary_df = summary_df....
[ "0.7089863", "0.65536255", "0.653386", "0.6407142", "0.63080764", "0.62465453", "0.6217058", "0.6183639", "0.61406666", "0.60740024", "0.6058445", "0.6054211", "0.60406715", "0.6035013", "0.6030795", "0.60064787", "0.6001196", "0.5956691", "0.59167403", "0.5907618", "0.590478...
0.7123433
0
Print Nodes in Top View of Binary Tree
def top_view(root): if root is None: return # make an empty queue for BFS q = deque() # empty set sets = set({}) # list to store top view keys topview = [] # append root in the queue with horizontal distance as 0 q.append((root, 0)) while q: # get the elemen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tree(self):\n\t\tprint(self.__print_tree('', True, ''))", "def print_tree(self):\n\t\tself.root.print_recursive(0)", "def print_bi_tree(self):\n\n to_print = [self]\n # current = None\n\n while to_print:\n current = to_print.pop(0)\n if current:\n ...
[ "0.7755528", "0.76339066", "0.76053905", "0.760435", "0.75482863", "0.7485843", "0.7462942", "0.7462942", "0.7416779", "0.7387545", "0.73497045", "0.73221946", "0.7304797", "0.72974205", "0.7279474", "0.7267793", "0.7253698", "0.7226757", "0.7221274", "0.7214918", "0.70488644...
0.0
-1
Creates a vector out of a string. Gets a string (e.g. Book), splits it into and returns a vector with all possible ngrams/features.
def create_vector(string): vec = {} words = string.split() for word in words: if len(word) <= NGRAM_SIZE: add(vec, word) else: for i in range(len(word) - NGRAM_SIZE + 1): add(vec, word[i : i + NGRAM_SIZE]) return vec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_terms_from_string(s):\n u = s\n return u.split()", "def ngramas(n, string):\n\n ngrams = []\n i = 0\n while i + n < len(string):\n ngrams.append(string[i:i + n])\n i += 1\n\n return ngrams", "def from_string(string):\n return Sentence(string.split(\" \"))", "de...
[ "0.6692081", "0.620363", "0.61938727", "0.6170458", "0.6045155", "0.59495336", "0.59380984", "0.592855", "0.587873", "0.5878487", "0.5867894", "0.5849799", "0.58483064", "0.5833884", "0.58311754", "0.58128583", "0.5803685", "0.57831234", "0.5774572", "0.57539713", "0.5753545"...
0.7425697
0
Adds ngrams to the vector. Adds ngrams to our featurelistvector, if is not included yet (containing all possible ngrams/features).
def add(vector, ngram): if ngram in vector: vector[ngram] += 1 else: vector[ngram] = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_ngram(self, feature_vector, ngram):\n if ngram in self.ngrams:\n ngram_pos = self.ngrams[ngram]\n feature_vector[ngram_pos] = 1", "def add_ngram(self, feature_vector, ngram):\n raise NotImplementedError('NgramExtractorBase:add_ngram() is not defined')", "def _update_...
[ "0.78258324", "0.7761324", "0.6711486", "0.6324257", "0.6314163", "0.62996507", "0.62956494", "0.6283911", "0.62081075", "0.61932635", "0.61905193", "0.61895627", "0.6077353", "0.6031984", "0.5953315", "0.5854282", "0.582309", "0.57579124", "0.5724762", "0.5719919", "0.570135...
0.6335167
3
Selects most frequent features. Selects the x most frequent ngrams/features (x=FEATURE_LENGTH) to avoid a (possibly) too big featurelist.
def select_features(vec): return sorted(vec, key=vec.get, reverse=True)[ : min(len(vec), FEATURE_LENGTH) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_frequent_features(self):\n feature_terms = [sub_items for items in self.data['noun_and_np'].values for sub_items in items]\n C1 = apriori.createC1(feature_terms)\n D = map(set, feature_terms)\n L1, support_data = apriori.scanD(D,C1,0.01) # minimum support 0.01\n self.fre...
[ "0.6985161", "0.6584252", "0.64588726", "0.64567083", "0.6411913", "0.6340169", "0.6325521", "0.63179886", "0.63179886", "0.6261018", "0.620704", "0.61992115", "0.6151525", "0.6142053", "0.61385345", "0.6105948", "0.6049937", "0.6019492", "0.6014008", "0.59916437", "0.5987639...
0.622837
10
Creates a feature map. Creates feature map that only saves the features that actually appear more frequently than 0. Thus, the featurelis tneeds less memory and can work faster.
def create_feature_map(string, features): fmap = {} vec = create_vector(string) for ngram in features: if ngram in vec: fmap[ngram] = vec[ngram] return fmap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_feature_map():\n return {\n # 3 sparse feature with variable length. Use this if you have a\n # variable number or more than 1 feature value per example.\n \"feature_1\":\n tf.io.VarLenFeature(dtype=tf.int64),\n \"feature_2\":\n tf.io.VarL...
[ "0.6783414", "0.6589923", "0.6082466", "0.5959431", "0.5938566", "0.5812138", "0.5812138", "0.5808928", "0.57964915", "0.5773302", "0.57630265", "0.5757909", "0.575371", "0.5715837", "0.5711248", "0.56986976", "0.5684603", "0.56828", "0.5660406", "0.5659658", "0.56588423", ...
0.5451646
31
Calculates the cosine similary of two vectors. Calculates cosine similarity of two vectors vec_x and vec_y.
def cosine_similarity(vec_x, vec_y): sim_prod = 0.0 len_x = 0 len_y = 0 for ngram in vec_x: len_x += vec_x[ngram] ** 2 for ngram in vec_y: len_y += vec_y[ngram] ** 2 len_x = math.sqrt(len_x) len_y = math.sqrt(len_y) for ngram in vec_x: if ngram in vec_y: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_similarity(cls, vec_a, vec_b):\n return np.dot(vec_a, vec_b) / \\\n (np.linalg.norm(vec_a) * np.linalg.norm(vec_b))", "def cosine_similarity(vector_x, vector_y):\n if(len(vector_x)!=len(vector_y)):\n raise Exception('Vectors must be the same dimensions')\n \n retu...
[ "0.89153063", "0.8762753", "0.85140526", "0.83890986", "0.83389425", "0.82837796", "0.8256471", "0.82297283", "0.8175448", "0.8052344", "0.8011905", "0.7928554", "0.78636724", "0.7821731", "0.77544606", "0.77392095", "0.773385", "0.766548", "0.76130956", "0.7587458", "0.75858...
0.860079
2
Calculates the minmax similarity of two vectors. Calculates minmax similarity of two vectors vec_x and vec_y.
def minmax(vec_x, vec_y): minsum = 0 maxsum = 0 for ngram in vec_x: if ngram in vec_y: # ngram is in both vectors minsum += min(vec_x[ngram], vec_y[ngram]) maxsum += max(vec_x[ngram], vec_y[ngram]) else: # ngram only in vec_x maxsu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_similarity(vector_x, vector_y):\n if(len(vector_x)!=len(vector_y)):\n raise Exception('Vectors must be the same dimensions')\n \n return 1-np.dot(vector_x,vector_y)/(np.linalg.norm(vector_x)*np.linalg.norm(vector_y))", "def cosine_similarity(vec_x, vec_y):\n sim_prod = 0.0\n ...
[ "0.62996674", "0.6249005", "0.6130107", "0.6097062", "0.6059761", "0.6027226", "0.59534824", "0.5932027", "0.59160405", "0.58726966", "0.58326", "0.5826938", "0.58192986", "0.579559", "0.5791049", "0.57742333", "0.5760231", "0.57585263", "0.57527345", "0.575017", "0.5737195",...
0.78629965
0
Returns a feature list of the vector from the string. Turns a given string into a ngram vector and returns its feature list.
def training(string): print("Training...") vec = create_vector(string) print("Selecting features...") feature_list = select_features(vec) print("Done!") return feature_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_vector(string):\n vec = {}\n words = string.split()\n\n for word in words:\n if len(word) <= NGRAM_SIZE:\n add(vec, word)\n else:\n for i in range(len(word) - NGRAM_SIZE + 1):\n add(vec, word[i : i + NGRAM_SIZE])\n\n return vec", "def crea...
[ "0.66118634", "0.64273095", "0.6327371", "0.6292743", "0.62504566", "0.6237537", "0.61925775", "0.61103535", "0.60202676", "0.6020088", "0.5987974", "0.5959671", "0.59375215", "0.59162277", "0.59138423", "0.59009033", "0.58965003", "0.5834525", "0.58342415", "0.5805564", "0.5...
0.6722822
0
Returns the similarity value of two vectors.
def test_sim(vec_x, vec_y, feature_list, func): feature_map_x = create_feature_map(vec_x, feature_list) feature_map_y = create_feature_map(vec_y, feature_list) if func == 0: return cosine_similarity(feature_map_x, feature_map_y) return minmax(feature_map_x, feature_map_y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_similarity(v1, v2):\n return np.dot(v1, v2) / (np.linalg.norm(v1) * np.linalg.norm(v2))", "def cosine_similarity(v1: Vector, v2: Vector) -> float:\n return dot_product(v1, v2) / (vector_len(v1) * vector_len(v2))", "def similarity(self, token1, token2):\n vec1 = self.get_vector(token1)\n ...
[ "0.79118186", "0.7830324", "0.77912253", "0.7780094", "0.76602757", "0.765669", "0.7611135", "0.75025684", "0.7484508", "0.74626744", "0.74408746", "0.7354827", "0.7354827", "0.7334992", "0.7276158", "0.7272085", "0.7264649", "0.725899", "0.7200105", "0.7190883", "0.71873575"...
0.0
-1
Returns a random part of a string. Returns a random part of a string s that has a given length.
def get_random_string(string, length): words = string.split() random_part = random.randint(0, len(words) - length) return "".join(words[random_part : random_part + length])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_random_string(string_length=17):\n random = str(uuid.uuid4())\n random = random.upper() \n random = random.replace(\"-\",\"\")\n return random[0:string_length]", "def random_string(length=8, chars=string.ascii_letters + string.digits):\n return ''.join([chars[random.randint(0, len(chars) - ...
[ "0.72976446", "0.7289028", "0.72863644", "0.7257486", "0.7251793", "0.7228094", "0.7225105", "0.72134733", "0.72119886", "0.72024626", "0.72024626", "0.72007173", "0.71958107", "0.7194601", "0.7194079", "0.7183809", "0.7183112", "0.7173273", "0.7160337", "0.7153696", "0.71514...
0.7963441
0
Initialize a sky dip model. The skydip model is used to fit elevation vs. data to determine the best fit parameters and error estimates.
def __init__(self): self.configuration = None self.initial_guess = self.default_initial_guess.copy() self.bounds = self.default_bounds.copy() self.fit_for = None self.has_converged = False self.data_unit = units.Unit("count") self.use_points = 0 self.unifo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, skydip):\n parameter_order = ['tau', 'offset', 'kelvin', 'tsky']\n self.parameters = {}\n self.errors = {}\n self.p_opt = None\n self.p_cov = None\n self.fitted_values = None\n self.data = None\n self.sigma = None\n self.elevation = None\...
[ "0.688853", "0.66465706", "0.655027", "0.6303205", "0.56098145", "0.56098145", "0.51203537", "0.5113962", "0.50347364", "0.49883", "0.4955085", "0.49048865", "0.4892753", "0.48750913", "0.4818257", "0.48166892", "0.48083803", "0.4781016", "0.47622022", "0.47585717", "0.475099...
0.0
-1
Return a copy of the skydip model. Returns SkyDipModel
def copy(self): return deepcopy(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sky_model(self, which=\"point\"):\n return SkyModel(\n spatial_model=self.spatial_model(which),\n spectral_model=self.spectral_model(which),\n name=self.name,\n )", "def copy(self):\n new_model = Model(\n name=self.name,\n functions=...
[ "0.70133704", "0.66789675", "0.60469586", "0.60200584", "0.5824889", "0.576261", "0.576261", "0.5689599", "0.5688857", "0.5659916", "0.56326395", "0.56063116", "0.5596126", "0.53597593", "0.5358383", "0.53488886", "0.53469974", "0.53012586", "0.5300153", "0.525691", "0.525562...
0.514513
72
Set the sky dip model configuration
def set_configuration(self, configuration): if not isinstance(configuration, Configuration): raise ValueError(f"Configuration must be {Configuration} " f"instance. Received {configuration}.") self.configuration = configuration if self.configuration.is_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_parameters(self, skydip):\n if self.configuration.is_configured('skydip.tsky'):\n self.initial_guess['tsky'] = self.configuration.get_float(\n 'skydip.tsky')\n elif skydip.tamb_weight > 0:\n temp = skydip.tamb\n if isinstance(temp, units.Quanti...
[ "0.6260431", "0.59479874", "0.59430236", "0.57023", "0.5684856", "0.5664265", "0.5639438", "0.5633307", "0.55982137", "0.55243534", "0.5451777", "0.5441184", "0.54367733", "0.5416396", "0.5416396", "0.5393091", "0.53578675", "0.53553176", "0.53494585", "0.5281941", "0.5273201...
0.63351405
0
Initialize the fitting parameters.
def init_parameters(self, skydip): if self.configuration.is_configured('skydip.tsky'): self.initial_guess['tsky'] = self.configuration.get_float( 'skydip.tsky') elif skydip.tamb_weight > 0: temp = skydip.tamb if isinstance(temp, units.Quantity): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fit_params(self):\n\n self.p0 = np.array([self.A_arr, self.T_a])\n # initial guess at A_arr and T_a\n\n self.popt, self.pcov = curve_fit(\n self.get_eta_fit, self.T_exp, self.eta_exp, p0=self.p0\n )\n\n self.A_arr = self.popt[0]\n self.T_a = self.popt[1]\n\n self.T_array = s...
[ "0.748414", "0.73611045", "0.72121745", "0.71634656", "0.70998245", "0.7093689", "0.7042686", "0.70066947", "0.69969213", "0.69654155", "0.6956148", "0.6932016", "0.6884729", "0.68793225", "0.68751687", "0.68209374", "0.68203", "0.67906654", "0.6747684", "0.6740722", "0.67299...
0.0
-1
Fit the skydip model.
def fit(self, skydip): parameter_order = ['tau', 'offset', 'kelvin', 'tsky'] self.parameters = {} self.errors = {} self.p_opt = None self.p_cov = None self.fitted_values = None self.data = None self.sigma = None self.elevation = None log.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skydip(scans):\n title = Path(scans[0]).name + \" \".join([Path(scan).name.split(\"_\")[4] for scan in scans[1:]])\n\n signal = []\n std = []\n elevation = []\n\n for scan in scans:\n kd = KissData(scan)\n kd.read_data(list_data=[\"A_masq\", \"I\", \"Q\", \"F_tone\", \"F_tl_Az\", \...
[ "0.71958387", "0.6706675", "0.66250366", "0.6449008", "0.62683755", "0.6221359", "0.61551917", "0.6120607", "0.6083158", "0.60547644", "0.60453737", "0.6025587", "0.60035104", "0.5981096", "0.5972988", "0.5968424", "0.5968424", "0.5968424", "0.59320873", "0.58962053", "0.5896...
0.7225869
0
Returns a fit to elevation with the model.
def fit_elevation(self, elevation): if self.p_opt is None: result = elevation * np.nan else: result = self.value_at(elevation, *self.p_opt) if isinstance(result, units.Quantity): result = result.value return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_sky(self):\n min_value = self.data.min()\n ring_model = models.Ring2D(\n min_value, self.x, self.y, self._box * 0.4, width=self._box * 0.4\n )\n ring_model.r_in.fixed = True\n ring_model.width.fixed = True\n ring_model.x_0.fixed = True\n ring_mode...
[ "0.6175527", "0.5854759", "0.57457453", "0.5709625", "0.5693753", "0.5398284", "0.53812927", "0.53534794", "0.53487504", "0.5308275", "0.52831", "0.52750176", "0.52045095", "0.520028", "0.5186781", "0.51401824", "0.51340437", "0.51340437", "0.5090348", "0.5071652", "0.5067156...
0.7041972
0
Return the result of the fitted value.
def value_at(elevation, tau, offset, kelvin, tsky): with warnings.catch_warnings(): warnings.simplefilter('ignore', RuntimeWarning) eps = -(np.exp(-tau / np.sin(elevation)) - 1) t_obs = eps * tsky return offset + (t_obs * kelvin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fittedvalues(self):\n return self.model.predict(self.params)\n # TODO: GH#5255 is this necessarily equivalent to self.predict()?", "def fit(self, x):\n pass", "def get_estimate(self) -> np.ndarray:\n return self.fit_function(self.x, self.coefficients)", "def fit():\n pa...
[ "0.72722286", "0.67442375", "0.67056286", "0.6667116", "0.6580389", "0.65643084", "0.654519", "0.6518184", "0.64856493", "0.6419934", "0.64114964", "0.63298136", "0.63298136", "0.63298136", "0.6308818", "0.6303537", "0.6298279", "0.62980753", "0.6270139", "0.62555873", "0.624...
0.0
-1
Return a string representation of a given parameter.
def get_parameter_string(self, parameter): if not self.has_converged or self.parameters is None: return None if parameter not in self.parameters: return None fmt = self.get_parameter_format(parameter) unit = self.get_parameter_unit(parameter) value = fmt ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n\n return \"<ExoParameter>: {0}\".format(self.__dict__)", "def __repr_parameter__(self, name: str, value: Any) -> str:\n return f\"{name}={value!r}\"", "def format_parameter(param, required):\n\n param_string = check_param(flatten_param(param))\n if not required:\n ...
[ "0.7343561", "0.71605086", "0.710844", "0.69979465", "0.69655436", "0.6828032", "0.67813796", "0.6732115", "0.67217475", "0.6646251", "0.66266364", "0.65682906", "0.656694", "0.6539286", "0.639672", "0.63439494", "0.6307336", "0.62920564", "0.628318", "0.6257743", "0.62439185...
0.7855388
0
Return the string format for a given parameter.
def get_parameter_format(cls, parameter_name): formats = { 'tau': '%.3f', 'tsky': '%.1f', 'kelvin': '%.3e' } return formats.get(parameter_name, '%.3e')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parameter_string(self, parameter):\n if not self.has_converged or self.parameters is None:\n return None\n if parameter not in self.parameters:\n return None\n\n fmt = self.get_parameter_format(parameter)\n unit = self.get_parameter_unit(parameter)\n ...
[ "0.7667087", "0.72878444", "0.71903205", "0.68664265", "0.68105346", "0.68105346", "0.68084127", "0.6786722", "0.6781522", "0.67550427", "0.6714451", "0.6662671", "0.6652037", "0.6647457", "0.6626901", "0.6590343", "0.6559082", "0.6547835", "0.6534224", "0.6534224", "0.645761...
0.74919534
1
Return the parameter unit for the given parameter.
def get_parameter_unit(self, parameter_name): parameter_units = { 'tsky': units.Unit("Kelvin"), 'kelvin': self.data_unit } return parameter_units.get(parameter_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"unit\")", "def get_unit(self):\n return self.unit", "def unit(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"unit\")", "def unit(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"un...
[ "0.73394704", "0.7300321", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", ...
0.8258069
0
Return a string representation of the sky dip fit. Returns str
def __str__(self): if not self.has_converged or self.parameters is None: log.warning("The fit has not converged. Try again!") return '' result = [] for parameter in self.parameters.keys(): if parameter in self.fit_for: parameter_string = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n #Get an ordered list of the elements strings so it outputs always the same\n #string given a mass function.\n elements = []\n for element in self.focals:\n elements.append((element, str(element)))\n sortedList = sorted(elements, key=lambda x:x[1])\...
[ "0.63235986", "0.5925334", "0.5918602", "0.5917366", "0.59062576", "0.5836863", "0.58009154", "0.578009", "0.5776318", "0.57657", "0.5755946", "0.574386", "0.5697488", "0.569668", "0.5695591", "0.5693888", "0.56415474", "0.56415474", "0.5632635", "0.5627902", "0.5618648", "...
0.6171846
1
Report the HTTP server health.
def handle_health(): return flask.jsonify(status="up")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def health_check():\n app.logger.info(\"Health Check!\")\n return Response(\"All Good!\", status=200)", "def health():\n global _is_healthy\n template = render_template('health.html', healthy=_is_healthy)\n return make_response(template, 200 if _is_healthy else 500)", "def test_health(self) -> N...
[ "0.7330673", "0.72990686", "0.7261757", "0.7057571", "0.7043252", "0.6982577", "0.6782414", "0.67748505", "0.6683728", "0.6658292", "0.66400546", "0.663814", "0.66167766", "0.6598805", "0.6598805", "0.6545743", "0.64945024", "0.6450732", "0.6434992", "0.6426685", "0.6409966",...
0.6197213
34
get probands sequenced in Iossifov et al., Neuron 2012
def open_iossifov_neuron_cohort(): logging.info('getting Iossifov et al Neuron 2012 cohort') s1 = pandas.read_excel(supp_s1_url, sheet_name='SNV.v4.1-normlized') s2 = pandas.read_excel(supp_s2_url, sheet_name='suppLGKTable') s3 = pandas.read_excel(supp_s3_url, sheet_name='ID.v4.1-normlized') fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def margprobssites(self) :\n sitemargprobs=[]\n import scipy\n pmatrix=scipy.linalg.expm(self.q*self.v)\n for i in range(self.nsites) :\n initial=self.starts[i]\n final=self.finals[i]\n iindex=self.staspa.index(initial)\n findex=self.staspa.in...
[ "0.6610351", "0.65211", "0.6002573", "0.5910112", "0.5883997", "0.58525157", "0.58274126", "0.58165306", "0.5767805", "0.57469535", "0.57011425", "0.5692518", "0.56801045", "0.56781197", "0.567707", "0.5645529", "0.5620201", "0.560954", "0.5567139", "0.55655503", "0.5520175",...
0.0
-1
Check preconditions of hparams.
def check_hparams(self, hparams): error_messages = [] # Check global params. feature_names = hparams.get_feature_names() global_values, per_feature_values = hparams.get_global_and_feature_params( ['num_keypoints', 'missing_input_value', 'missing_output_value'], feature_names) globa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_params(self):\n pass", "def requires_hparams(self):\n return None", "def checkParameters(self):\n self.DEBUG(\"EDPluginExecDatGnomv1_0.checkParameters\")\n self.checkMandatoryParameters(self.dataInput, \"Data Input is None\")\n self.checkMandatoryParameters(self.dataIn...
[ "0.7320391", "0.7107705", "0.68613213", "0.6803819", "0.6776897", "0.6744108", "0.67127216", "0.6708308", "0.67014897", "0.66710943", "0.66500753", "0.66410565", "0.6586223", "0.65627277", "0.6512611", "0.6505922", "0.6488907", "0.645376", "0.6422583", "0.6355284", "0.6300580...
0.6701233
9
Calibrated linear classifier binary model. This model uses a piecewise linear calibration function on each of the real (as opposed to binary) inputs (parametrized) and then combines (sum up) the results. Optionally calibration can be made monotonic. It usually requires a preprocessing step on the data, to calculate the...
def calibrated_linear_classifier(feature_columns=None, model_dir=None, quantiles_dir=None, keypoints_initializers_fn=None, optimizer=None, config=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_calibrate_predict(clf, X_t, y_t, X_v, y_v, params, jobs):\n\n # Indicate the classifier and the training set size\n print(\"Training a {} with None...\".format(clf.__class__.__name__))\n\n # Train the classifier\n clf = train_classifier(clf, X_t, y_t, params, jobs)\n\n # # Calibrate classi...
[ "0.60893214", "0.60358334", "0.5759546", "0.5748178", "0.57063353", "0.56848466", "0.56386817", "0.5601485", "0.5578915", "0.5504322", "0.55038977", "0.549859", "0.54438186", "0.5441058", "0.5316333", "0.5284502", "0.52768564", "0.5275868", "0.52657294", "0.52634394", "0.5245...
0.6290439
0
Calibrated linear estimator (model) for regression. This model uses a piecewise linear calibration function on each of the inputs (parametrized) and then combine (sum up) the results. Optionally calibration can be made monotonic. It usually requires a preprocessing step on the data, to calculate the quantiles of each u...
def calibrated_linear_regressor(feature_columns=None, model_dir=None, quantiles_dir=None, keypoints_initializers_fn=None, optimizer=None, config=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calibrated_linear_classifier(feature_columns=None,\n model_dir=None,\n quantiles_dir=None,\n keypoints_initializers_fn=None,\n optimizer=None,\n config...
[ "0.6054098", "0.5928749", "0.5801186", "0.57329446", "0.57322824", "0.5710905", "0.57070893", "0.56966364", "0.56741047", "0.56055945", "0.55519617", "0.5540491", "0.5518398", "0.5488559", "0.54868513", "0.5474618", "0.54654014", "0.54624677", "0.54408914", "0.54407585", "0.5...
0.6264422
0
For a given WABBIT parameter file, check for the most common stupid errors
def check_parameters_for_stupid_errors( file ): import os # print('~~~~~~~~~~~~~~~~~~~~~ini-file~~~~~~~~~~~') # # read jobfile # with open(file) as f: # # loop over all lines # for line in f: # line = line.lstrip() # line = line.rstrip() # if len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkParamsError(self):\n # check if parameter combinations match with the simulation filename.\n for i, f in enumerate(self.yadeDataFiles):\n # get the file name fore the suffix\n f = f.split('.' + f.split('.')[-1])[0]\n # get parameters from the remaining string...
[ "0.6367045", "0.63627934", "0.626574", "0.6190518", "0.6190518", "0.61401314", "0.60877657", "0.607748", "0.6049413", "0.59709966", "0.59606194", "0.5958436", "0.5945568", "0.58771724", "0.5862091", "0.5859376", "0.5834433", "0.58315766", "0.5829629", "0.5814439", "0.5794336"...
0.73345405
0
check if a given parameter in the ini file exists or not. can be used to detect deprecated entries somebody removed
def exists_ini_parameter( inifile, section, keyword ): found_section = False found_parameter = False # read jobfile with open(inifile) as f: # loop over all lines for line in f: # once found, do not run to next section if found_section and line[0] == "[": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_config(cfg):", "def exists_ini_section( inifile, section ):\n found_section = False\n\n # read jobfile\n with open(inifile) as f:\n # loop over all lines\n for line in f:\n # until we find the section\n if \"[\"+section+\"]\" in line and line[0]!=\";\" and l...
[ "0.6333489", "0.63048834", "0.61332923", "0.60334665", "0.6019133", "0.59849584", "0.58812857", "0.5851556", "0.58060586", "0.57881004", "0.5765527", "0.5734839", "0.5717389", "0.56993365", "0.568473", "0.56755203", "0.56699747", "0.56562424", "0.56547135", "0.56511873", "0.5...
0.6938629
0
check if a given parameter in the ini file exists or not. can be used to detect deprecated entries somebody removed
def exists_ini_section( inifile, section ): found_section = False # read jobfile with open(inifile) as f: # loop over all lines for line in f: # until we find the section if "["+section+"]" in line and line[0]!=";" and line[0]!="!" and line[0]!="#": f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_ini_parameter( inifile, section, keyword ):\n found_section = False\n found_parameter = False\n\n # read jobfile\n with open(inifile) as f:\n # loop over all lines\n for line in f:\n\n # once found, do not run to next section\n if found_section and line[0]...
[ "0.69377685", "0.63323456", "0.6133095", "0.60329324", "0.60197425", "0.5983186", "0.58808696", "0.58505404", "0.5804031", "0.57878053", "0.57635015", "0.5735745", "0.5716882", "0.5698739", "0.56842005", "0.56746614", "0.5669832", "0.5655906", "0.5654727", "0.56496227", "0.56...
0.6303248
2
we look for the latest .h5 files to resume the simulation, and prepare the INI file accordingly. Some errors are caught.
def prepare_resuming_backup( inifile ): import numpy as np import os import glob import flusi_tools # does the ini file exist? if not os.path.isfile(inifile): raise ValueError("Inifile not found!") Tmax = get_ini_parameter(inifile, "Time", "time_max", float) dim = get_ini_para...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_phase(self):\r\n if not self.C.restart: # start preprocessing job from scratch\r\n if (\r\n os.path.exists(self.valid_h5_path)\r\n or os.path.exists(self.test_h5_path)\r\n or os.path.exists(self.train_h5_path)\r\n ):\r\n ...
[ "0.60261214", "0.5696248", "0.5661924", "0.5481591", "0.5385601", "0.5378313", "0.5364455", "0.5312231", "0.5307268", "0.52681684", "0.5235969", "0.5219296", "0.5212105", "0.5211143", "0.52081215", "0.51801795", "0.5176859", "0.5160141", "0.51429856", "0.5139128", "0.50798786...
0.57191813
1
Read a 2D/3D wabbit file and return a list of how many blocks are at the different levels
def block_level_distribution_file( file ): import h5py import numpy as np # open the h5 wabbit file fid = h5py.File(file,'r') # read treecode table b = fid['block_treecode'][:] treecode = np.array(b, dtype=float) # close file fid.close() # number of blocks Nb = treecode.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readGR3File(inputFilename):\n print 'Reading ' + inputFilename + ' ...'\n infile = open(inputFilename, 'r')\n description = infile.readline().strip() # remove leading/trailing whitespace\n tmpStr = infile.readline()\n nTriangles, nNodes = (int(s) for s in tmpStr.split())\n print ' nTriangle...
[ "0.62876856", "0.62518936", "0.60057634", "0.5994908", "0.5979423", "0.5979423", "0.59490186", "0.5920892", "0.58702004", "0.5859132", "0.5837403", "0.5836277", "0.5833768", "0.58279437", "0.5771492", "0.5762479", "0.57591116", "0.5756959", "0.5705301", "0.56720674", "0.56655...
0.707528
0
Read a wabbittype HDF5 of blockstructured data. Return time, x0, dx, box, data, treecode. Get number of blocks and blocksize as N, Bs = data.shape[0], data.shape[1]
def read_wabbit_hdf5(file, verbose=True, return_iteration=False): import h5py import numpy as np if verbose: print("~~~~~~~~~~~~~~~~~~~~~~~~~") print("Reading file %s" % (file) ) fid = h5py.File(file,'r') b = fid['coords_origin'][:] x0 = np.array(b, dtype=float) b = fid['c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_wabbit_hdf5( file, time, x0, dx, box, data, treecode, iteration = 0, dtype=np.float64 ):\n import h5py\n import numpy as np\n\n\n Level = np.size(treecode,1)\n if len(data.shape)==4:\n # 3d data\n Bs = np.zeros([3,1])\n N, Bs[0], Bs[1], Bs[2] = data.shape\n Bs = B...
[ "0.7095553", "0.684908", "0.67961204", "0.62631047", "0.608267", "0.6046284", "0.6046284", "0.5913353", "0.585708", "0.5756927", "0.57358474", "0.56931156", "0.5675092", "0.5658997", "0.55911225", "0.5576085", "0.5573528", "0.55517644", "0.55503565", "0.5536557", "0.5531724",...
0.74340147
0
Read a wabbittype HDF5 of blockstructured data. same as read_wabbit_hdf5, but reads ONLY the treecode array.
def read_treecode_hdf5(file): import h5py import numpy as np fid = h5py.File(file,'r') b = fid['block_treecode'][:] treecode = np.array(b, dtype=float) return treecode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_wabbit_hdf5(file, verbose=True, return_iteration=False):\n import h5py\n import numpy as np\n\n if verbose:\n print(\"~~~~~~~~~~~~~~~~~~~~~~~~~\")\n print(\"Reading file %s\" % (file) )\n\n fid = h5py.File(file,'r')\n b = fid['coords_origin'][:]\n x0 = np.array(b, dtype=flo...
[ "0.7511299", "0.68497235", "0.6839176", "0.6466713", "0.6055406", "0.6010037", "0.6009357", "0.5869854", "0.5803738", "0.57437724", "0.57119524", "0.5656739", "0.5625802", "0.5617597", "0.5598882", "0.55979973", "0.55816346", "0.5550571", "0.5539923", "0.5537304", "0.548983",...
0.7173856
1
Write data from wabbit to an HDF5 file
def write_wabbit_hdf5( file, time, x0, dx, box, data, treecode, iteration = 0, dtype=np.float64 ): import h5py import numpy as np Level = np.size(treecode,1) if len(data.shape)==4: # 3d data Bs = np.zeros([3,1]) N, Bs[0], Bs[1], Bs[2] = data.shape Bs = Bs[::-1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def write_hdf5(filename, data):\n \n if '.h5' in filename:\n fid = h5py.File(filename, 'w')\n else:\n filename = filename+'.h5'\n fid = h5py.File(filename, 'w')\n\n print('Writing %s...'%filename)\n\n write_hdf5_group(fid, data)\n\n fid....
[ "0.739396", "0.718801", "0.7148199", "0.69659054", "0.68264276", "0.6792738", "0.6753575", "0.66656506", "0.66584826", "0.6568733", "0.65683955", "0.6483694", "0.64607877", "0.63932073", "0.63770145", "0.632899", "0.63053787", "0.63048476", "0.63000256", "0.6252908", "0.62099...
0.7852353
0
Read all h5 files in directory dir. Return time, x0, dx, box, data, treecode. Use data["phi"][it] to reference quantity phi at iteration it
def read_wabbit_hdf5_dir(dir): import numpy as np import re import ntpath import os it=0 data={'time': [],'x0':[],'dx':[],'treecode':[]} # we loop over all files in the given directory for file in os.listdir(dir): # filter out the good ones (ending with .h5) if file.ends...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_h5_file_arvind_format(folder, filen):\n \n ### file path\n \n fpath = folder + filen + '.h5'\n assert os.path.exists(fpath), \"The out.h5 file does NOT exist for \" + fpath\n fl = h5py.File(fpath, 'r')\n \n ### cell information\n \n xu = np.array(fl['/positions/xu'], dtype=np...
[ "0.66390574", "0.65969133", "0.65183514", "0.64874375", "0.64845943", "0.6476374", "0.6446031", "0.6411749", "0.63776684", "0.63614887", "0.63193595", "0.62539995", "0.6228941", "0.6222934", "0.61189467", "0.61138064", "0.60822386", "0.6060295", "0.60524553", "0.60471475", "0...
0.7388911
0
This generic function adds the local convergence rate as nice labels between
def add_convergence_labels(dx, er): import numpy as np import matplotlib.pyplot as plt for i in range(len(dx)-1): x = 10**( 0.5 * ( np.log10(dx[i]) + np.log10(dx[i+1]) ) ) y = 10**( 0.5 * ( np.log10(er[i]) + np.log10(er[i+1]) ) ) order = "%2.1f" % ( convergence_order(dx[i:i+1+1],er[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _show_learning_rate():\n fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(6.4 * 2, 4.8))\n\n # Visualize c_prime\n c_prime_list = np.linspace(1, 100, num=11)\n x_label = f\"c'\"\n y_label = \"Minimum Clusters Size\"\n title = \"\"\n\n ax = axes[0]\n x_list = c_prime_list\n\n # MNI...
[ "0.5802661", "0.57484186", "0.5591566", "0.55610377", "0.554035", "0.5481976", "0.541913", "0.54128134", "0.5400878", "0.53928256", "0.52825266", "0.5259621", "0.5238246", "0.52341664", "0.52058315", "0.519785", "0.5196426", "0.5191651", "0.5189148", "0.51671124", "0.5163327"...
0.6630967
0
This is a small function that returns the convergence order, i.e. the least squares fit to the log of the two passed lists.
def convergence_order(N, err): import numpy as np if len(N) != len(err): raise ValueError('Convergence order args do not have same length') A = np.ones([len(err), 2]) B = np.ones([len(err), 1]) # ERR = A*N + B for i in range( len(N) ) : A[i,0] = np.log(N[i]) B[i] = np.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logfit(N, err):\n import numpy as np\n\n if len(N) != len(err):\n raise ValueError('Convergence order args do not have same length')\n\n A = np.ones([len(err), 2])\n B = np.ones([len(err), 1])\n # ERR = A*N + B\n for i in range( len(N) ) :\n A[i,0] = np.log10(N[i])\n B[i]...
[ "0.6337905", "0.62787294", "0.6042211", "0.5989017", "0.5960942", "0.5899967", "0.58939946", "0.58498496", "0.5838031", "0.5715212", "0.56407213", "0.56352633", "0.5627826", "0.56239766", "0.5622977", "0.55958897", "0.5592456", "0.55830264", "0.55826944", "0.55535156", "0.555...
0.67130005
0
This is a small function that returns the logfit, i.e. the least squares fit to the log of the two passed lists.
def logfit(N, err): import numpy as np if len(N) != len(err): raise ValueError('Convergence order args do not have same length') A = np.ones([len(err), 2]) B = np.ones([len(err), 1]) # ERR = A*N + B for i in range( len(N) ) : A[i,0] = np.log10(N[i]) B[i] = np.log10(err[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_exp_data(x_vals, y_vals):\n log_vals = []\n for y in y_vals:\n log_vals.append(math.log(y, 2)) #get log base 2\n fit = np.polyfit(x_vals, log_vals, 1)\n return fit, 2", "def logp(self, xs, ys, **kwargs):\n ind = np.isclose(self.predict(xs, **kwargs),ys)\n axis = tuple(ran...
[ "0.71505827", "0.64535785", "0.63110274", "0.62836516", "0.61950827", "0.613543", "0.6083297", "0.60600305", "0.6027912", "0.6003056", "0.5989711", "0.59861887", "0.59799457", "0.5965218", "0.59623635", "0.5953407", "0.5946081", "0.59381616", "0.59283286", "0.59197503", "0.59...
0.6784488
1
This is a small function that returns the logfit, i.e. the least squares fit to the log of the two passed lists.
def linfit(N, err): import numpy as np if len(N) != len(err): raise ValueError('Convergence order args do not have same length') A = np.ones([len(err), 2]) B = np.ones([len(err), 1]) # ERR = A*N + B for i in range( len(N) ) : A[i,0] = N[i] B[i] = err[i] x, residual...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_exp_data(x_vals, y_vals):\n log_vals = []\n for y in y_vals:\n log_vals.append(math.log(y, 2)) #get log base 2\n fit = np.polyfit(x_vals, log_vals, 1)\n return fit, 2", "def logfit(N, err):\n import numpy as np\n\n if len(N) != len(err):\n raise ValueError('Convergence ord...
[ "0.71505827", "0.6784488", "0.64535785", "0.63110274", "0.62836516", "0.61950827", "0.613543", "0.6083297", "0.60600305", "0.6027912", "0.6003056", "0.5989711", "0.59861887", "0.59799457", "0.5965218", "0.59623635", "0.5953407", "0.5946081", "0.59381616", "0.59283286", "0.591...
0.0
-1
Read and plot a 2D wabbit file. Not suitable for 3D data, use Paraview for that.
def plot_wabbit_file( file, savepng=False, savepdf=False, cmap='rainbow', caxis=None, caxis_symmetric=False, title=True, mark_blocks=True, block_linewidth=1.0, gridonly=False, contour=False, ax=None, fig=None, ticks=True, colorbar=True, dpi=300, block_edge_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readpil3d(self):\r\n\r\n # Read the data in as an array.\r\n res = np.loadtxt(self.name, delimiter=' ')\r\n\r\n # Split into useful chunks\r\n self.pos = res[:, 0:3] # Grid point locations\r\n self.Pn = res[:, 3:4] # Normal pressure [Pa]\r\n self.flux = res[...
[ "0.6419704", "0.5728336", "0.57164586", "0.56596476", "0.558751", "0.5581649", "0.55814993", "0.55613047", "0.5553209", "0.5500591", "0.54784054", "0.5467062", "0.5463366", "0.54342484", "0.5429662", "0.53756815", "0.53702176", "0.536499", "0.53567004", "0.53496575", "0.53309...
0.6046627
1
Compute the error (in some norm) wrt a flusi field. Useful for example for the halfswirl test where no exact solution is available at midtime (the time of maximum distortion)
def wabbit_error_vs_flusi(fname_wabbit, fname_flusi, norm=2, dim=2): import numpy as np import insect_tools import matplotlib.pyplot as plt if dim==3: print('I think due to fft2usapmle, this routine works only in 2D') raise ValueError # read in flusi's reference solution time_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flusi_error_vs_flusi(fname_flusi1, fname_flusi2, norm=2, dim=2):\n import numpy as np\n import insect_tools\n\n # read in flusi's reference solution\n time_ref, box_ref, origin_ref, data_ref = insect_tools.read_flusi_HDF5( fname_flusi1 )\n\n time, box, origin, data_dense = insect_tools.read_flus...
[ "0.69146353", "0.613854", "0.6006402", "0.59836626", "0.5956054", "0.58681345", "0.5857232", "0.5832136", "0.58062094", "0.57819855", "0.5752377", "0.5749396", "0.57453936", "0.5729398", "0.56359434", "0.5624339", "0.5618825", "0.5573806", "0.5553906", "0.55269307", "0.551801...
0.597056
4
compute error given two flusi fields
def flusi_error_vs_flusi(fname_flusi1, fname_flusi2, norm=2, dim=2): import numpy as np import insect_tools # read in flusi's reference solution time_ref, box_ref, origin_ref, data_ref = insect_tools.read_flusi_HDF5( fname_flusi1 ) time, box, origin, data_dense = insect_tools.read_flusi_HDF5( fnam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_compute(self):\n self.tt_error = np.linalg.norm(self.rel_error)\n if self.global_rank==0:print('Overall error is::',self.tt_error)\n return {'NMF': self.rel_error, 'tt': self.tt_error}", "def _compute_error(self,expected_out,actual_out,error_func):\n\n error = error_func(exp...
[ "0.6367832", "0.62551594", "0.61732644", "0.6122448", "0.60979503", "0.60338694", "0.60156256", "0.6001351", "0.59415543", "0.592916", "0.5922433", "0.59000087", "0.58998704", "0.5872513", "0.5853913", "0.5831379", "0.58297896", "0.5827409", "0.5809093", "0.57668793", "0.5764...
0.65988445
0
Read two wabbit files, which are supposed to have all blocks at the same level. Then, we rearrange the data in a dense matrix (wabbit_tools.dense_matrix)
def wabbit_error_vs_wabbit(fname_ref_list, fname_dat_list, norm=2, dim=2): import numpy as np import matplotlib.pyplot as plt if not isinstance(fname_ref_list, list): fname_ref_list = [fname_ref_list] if not isinstance(fname_dat_list, list): fname_dat_list = [fname_dat_list] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_matrices(self):\n self.wine_matrix = np.array(self.parse_file_into_array('winequality-red.csv', ';'))\n self.cancer_matrix = np.array(self.parse_file_into_array('breast-cancer-wisconsin.data', ','))", "def to_dense_grid( fname_in, fname_out = None, dim=2 ):\n import numpy as np\n imp...
[ "0.5752716", "0.574704", "0.5696072", "0.5435499", "0.5383064", "0.53545874", "0.53524417", "0.5352231", "0.5310169", "0.5301232", "0.5260769", "0.5241401", "0.52343833", "0.5233705", "0.5229119", "0.52273935", "0.5201213", "0.51901865", "0.5185642", "0.5175117", "0.51649094"...
0.49550754
43
Convert a WABBIT grid to a full dense grid in a single matrix. We asssume here that interpolation has already been performed, i.e. all blocks are on the same (finest) level.
def to_dense_grid( fname_in, fname_out = None, dim=2 ): import numpy as np import insect_tools import matplotlib.pyplot as plt # read data time, x0, dx, box, data, treecode = read_wabbit_hdf5( fname_in ) # convert blocks to complete matrix field, box = dense_matrix( x0, dx, data, treecode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sparse_matrix(self, grid, format=None):\n S = self.centered_stencil()\n # print(\"grid :\")\n\n grid = tuple(grid)\n # print(grid)\n if not (np.asarray(S.shape) % 2 == 1).all():\n raise ValueError('all stencil dimensions must be odd')\n\n assert_condition...
[ "0.5821582", "0.5726809", "0.5702125", "0.5558751", "0.5553554", "0.5539239", "0.5486648", "0.5427895", "0.5423916", "0.537605", "0.53138", "0.53079635", "0.52916086", "0.52071506", "0.5201484", "0.5168702", "0.5151044", "0.51481164", "0.51444805", "0.51429015", "0.513387", ...
0.6513067
0
Compare two grids. The number returned is the % of blocks from treecode1 which have also been found in treecode2
def compare_two_grids( treecode1, treecode2 ): import numpy as np common_blocks = 0 for i in range(treecode1.shape[0]): # we look for this tree code in the second array code1 = treecode1[i,:] for j in range(treecode2.shape[0]): code2 = treecode2[j,:] if np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PDiffGrids(A, B):\n if (A.xllcorner,A.yllcorner) == (B.xllcorner,B.yllcorner) and (A.ncols,A.nrows)==(B.ncols,B.nrows):\n Bx = numpy.where(B.data != B.nodata, B.data, 1.0)\n Bx = numpy.where(B.data != 0., B.data, 1.0)\n C = 100. * (A.data-Bx)/Bx\n New = grid(C, A.xllcorner, A.yll...
[ "0.65731466", "0.63465333", "0.6300452", "0.6264339", "0.61934185", "0.61712897", "0.5996527", "0.5989321", "0.5979154", "0.5934525", "0.59334546", "0.59026194", "0.58587474", "0.58309686", "0.58261055", "0.5805267", "0.57949764", "0.5784748", "0.5769305", "0.5745499", "0.574...
0.83875257
0
On all blocks of the data array, replace any function values by the level of the block
def overwrite_block_data_with_level(treecode, data): if len(data.shape) == 4: N = treecode.shape[0] for i in range(N): level = treecode_level(treecode[i,:]) data[i,:,:,:] = float( level ) elif len(data.shape) == 3: N = treecode.shape[0] for i in range(N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_block(self, block_id, func=..., edges=..., inplace=...): # -> None:\n ...", "def postSI(self):\n # for cell in self.cells:\n # cell.resetTotOrdFlux()\n self.depth = 0", "def replace(arr, fixers, data_tag='mydata', logger=None):\n # if logger not provided, create def...
[ "0.5757027", "0.5234304", "0.5134023", "0.51197505", "0.5062385", "0.50325173", "0.50212735", "0.48631778", "0.4849501", "0.48456857", "0.47853938", "0.47664374", "0.4762566", "0.4750089", "0.47483295", "0.47385266", "0.47344804", "0.4733381", "0.4728765", "0.47240093", "0.47...
0.7074382
0
This routine performs a shell command on each .h5 file in a given directory!
def command_on_each_hdf5_file(directory, command): import re import os import glob if not os.path.exists(directory): err("The given directory does not exist!") files = glob.glob(directory+'/*.h5') files.sort() for file in files: c = command % file os.system(c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_h5(walk_dir):\n\n file_list = []\n for root, subdirs, files in os.walk(walk_dir):\n\n for filename in files:\n file_path = os.path.join(root, filename)\n if file_path[-2:] == 'h5':\n file_list.append(file_path)\n\n return file_list", "def h5ls(h5o, ma...
[ "0.69875836", "0.6177355", "0.59026027", "0.57904077", "0.5747277", "0.57445157", "0.5651457", "0.5643685", "0.56236434", "0.5591664", "0.55789", "0.555372", "0.5539781", "0.5523432", "0.5506336", "0.54694766", "0.54544675", "0.5440774", "0.5433494", "0.5421979", "0.54104507"...
0.8061157
0
Convert directory with flusi h5 files to wabbit h5 files
def flusi_to_wabbit_dir(dir_flusi, dir_wabbit , *args, **kwargs ): import re import os import glob if not os.path.exists(dir_wabbit): os.makedirs(dir_wabbit) if not os.path.exists(dir_flusi): err("The given directory does not exist!") files = glob.glob(dir_flusi+'/*.h5') fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def h5root():\n with h5py.File('dummy.nxs', mode='w', driver=\"core\", backing_store=False) as f:\n yield f", "def read_wabbit_hdf5_dir(dir):\n import numpy as np\n import re\n import ntpath\n import os\n\n it=0\n data={'time': [],'x0':[],'dx':[],'treecode':[]}\n # we loop over all...
[ "0.63210124", "0.62002695", "0.60205424", "0.59618264", "0.58658123", "0.58440155", "0.57978594", "0.57177514", "0.57131207", "0.56950307", "0.5659476", "0.5612546", "0.55923796", "0.5582833", "0.5499074", "0.5433757", "0.54336375", "0.54284495", "0.53850937", "0.5381837", "0...
0.74297935
0
Convert flusi data file to wabbit data file.
def flusi_to_wabbit(fname_flusi, fname_wabbit , level, dim=2, dtype=np.float64 ): import numpy as np import insect_tools import matplotlib.pyplot as plt # read in flusi's reference solution time, box, origin, data_flusi = insect_tools.read_flusi_HDF5( fname_flusi, dtype=dtype ) box = box[1:] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flusi_to_wabbit_dir(dir_flusi, dir_wabbit , *args, **kwargs ):\n import re\n import os\n import glob\n\n if not os.path.exists(dir_wabbit):\n os.makedirs(dir_wabbit)\n if not os.path.exists(dir_flusi):\n err(\"The given directory does not exist!\")\n\n files = glob.glob(dir_flus...
[ "0.6466376", "0.5578025", "0.5258005", "0.52233136", "0.5194225", "0.5156527", "0.51492476", "0.51063263", "0.50713205", "0.5061902", "0.50611764", "0.5058425", "0.5032972", "0.5028185", "0.50022244", "0.48981017", "0.4894581", "0.48687062", "0.48647705", "0.48561457", "0.484...
0.6721087
0
This function creates a _.h5 file with the wabbit block structure from a given dense data matrix. Therefore the dense data is divided into equal blocks, similar as sparse_to_dense option in wabbitpost.
def dense_to_wabbit_hdf5(ddata, name , Bs, box_size = None, time = 0, iteration = 0, dtype=np.float64): # concatenate filename in the same style as wabbit does fname = name + "_%12.12d" % int(time*1e6) + ".h5" Ndim = ddata.ndim Nsize = np.asarray(ddata.shape) level = 0 Bs = np.asarray(Bs)# make ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dense_grid( fname_in, fname_out = None, dim=2 ):\n import numpy as np\n import insect_tools\n import matplotlib.pyplot as plt\n\n # read data\n time, x0, dx, box, data, treecode = read_wabbit_hdf5( fname_in )\n\n # convert blocks to complete matrix\n field, box = dense_matrix( x0, dx, ...
[ "0.7129957", "0.7095275", "0.61546594", "0.59248036", "0.56526315", "0.5634567", "0.56303704", "0.5613793", "0.56120116", "0.5585933", "0.5540948", "0.5519374", "0.54959834", "0.5490673", "0.54355556", "0.5431243", "0.5422526", "0.54188895", "0.5410818", "0.5400482", "0.53950...
0.7183506
0
For a given shape of a dense field and maxtreelevel return the number of points per block wabbit uses
def field_shape_to_bs(Nshape, level): n = np.asarray(Nshape) for d in range(n.ndim): # check if Block is devidable by Bs if (np.remainder(n[d], 2**level) != 0): err("Number of Grid points has to be a power of 2!") # Note we have to flip n here because Bs = [Bs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levshape(self) -> Shape:\n return tuple(len(x) for x in self.levels)", "def num_leaves(tree):\n return ((tree.n_node_samples > 0) & (tree.feature == INVALID_VALUE)).sum()", "def look_for_biggest_structure(game, chunk, imgs, hmap, nmax, type_):\n for n in range(nmax,0,-1):\n i = 0\n ...
[ "0.5944209", "0.5931977", "0.59228444", "0.5885477", "0.58495086", "0.58354104", "0.583087", "0.5816749", "0.5765453", "0.5728219", "0.56949294", "0.56836003", "0.5661081", "0.5652596", "0.5649814", "0.5644827", "0.56374794", "0.5623013", "0.5621187", "0.5620981", "0.5608256"...
0.5566646
24
Transform the data and write out as a TFRecord of Example protos.
def transform(train_data, test_data, working_dir): options = PipelineOptions() options.view_as(StandardOptions).runner = 'DirectRunner' with beam.Pipeline(options=options) as pipeline: _ = (pipeline | 'ReadTrainData' >> beam.Create(train_data) | 'EncodeTrainData' >> beam.Map(lambda data: to_example(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_example(self, output_file, data_dict):\n print('Generating %s' % output_file)\n with tf.compat.v1.python_io.TFRecordWriter(output_file) as record_writer:\n data = data_dict['data'].astype(np.int8)\n labels = data_dict['label'].astype(np.int64)\n num_entries_in_batch = len(labels)\...
[ "0.7601864", "0.7601864", "0.73363864", "0.7253738", "0.704304", "0.7021169", "0.6914192", "0.6816245", "0.67292994", "0.6721178", "0.6699888", "0.6662521", "0.66141754", "0.6612348", "0.65940547", "0.65909016", "0.6586768", "0.6542893", "0.6498155", "0.6449436", "0.6435666",...
0.60572654
42
Semantic segmentation network definition
def inference(): print("setting up vgg initialized conv layers ...") model_data = utils.get_model_data(FLAGS.model_dir, MODEL_URL) mean = model_data['normalization'][0][0][0] mean_pixel = np.mean(mean, axis=(0, 1)) weights = np.squeeze(model_data['layers']) with tf.variable_scope("inference"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def macro_network():\n # fmt: off\n tpm = np.array([\n [0.3, 0.3, 0.3, 0.3],\n [0.3, 0.3, 0.3, 0.3],\n [0.3, 0.3, 0.3, 0.3],\n [0.3, 0.3, 1.0, 1.0],\n [0.3, 0.3, 0.3, 0.3],\n [0.3, 0.3, 0.3, 0.3],\n [0.3, 0.3, 0.3, 0.3],\n [0.3, 0.3, 1.0, 1.0],\n ...
[ "0.60830534", "0.60496855", "0.59802425", "0.595663", "0.5847172", "0.5820586", "0.5727076", "0.5702224", "0.5695941", "0.56869364", "0.56733644", "0.5624573", "0.56224674", "0.5618467", "0.55787534", "0.5577703", "0.55772173", "0.5574059", "0.5552585", "0.5543071", "0.554214...
0.0
-1
convert hash_str to hash_dec
def hash2dec(hash_str: str) -> int: length = len(hash_str) bases = [32 ** i for i in range(length)][::-1] dec = 0 for i, d in enumerate(hash_str): dec += ch2int[d] * bases[i] return dec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_string_to_int(\r\n k: bytes,\r\n e: str,\r\n) -> int:\r\n return int.from_bytes(hash_string(k, e), 'big')", "def strhash(s: str) -> int:\n h = hashlib.md5(s.encode('utf-8'))\n h = int(h.hexdigest(), base=16)\n return h", "def dec2hash(hash_dec: int, pre: int) -> str:\n bas...
[ "0.676085", "0.6701529", "0.6644186", "0.64678264", "0.64379567", "0.64147437", "0.6400152", "0.63800716", "0.6376264", "0.63746643", "0.63039637", "0.62607664", "0.62387604", "0.62307084", "0.62161714", "0.61618865", "0.61301386", "0.61214674", "0.6107932", "0.60902554", "0....
0.81465983
0
convert hash_dec to hash_str
def dec2hash(hash_dec: int, pre: int) -> str: bases = [32 ** i for i in range(pre)][::-1] hash_str = "" v = hash_dec for b in bases: a = v // b v = v % b hash_str += ch32[a] return hash_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_str(c, hash_length):\n if isinstance(c, float):\n if numpy.isnan(c):\n return c\n raise ValueError(f\"numpy.nan expected, not {c}\")\n m = hashlib.sha256()\n m.update(c.encode(\"utf-8\"))\n r = m.hexdigest()\n if len(r) >= hash_length:\n return r[:hash_length...
[ "0.67123157", "0.6692818", "0.66889405", "0.66310173", "0.6559617", "0.65580744", "0.6501489", "0.64891833", "0.64672464", "0.6397518", "0.6363674", "0.63632846", "0.6330039", "0.63063854", "0.6293308", "0.6279598", "0.627666", "0.6234947", "0.62323284", "0.62225", "0.6185577...
0.7153087
0
convert lat, lon coordinate to decimal geohash representation (pre=6)
def coords2geohash_dec(*, lat: float, lon: float, pre: int = 6) -> int: return hash2dec(encoder(lat, lon, pre))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode(geohash):\n lat_val, lng_val, lat_err, lng_err = _decode_val_err(geohash)\r\n precision = _get_precision(lng_err)\n lat_val = \"%.*f\" % (precision, lat_val)\r\n lng_val = \"%.*f\" % (precision, lng_val)\r\n return lat_val, lng_val", "def geohash_encode(latitude, longitude, precision=1...
[ "0.7197927", "0.7073706", "0.6947506", "0.68074983", "0.67318535", "0.66749907", "0.66701984", "0.65034956", "0.64117384", "0.6199895", "0.61259615", "0.59396446", "0.5933387", "0.59319395", "0.57969904", "0.5766618", "0.5754867", "0.5753793", "0.5708975", "0.56883526", "0.56...
0.7521665
0
convert decimal geohash to lat, lon coordinate (we require pre=6)
def geohash_dec2coords(*, geohash_dec: int, pre: int = 6) -> Tuple[float, float]: res = decoder(dec2hash(geohash_dec, pre=pre)) return round(sum(res[0]) / 2, max(3, pre - 3)), round( sum(res[1]) / 2, max(3, pre - 3) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode(geohash):\n lat_val, lng_val, lat_err, lng_err = _decode_val_err(geohash)\r\n precision = _get_precision(lng_err)\n lat_val = \"%.*f\" % (precision, lat_val)\r\n lng_val = \"%.*f\" % (precision, lng_val)\r\n return lat_val, lng_val", "def coords2geohash_dec(*, lat: float, lon: float, p...
[ "0.7526719", "0.7387216", "0.7375263", "0.63441426", "0.6267863", "0.624697", "0.6224477", "0.6146233", "0.6016872", "0.5977346", "0.592548", "0.5918737", "0.5868537", "0.5856564", "0.5801432", "0.5772634", "0.57722", "0.5735534", "0.57101923", "0.570122", "0.5676153", "0.5...
0.7478197
1
Method to return a custom logger with the given name and level
def my_custom_logger(logger_name, level=logging.INFO): logger = logging.getLogger(logger_name) logger.setLevel(level) format_string = ('%(asctime)s, %(levelname)s, %(filename)s, %(message)s') log_format = logging.Formatter(format_string) # Creating and adding the console handler console_handler ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logger(name: str, level: str = LOG_LEVEL) -> logging.Logger:\n logger = logging.getLogger(name)\n logger.propagate = False\n logger.setLevel(level)\n coloredlogs.install(\n level=level, logger=logger, fmt='%(asctime)s %(name)s: %(lineno)s %(levelname)s: %(message)s', field_styles=FIELD_S...
[ "0.81156564", "0.80115414", "0.79588497", "0.774673", "0.77105635", "0.7634092", "0.7624498", "0.76038194", "0.75276273", "0.74171513", "0.73107415", "0.7245147", "0.72039235", "0.71859866", "0.71816105", "0.7040017", "0.7033277", "0.6987893", "0.69791347", "0.69768167", "0.6...
0.73898995
10
function that takes one argument, compares and returns results based on the argument supplied to the function
def data_type(value): if type(value) == type(None): return 'no value' elif type(value) == list: if len(value) >= 3: return value[2] else: return None elif type(value) == bool: return value elif type(value) == int: if value < 100: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(a, b):\n return a - b", "def compare(a, b):\n # Your function body should begin here.\n pass", "def compare(a, b):\n if a > b:\n return a\n return b", "def compareFn(impl1, impl2):\n for (v1, v2) in zip(\n [extractDigits(f.strip()) for f in impl1.split(\",\")],\n ...
[ "0.6585621", "0.65484715", "0.6427431", "0.6168221", "0.6134509", "0.60055876", "0.59661186", "0.5960077", "0.5960077", "0.5960077", "0.5941255", "0.5940668", "0.5891304", "0.5846155", "0.58251274", "0.5801914", "0.5783762", "0.57126707", "0.5700952", "0.5664475", "0.563011",...
0.0
-1
uploads file to Google Cloud storage
def _cloud_storage_upload(local_file, bucket, filename_on_bucket): client = storage.Client() bucket = client.get_bucket(bucket) blob = bucket.blob(filename_on_bucket) blob.upload_from_filename(local_file) print('uploaded ', bucket, filename_on_bucket)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_to_gcs():\n client = storage.Client(project=\"filmreccommendations\")\n bucket = client.get_bucket(\"filmreccommendations.appspot.com\")\n blob = bucket.blob(os.path.basename(PICKLE_FILENAME))\n blob.upload_from_filename(PICKLE_FILENAME)", "def gcloud_upload_file(file):\n if not file:\n...
[ "0.7862477", "0.7417298", "0.73990583", "0.7352191", "0.7321791", "0.7267003", "0.6985354", "0.69010127", "0.6875503", "0.68445647", "0.68404883", "0.6832378", "0.6829256", "0.67942363", "0.67374986", "0.67214787", "0.67042154", "0.66991466", "0.6689875", "0.6675743", "0.6637...
0.74267185
1
Returns a set with all nodes contained in the specified group.
def make_set(g, nodes): s = Set() names = nodes['names'] for ii,name in enumerate(names): """ We will assume node is entirely contained in group if they have one atom in common """ atoms = mdn.dic2list(nodes[name]['atoms']) atom0 = atoms[0] if (atom0 in mdn.dic2list(g['atoms'])): s.add(ii) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_nodes(self, group, namespace=None):\n source = self._source(namespace)\n return self._list(source, 'map', group)", "def get_nodeset(self):\n return set(self.nodeset) # return the nodeset", "def get_nodes(self):\n return_set = set()\n for value in self._name:\n ...
[ "0.7057669", "0.6412436", "0.6143436", "0.61363167", "0.6067383", "0.6000612", "0.5960207", "0.5856612", "0.583617", "0.57776505", "0.5762336", "0.5747678", "0.56864786", "0.56805146", "0.56712276", "0.5657101", "0.5638051", "0.5605475", "0.5574436", "0.55193394", "0.5516074"...
0.62811893
2
Lists all the catalystport bindings
def get_all_catalystport_bindings(): LOG.debug("get_all_catalystport_bindings() called") session = db.get_session() try: bindings = session.query (catalyst_models.CatalystPortBinding).all() return bindings except exc.NoResultFound: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bindings(self):\n return self.__bindings", "def list_ports(state):\n\tstate.report()", "def list_ports(self):\n return self.ironic_client.port.list()", "def port_list(self):\n return self._port_list", "def get_all_port(self, conf, dpid):\n\t\tpass", "def getBindings(self):\n r...
[ "0.6451805", "0.62612075", "0.58983856", "0.5897845", "0.579027", "0.5786138", "0.5704574", "0.56907016", "0.5677487", "0.56535304", "0.56521446", "0.56430465", "0.5607622", "0.56039107", "0.5600516", "0.55635554", "0.55596274", "0.5467314", "0.5458655", "0.5453633", "0.54411...
0.78534424
0
Lists catalyst port binding for particular vlan
def get_catalystport_binding(vland_id): LOG.debug("get_catlystport_binding() called") session = db.get_session() try: binding = (session.query(catalyst_models.CatalystPortBinding). \ filter_by(vland_id).all()) return binding except exc.NoresultFound: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_ports(state):\n\tstate.report()", "def display_port(self):\n ports=os.popen(\"sudo netstat -ntlp\").read().strip().splitlines()[2:]\n for port in ports:\n split=re.split('[\\s]+',port)\n self.portDic[\"Protcol\"]=split[0]\n self.portDic[\"Receive Q\"]=split...
[ "0.6723886", "0.64618164", "0.64385796", "0.64146525", "0.63710177", "0.6335538", "0.6304014", "0.6206474", "0.61226624", "0.6054834", "0.6002115", "0.59913033", "0.5865777", "0.58342767", "0.5811998", "0.5795699", "0.5788664", "0.57422847", "0.5704238", "0.56896126", "0.5671...
0.63200647
6
Adds a catalystport binding
def add_catalystport_binding(port_id, vlan_id): LOG.debug("add_catalystport_binding() called") session = db.get_session() binding = catalyst_models.CatalystPortBinding(port_id, vlan_id) session.add(binding) session.flush() return binding
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_binding(ctx, binding_name, pool_name, acl_name, nat_type, twice_nat_id):\n\n entryFound = False\n table = 'NAT_BINDINGS'\n key = binding_name\n dataKey1 = 'access_list'\n dataKey2 = 'nat_pool'\n dataKey3 = 'nat_type'\n dataKey4 = 'twice_nat_id'\n\n if acl_name is None:\n acl_...
[ "0.6066342", "0.6021122", "0.5959869", "0.5917959", "0.5857227", "0.5852962", "0.5653113", "0.56476676", "0.55153096", "0.5501996", "0.5498605", "0.5429331", "0.5401681", "0.53849334", "0.5362603", "0.53139096", "0.52629244", "0.5251845", "0.5244616", "0.5243897", "0.52343386...
0.7463989
0
Removes a catalystport binding
def remove_catalystport_binding(vlan_id): LOG.debug("remove_catalystport_binding() called") session = db.get_session() try: binding = (session.query(catalyst_models.CatalystPortBinding). filter_by(vlan_id=vlan_id).all()) for bind in binding: session.delete...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_binding(ctx, binding_name):\n\n entryFound = False\n table = 'NAT_BINDINGS'\n key = binding_name\n\n if len(binding_name) > 32:\n ctx.fail(\"Invalid binding name. Maximum allowed binding name is 32 characters !!\")\n\n config_db = ConfigDBConnector()\n config_db.connect()\n\n ...
[ "0.73616654", "0.6799897", "0.6344198", "0.6337611", "0.617905", "0.6130057", "0.61269933", "0.6104561", "0.5963844", "0.5883558", "0.58721596", "0.5811271", "0.5778574", "0.5777863", "0.57622343", "0.5755362", "0.5706742", "0.5679512", "0.5677332", "0.5649031", "0.5630688", ...
0.7389213
0
Use encoder to get embedding vectors first.
def distances_from_obs(self, session, obs_first, obs_second, hashes_first=None, hashes_second=None, **kwargs): obs_encoder = self.obs_encoder if hashes_first is None: hashes_first = [hash_observation(obs) for obs in obs_first] if hashes_second is None: hashes_second = [h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_embeddings(encoder, data_batches):\n\n vectors = []\n for batch in iter(data_batches):\n X, Y = batch\n X_embedded = encoder(X)\n for vec in np.array(X_embedded):\n vectors.append(vec)\n vectors = np.array(vectors)\n\n return vectors", "def set_embeddings(s...
[ "0.7020101", "0.6637058", "0.6564788", "0.6535303", "0.6484196", "0.6471777", "0.63643616", "0.6341164", "0.6330869", "0.62297994", "0.6209872", "0.62074643", "0.61839", "0.61733645", "0.61321247", "0.6101453", "0.6098147", "0.6074956", "0.607458", "0.6064943", "0.60478055", ...
0.0
-1
Returns True if the server is running
def is_running(self): return self._running
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ServerIsRunning( self ):\n return utils.ProcessIsRunning( self._gocode_handle )", "def status(self):\n # process running ?\n pid = self.get_pidfile()\n \n running = True\n \n # process is not running\n if pid is None:\n running = False\n ...
[ "0.8809185", "0.8009785", "0.8002331", "0.7958592", "0.7890142", "0.7879066", "0.78770465", "0.7851644", "0.7850044", "0.78008723", "0.77929753", "0.77749777", "0.7774173", "0.7757005", "0.77514684", "0.77514684", "0.77514684", "0.77452874", "0.7717644", "0.7717644", "0.77032...
0.7632167
26
Return interface being listened on
def interface(self): return self._interface
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_interface(self):\n return self.__interface", "def _get_interface(self):\n return self.__interface", "def _get_interface(self):\n return self.__interface", "def _get_interface(self):\n return self.__interface", "def _get_interface(self):\n return self.__interface", "def _get_interf...
[ "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.78353", "0.7473333", "0.7236905", "0.7236905", "0.7236905", "0.7236905", "0.7236905", "0.7236905", "0.70470303", ...
0.7632904
15
Return interface port number listener is configured for
def port(self): return self._port
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_port(self) -> int:\n return int(self.socket.getsockname()[1])", "def get_port(self) -> int:\n return self._port", "def port(self) -> int:", "def get_port(self):\n return self.port", "def port(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"port\")", "def port(s...
[ "0.7530533", "0.7471657", "0.7419851", "0.73832756", "0.7280439", "0.7280439", "0.72383", "0.7234966", "0.7234966", "0.7234966", "0.7211949", "0.7210165", "0.71787095", "0.7175771", "0.71601677", "0.71456337", "0.7141916", "0.7101398", "0.7101398", "0.7101398", "0.7101398", ...
0.68487716
44
Default access mechanism if API does not specify it
def default_access_control(self): return self._default_access_control
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_access(self):\n pass", "def access():", "def api_access(self):\n return self._api_access", "def maya_useNewAPI():\n\tpass", "def maya_useNewAPI():\n\tpass", "def maya_useNewAPI():\r\n\r\n pass", "def api_get(self, name):\n try:\n r = self._get(['apis', nam...
[ "0.6620378", "0.62082165", "0.5927204", "0.58691835", "0.58691835", "0.5855044", "0.58468324", "0.57812655", "0.5763495", "0.5763495", "0.5763495", "0.5763495", "0.5763495", "0.57499105", "0.56996876", "0.564842", "0.5636248", "0.56194305", "0.5615304", "0.558719", "0.5577919...
0.5198949
53
Get the current resource/API
def api(self): return self._api
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api(self):\n return self.api", "def api(self):\r\n return self._api", "def api(self):\n return self.__api", "def getAPI(self):\n return self.api_url", "def getResource(self):\n return self.serviceClass.app.resource()", "def get_api(self):\n from geoffrey....
[ "0.7800824", "0.7528681", "0.7499402", "0.73490024", "0.6924", "0.69182336", "0.68368024", "0.68043464", "0.66442335", "0.66442335", "0.66442335", "0.66442335", "0.66442335", "0.66442335", "0.66442335", "0.65007555", "0.6493793", "0.6491067", "0.6483726", "0.6483726", "0.6476...
0.7439773
6
Set the API resources
def api(self, api): if self._running: raise ValueError('API cannot be modified while the server is running') self._api = api
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources(self, resources):\n self._resources = resources", "def resources(self, resources):\n\n self._resources = resources", "def resources(self, resources):\n\n self._resources = resources", "def resources(self, resources):\n\n self._resources = resources", "def resources...
[ "0.74864537", "0.742781", "0.742781", "0.742781", "0.742781", "0.69810915", "0.6825962", "0.6772192", "0.66917735", "0.66321164", "0.64988405", "0.64539236", "0.6449976", "0.6399484", "0.63794327", "0.6372078", "0.63311076", "0.62079686", "0.6152585", "0.6030097", "0.6025588"...
0.0
-1
Start the server if it is not running
def start(self): if not self._running: try: resource = self._default_access_control.secure_resource(self._api) site = Site(resource=resource) self._listener = reactor.listenTCP(self._port, # pylint: disable=no-member ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_server(self):\n if not self._server:", "def start():\n\n start_server()", "def local_webserver_start():\n if not _is_webserver_running():\n local(_webserver_command())", "def run():\n server = current_server()\n server._auto_stop = True\n return start()", "def...
[ "0.8494984", "0.7766544", "0.7548727", "0.73513985", "0.7320159", "0.7309142", "0.72342896", "0.72342896", "0.7074414", "0.69020855", "0.68957585", "0.6856507", "0.68551105", "0.68490946", "0.6826151", "0.6805642", "0.6805338", "0.67718863", "0.67642325", "0.673737", "0.67260...
0.6707576
22
Test whether the numpy data type `dt` can be safely cast to an int.
def _safely_castable_to_int(dt): int_size = np.dtype(int).itemsize safe = (np.issubdtype(dt, np.signedinteger) and dt.itemsize <= int_size) or ( np.issubdtype(dt, np.unsignedinteger) and dt.itemsize < int_size ) return safe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_integer(x):\n return (not isinstance(x, (bool, np.bool))) and \\\n isinstance(x, (numbers.Integral, int, np.int, np.long, long)) # no long type in python 3", "def is_int(x):\n # From sktime: BSD 3-Clause\n # boolean are subclasses of integers in Python, so explicitly exclude them\n re...
[ "0.68389726", "0.67490387", "0.6626902", "0.6598004", "0.6508628", "0.64784265", "0.64210194", "0.6398246", "0.63903487", "0.6372374", "0.6356024", "0.6314418", "0.63074124", "0.6301813", "0.6293644", "0.62889963", "0.6231258", "0.62195265", "0.6181786", "0.6180847", "0.61740...
0.8405704
0
Calculate a percentile of the array values over labeled regions.
def percentile(data, qval, labels=None, index=None): data = np.asanyarray(data) def single_group(vals): return np.percentile(vals, qval) if labels is None: return single_group(data) # ensure input and labels match sizes data, labels = np.broadcast_arrays(data, labels) if inde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_perc(arr: np.array, p: Sequence[float] = None):\n if p is None:\n p = [50]\n\n nan_count = np.isnan(arr).sum(axis=-1)\n out = np.moveaxis(np.percentile(arr, p, axis=-1), 0, -1)\n nans = (nan_count > 0) & (nan_count < arr.shape[-1])\n if np.any(nans):\n out_mask = np.stack([na...
[ "0.70549434", "0.6741164", "0.6662035", "0.66016424", "0.6500401", "0.6459244", "0.6303143", "0.6247118", "0.6219375", "0.61808074", "0.6145661", "0.6143983", "0.6136194", "0.61153173", "0.60878253", "0.60767406", "0.60635877", "0.6059681", "0.5997567", "0.59776396", "0.59420...
0.65258336
4
Initializes all the element of the GUI, supported by Tkinter
def __init__(self, tello): self.tello = tello # videostream device self.thread = None # thread of the Tkinter mainloop self.stopEvent = None # control variables self.distance = 0.1 # default distance for 'move' cmd self.degree = 30 # default degree for 'cw' o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.window = Tk() # The main window\n self.__initialize_variables__() # Initialize the variables\n self.__initialize_menu__() # Initialize the Menu\n self.__initialize_status_bar__()\n self.__initialize_gui__() # Initialize the GUI widgets",...
[ "0.77829045", "0.7319447", "0.7121587", "0.71154493", "0.7044531", "0.70197904", "0.7015567", "0.696209", "0.68833053", "0.6865509", "0.6856705", "0.6856659", "0.68557364", "0.6814217", "0.6804366", "0.67954916", "0.6790265", "0.67835164", "0.67754626", "0.6773747", "0.676693...
0.0
-1
Starts a while loop that sends 'command' to tello every 5 second.
def _sendingCommand(self): while True: self.tello.send_command('command') time.sleep(5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Listen(self):\n while True:\n time.sleep(1)", "def run(self):\n while True:\n time.sleep(RTM_READ_DELAY)\n for event in self._slack_client.rtm_read():\n self.handle_event(event)", "def run():\n # 1 sec delay to allow DHT22 sensor to start as ...
[ "0.63576066", "0.6166633", "0.60652816", "0.60415244", "0.60114336", "0.59595996", "0.595747", "0.5923307", "0.5898725", "0.58431983", "0.58387035", "0.58356047", "0.5832241", "0.56968737", "0.5675272", "0.56747895", "0.56568396", "0.56439304", "0.562048", "0.56196946", "0.56...
0.7657067
0
Set the variable as TRUE; it will stop computer waiting for response from tello.
def _setQuitWaitingFlag(self): self.quit_waiting_flag = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bool__(self):\n return self.wait(0)", "def _stop(self):\n return True", "def kinbot(self):\n self.success = False", "def stopCond(self):\n\t\treturn False", "def stop(self):\n command = input(\"Enter anything to finish (or 'exit' to cancel)>>>\")\n return command !=...
[ "0.6232066", "0.60531396", "0.5993092", "0.5933566", "0.58755565", "0.5861535", "0.580857", "0.5768193", "0.57589114", "0.57057345", "0.5682822", "0.5668132", "0.56636673", "0.5655856", "0.56449413", "0.56356215", "0.5628359", "0.5628359", "0.56276935", "0.56122077", "0.56005...
0.5679991
11
Open the cmd window and initial all the button and text.
def openCmdWindow(self): panel = Toplevel(self.root) panel.wm_title('Command Panel') # create text input entry text0 = tki.Label(panel, text='This Controller map keyboard inputs to Tello control commands\n' 'Adjust the tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(self):\n self.state = True\n self.mainwindow.sendMessage('a')\n print(\"opening \" + self.name)", "def build_initial() :\r\n titleframe = T.Frame(ROOT)\r\n TITLE = T.Label(titleframe, text = \"Welcome to Microgp!\")\r\n var = T.StringVar()\r\n INSTRUCTIONS = T.Message(ti...
[ "0.61820495", "0.61781216", "0.6119948", "0.60934174", "0.60702914", "0.5959592", "0.5948371", "0.5943641", "0.593772", "0.5910269", "0.59019053", "0.5892788", "0.58925205", "0.5891495", "0.5889927", "0.58737874", "0.5858974", "0.5835644", "0.5834646", "0.58337766", "0.582894...
0.68487906
0
Open the flip window and initial all the button and text.
def openFlipWindow(self): panel = Toplevel(self.root) panel.wm_title('Gesture Recognition') self.btn_flipl = tki.Button( panel, text='Flip Left', relief='raised', command=self.telloFlip_l) self.btn_flipl.pack(side='bottom', fill='both', expand='ye...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_state():\n\tDmg.OpenWindow()", "def show(self):\r\n self.wf.Show()", "def show(self, window):\r\n\r\n return", "def finish_render():\n get_window().static_display = True\n get_window().flip_count = 0\n get_window().flip()", "def cb_main_window(self, event):\n self.m...
[ "0.6244811", "0.61130655", "0.60361177", "0.58716136", "0.5835317", "0.5802721", "0.58015156", "0.57977974", "0.57581085", "0.5736185", "0.5727664", "0.56942797", "0.5663911", "0.5637016", "0.5626047", "0.5598497", "0.55893236", "0.5587088", "0.55717754", "0.55463487", "0.553...
0.8400445
0
Sets the stop event, cleanup the camera, and allow the rest of the quit process to continue.
def on_close(self): print('[INFO] closing...') self.stopEvent.set() del self.tello self.root.quit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.running = False\n self.cam.stop()\n self.amplifier.stop()\n pass", "def stop():\n global running\n running = False\n messagebox.showinfo(\"Camera mode\",\"Stop image grab\")\n camera.stop_preview()", "def stop(self):\n self.stop_aperture()",...
[ "0.7624942", "0.76044846", "0.7556506", "0.744567", "0.744567", "0.7432174", "0.7239621", "0.72074336", "0.72074336", "0.72029865", "0.71938837", "0.71938837", "0.7178905", "0.7176315", "0.71751827", "0.71751827", "0.71670294", "0.7162203", "0.7162203", "0.7145708", "0.713128...
0.0
-1
example action using the internationalization operator T and flash rendered by views/default/index.html or views/generic.html
def index(): return dict(message=T('Welcome to Audi Volkswagon Porsche'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(request, *args, **kwargs):\n return Response({\"message\":\"Nobody expects the spanish inquisition!\"})", "def index():\n return dict(message=T('Hello World'))", "def index():\n response.flash = \"Welcome to Myapp!\"\n return dict(message=T('Hello World'))", "def index_en(request):\n ...
[ "0.66694236", "0.6106484", "0.60288805", "0.58857584", "0.5849951", "0.5769532", "0.5752256", "0.5746499", "0.5689333", "0.5651591", "0.56413424", "0.563141", "0.5626008", "0.5618876", "0.5612004", "0.5580761", "0.55667937", "0.55658025", "0.5562467", "0.55529743", "0.5483404...
0.53856117
44
allows downloading of uploaded files
def download(): return response.download(request, db)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_files(self):", "def post_download(self, remote_files):\n pass", "def download_file(self, parsed_event, input_dir_path):", "def download(self,fn):\n\t\treturn False #TODO: implement meme download", "def download(self):\n pass", "def download(self):\n pass", "def pre_dow...
[ "0.7924571", "0.7199257", "0.6978304", "0.6841495", "0.6764734", "0.6764734", "0.66671187", "0.6631285", "0.6588692", "0.6555494", "0.65398693", "0.65012735", "0.6458808", "0.6451737", "0.64442515", "0.6402176", "0.63864595", "0.63758063", "0.63659835", "0.6345104", "0.633138...
0.0
-1
View callable parameters are either context, request or just request. There is also request.context. In mako templates, request is accessible as request, context as _context. Values contained in the returned dictionary can be accessed within the template under variables named by the dictionary keys.
def home(context, request): return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_context(self):\n return {\"request\": self.request, \"format\": self.format_kwarg, \"view\": self}", "def get_renderer_context(self):\n # Note: Additionally 'response' will also be added to the context,\n # by the Response object.\n return {\n 'view': self,\n ...
[ "0.7701646", "0.6560682", "0.63035905", "0.61721003", "0.6156719", "0.60182035", "0.60104954", "0.59970176", "0.597518", "0.5969505", "0.5959369", "0.595519", "0.5925658", "0.5925658", "0.5907715", "0.58984065", "0.5887859", "0.58788943", "0.58776265", "0.58464235", "0.583259...
0.0
-1
Returns the quantization config for transformerbased models.
def _get_transformer_quantization_config(subset_size: int) -> Dict[str, Any]: return { "algorithm": "quantization", "preset": "mixed", "initializer": { "range": {"num_init_samples": subset_size, "type": DEFAULT_RANGE_TYPE}, "batchnorm_adaptation": {"num_bn_adaptation_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_default_quantization_config(preset: QuantizationPreset, subset_size: int) -> Dict[str, Any]:\n return {\n \"algorithm\": \"quantization\",\n \"preset\": preset.value,\n \"initializer\": {\n \"range\": {\"num_init_samples\": subset_size, \"type\": DEFAULT_RANGE_TYPE},\n ...
[ "0.66286147", "0.5942934", "0.5907931", "0.5872018", "0.5804783", "0.57093644", "0.56935316", "0.5644522", "0.56273764", "0.5596549", "0.5582015", "0.55781955", "0.5568165", "0.5547753", "0.5484123", "0.54839206", "0.54510504", "0.5421256", "0.54176253", "0.5367854", "0.53125...
0.780377
0
Returns the default quantization config
def _get_default_quantization_config(preset: QuantizationPreset, subset_size: int) -> Dict[str, Any]: return { "algorithm": "quantization", "preset": preset.value, "initializer": { "range": {"num_init_samples": subset_size, "type": DEFAULT_RANGE_TYPE}, "batchnorm_adap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_transformer_quantization_config(subset_size: int) -> Dict[str, Any]:\n return {\n \"algorithm\": \"quantization\",\n \"preset\": \"mixed\",\n \"initializer\": {\n \"range\": {\"num_init_samples\": subset_size, \"type\": DEFAULT_RANGE_TYPE},\n \"batchnorm_adapt...
[ "0.7033103", "0.6777367", "0.6720709", "0.65748835", "0.6455274", "0.642663", "0.63270366", "0.63183445", "0.63130504", "0.6306793", "0.62361944", "0.6232875", "0.621485", "0.6185362", "0.6169694", "0.6101184", "0.6091094", "0.6084804", "0.60460657", "0.59970856", "0.5981526"...
0.8306506
0
Creates the NNCFConfig for the quantization algorithm.
def _create_nncf_config( preset: QuantizationPreset, target_device: TargetDevice, subset_size: int, model_type: Optional[ModelType], ignored_scope: Optional[IgnoredScope], advanced_parameters: Optional[AdvancedQuantizationParameters], ) -> NNCFConfig: if model_type is None: compressi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, quantized_edges_in_cfg: int, total_edges_in_cfg: int):\n self.quantized_edges_in_cfg = quantized_edges_in_cfg\n self.total_edges_in_cfg = total_edges_in_cfg", "def _add_fp_configs(CONFIG):\n CONFIG.declare(\n 'fp_cutoffdecr',\n ConfigValue(\n default=1...
[ "0.6211365", "0.5947636", "0.5926075", "0.5917099", "0.58897614", "0.584447", "0.584447", "0.56702006", "0.5627676", "0.55820346", "0.5560999", "0.55283594", "0.54756486", "0.54677653", "0.5465148", "0.54618865", "0.5459208", "0.54586923", "0.54444957", "0.54440576", "0.54371...
0.7439748
0
Implementation of the `quantize()` method for the PyTorch backend.
def quantize_impl( model: torch.nn.Module, calibration_dataset: Dataset, preset: QuantizationPreset, target_device: TargetDevice, subset_size: int, fast_bias_correction: bool, model_type: Optional[ModelType] = None, ignored_scope: Optional[IgnoredScope] = None, advanced_parameters: O...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _quantize_activation(self, tensor_quantizer: Union[StaticGridPerTensorQuantizer, LearnedGridTensorQuantizer],\n tensors_to_quantize: Union[List[torch.Tensor], torch.Tensor]) -> \\\n Union[List[torch.Tensor], torch.Tensor]:\n\n if not tensor_quantizer.enabled:\n ...
[ "0.66118073", "0.6562525", "0.6480266", "0.6165468", "0.6131837", "0.59161913", "0.59054255", "0.5854331", "0.58431715", "0.58389634", "0.580356", "0.578608", "0.5622065", "0.5571132", "0.5530895", "0.5513868", "0.5501805", "0.54813254", "0.54429746", "0.5433842", "0.5411219"...
0.46610415
70
Implementation of the `compress_weights()` method for the PyTorch backend.
def compress_weights(model: torch.nn.Module, use_fake_quantize: bool = False) -> torch.nn.Module: compressed_model, _ = replace_modules_by_nncf_modules(model) insert_pre_compression_operations(model, use_fake_quantize) return compressed_model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(self, tensor):", "def compress(self, tensor, *args, **kwargs):\n pass", "def weight_compression(weights, bits, axis=0, quantizer=None):\n assert bits <= 8\n n = 2**bits\n index_table = []\n codebook_table = np.zeros((weights.shape[axis], n))\n km_models = [None] * weights.shape[axis]\n...
[ "0.67688566", "0.6305428", "0.62857914", "0.59490013", "0.59490013", "0.57656217", "0.5713356", "0.57009125", "0.56955546", "0.56836677", "0.55329573", "0.5532722", "0.5511265", "0.5505167", "0.5443281", "0.54317117", "0.5425128", "0.54003054", "0.53999305", "0.5396085", "0.5...
0.67650056
1
Reset the list of document's modified items.
def clear_modified(self): self._data.clear_modified()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_original(self):\n self._original = [] # Empty out self._originals", "def reset_modified(self):\n self.modified_fields = set()\n\n # compensate for us not having knowledge of certain fields changing\n for field_name, field in self.schema.normal_fields.items():\n i...
[ "0.6702367", "0.66882014", "0.6433367", "0.6393692", "0.6267809", "0.62651587", "0.6241749", "0.6123967", "0.61093926", "0.60061425", "0.60025436", "0.5998225", "0.5958811", "0.5949711", "0.59314656", "0.58863574", "0.5874103", "0.5873604", "0.5864233", "0.583386", "0.5812609...
0.6440544
2
Create an embedded document instance from MongoDB data
def build_from_mongo(cls, data, use_cls=True): # If a _cls is specified, we have to use this document class if use_cls and '_cls' in data: cls = cls.opts.instance.retrieve_embedded_document(data['_cls']) doc = cls() doc.from_mongo(data) return doc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_mongo(data):\n if not data:\n return None\n\n data['id'] = str(data['_id'])\n return data", "def from_mongo(cls, data: dict) -> Union[\"MongoModel\", Dict]:\n if not data:\n return data\n id = data.pop('_id', None)\n return cls(**dict(data, id=id))", "def create...
[ "0.7066903", "0.6612481", "0.63551545", "0.6348332", "0.6091033", "0.6033079", "0.5778242", "0.5773537", "0.5751162", "0.5727225", "0.5722528", "0.5691701", "0.56832474", "0.56717724", "0.55828565", "0.55790466", "0.5539406", "0.5517863", "0.5484895", "0.54323846", "0.5430872...
0.73655903
0
Update the embedded document with the given data.
def update(self, data): return self._data.update(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_document(self, data):\n if not isinstance(data, pylastica.document.Document) and not isinstance(data, pylastica.script.Script):\n raise TypeError(\"data must be an instance of Document or Script: %r\" % data)\n if not data.has_id():\n raise pylastica.exception.Invalid...
[ "0.7426288", "0.72898763", "0.712248", "0.7063579", "0.6942613", "0.6895699", "0.67748654", "0.67748654", "0.67748654", "0.67748654", "0.6651414", "0.6568333", "0.6562047", "0.6497421", "0.6475764", "0.6431798", "0.6416607", "0.63776666", "0.6309925", "0.62621003", "0.6231522...
0.66224176
11
Dump the embedded document.
def dump(self): return self._data.dump()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self, f):\n ret = libxml2mod.xmlDocDump(f, self._o)\n return ret", "def debugDumpDocument(self, output):\n libxml2mod.xmlDebugDumpDocument(output, self._o)", "def dump(self):\n if self.__root is None:\n return\n\n elist = self.__root.getElements()\n ...
[ "0.64431685", "0.6325379", "0.62365735", "0.6215594", "0.5980638", "0.5913904", "0.5842076", "0.5824335", "0.58150154", "0.577763", "0.57628286", "0.57517964", "0.57165134", "0.5693397", "0.5673982", "0.5672529", "0.5656097", "0.56052685", "0.5553852", "0.5550597", "0.5545202...
0.5563799
18
Multidimensional Gaussian fourier filter. The array is multiplied with the fourier transform of a Gaussian kernel.
def fourier_gaussian(input, sigma, n=-1, axis=-1, output=None): input = numpy.asarray(input) output = _get_output_fourier(output, input) axis = normalize_axis_index(axis, input.ndim) sigmas = _ni_support._normalize_sequence(sigma, input.ndim) sigmas = numpy.asarray(sigmas, dtype=numpy.float64) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fmgf(array, sigma):\n x, y = np.arange(len(array)), array.copy()\n yg = ndimage.filters.gaussian_filter(y, sigma)\n y -= yg\n\n # digitizing\n m = 101\n dy = 6.0 * mad(y) / m\n ybin = np.arange(np.min(y) - 5 * dy, np.max(y) + 5 * dy + dy, dy)\n z = np.zeros([len(ybin), len(x)])\n z[n...
[ "0.6724297", "0.6515853", "0.64436597", "0.64298147", "0.6300525", "0.62142223", "0.6133565", "0.61210185", "0.60772467", "0.6005786", "0.59797704", "0.58723", "0.58492655", "0.5830647", "0.575321", "0.56844056", "0.5630864", "0.56108207", "0.55966944", "0.5580227", "0.557872...
0.66539884
1
Multidimensional uniform fourier filter. The array is multiplied with the Fourier transform of a box of given size.
def fourier_uniform(input, size, n=-1, axis=-1, output=None): input = numpy.asarray(input) output = _get_output_fourier(output, input) axis = normalize_axis_index(axis, input.ndim) sizes = _ni_support._normalize_sequence(size, input.ndim) sizes = numpy.asarray(sizes, dtype=numpy.float64) if not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_fourier_filter(self):\n size = max(64, int(2 ** np.ceil(np.log2(2 * self.m[-1].item()))))\n\n pi = torch.acos(torch.zeros(1)).item() * 2.0\n n = torch.cat(\n [\n torch.arange(1, size // 2 + 1, 2, device=self.n.device),\n torch.arange(size // 2 ...
[ "0.6378481", "0.6309765", "0.62861556", "0.62434644", "0.61714876", "0.60929567", "0.6092913", "0.6006388", "0.59960955", "0.59704673", "0.57724774", "0.57447904", "0.5739366", "0.5689734", "0.5677718", "0.5673864", "0.56690097", "0.5644021", "0.56193554", "0.56177664", "0.56...
0.672973
0
Multidimensional ellipsoid Fourier filter. The array is multiplied with the fourier transform of a ellipsoid of given sizes.
def fourier_ellipsoid(input, size, n=-1, axis=-1, output=None): input = numpy.asarray(input) if input.ndim > 3: raise NotImplementedError("Only 1d, 2d and 3d inputs are supported") output = _get_output_fourier(output, input) axis = normalize_axis_index(axis, input.ndim) sizes = _ni_support._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _irfft2d(f_x) :", "def process( fids, ndim=2 ):\n\timg = np.empty_like( fids )\n\tax = -1*(np.array( range(ndim) )+1)\n\t\n\timg = np.fft.fftshift( np.fft.fftn( fids, axes=ax, ).astype( np.complex64), axes=ax )\n\t\n\treturn np.squeeze(img)", "def _get_fourier_filter(self):\n size = max(64, int(2 ...
[ "0.5919297", "0.5817323", "0.5366147", "0.5307928", "0.52779627", "0.5270385", "0.5188855", "0.5180645", "0.51758784", "0.5060478", "0.5059644", "0.5033383", "0.50284445", "0.5026053", "0.5017994", "0.50149393", "0.5008967", "0.4998893", "0.4998793", "0.49833018", "0.49821383...
0.6894624
0
Multidimensional Fourier shift filter. The array is multiplied with the Fourier transform of a shift operation.
def fourier_shift(input, shift, n=-1, axis=-1, output=None): input = numpy.asarray(input) output = _get_output_fourier_complex(output, input) axis = normalize_axis_index(axis, input.ndim) shifts = _ni_support._normalize_sequence(shift, input.ndim) shifts = numpy.asarray(shifts, dtype=numpy.float64) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fftshift(X):\r\n # return scipy.fftpack.fftshift(X)\r\n return np.fft.fftshift(X)", "def ifftshift(a, axes=None):\n return image.image(np.fft.ifftshift(a, axes), pixelsize = image.getPixelsize(a))", "def fftshift(a, axes=None):\n return image.image(np.fft.fftshift(a, axes), pixelsize = image.ge...
[ "0.67731035", "0.6459094", "0.6423767", "0.6338069", "0.60735834", "0.6052101", "0.6052101", "0.6052101", "0.6013318", "0.6007814", "0.599912", "0.59832346", "0.59766555", "0.59196067", "0.58802474", "0.58419585", "0.5822599", "0.5822599", "0.5822599", "0.581095", "0.580473",...
0.60626906
5
Given positive int n and array P representing probabilities corresponding to an allel frequency, returns array B representing the expected allele frequency of the next generation
def ExpectedVal(): input = f.LoadFile('\\rosalind_ebin.txt').splitlines() n = int(input[0]) P = [float(x) for x in input[1].split()] B = [str(round(i*n,4)) for i in P] f.ExportToFile('rosalind_ebin_output.txt',' '.join(B)) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binomial(n: int, p: float) -> int:\n return sum(bernoulli_trial(p) for _ in range(n))", "def bpmfln(k, n, p):\n bnm = np.empty_like(n, dtype=np.float64)\n logp = math.log(p)\n one_logp = math.log(1 - p)\n for i in range(len(k)):\n bnm[i] = math.exp(combinln(n[i], k[i...
[ "0.6789287", "0.67728233", "0.65926576", "0.6576568", "0.6520024", "0.6460622", "0.6324361", "0.6279238", "0.62723196", "0.6234605", "0.6230018", "0.62065023", "0.6202986", "0.6180209", "0.61650026", "0.6157465", "0.61489534", "0.6131866", "0.6128808", "0.60880065", "0.608400...
0.0
-1