query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Vectorized wrapper function for _zlerchphi() | def _vzlerchphi(self, z: np.ndarray, a: int) -> np.ndarray:
return np.array([self._zlerchphi(z_, a) for z_ in z]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _vlerchphi(self, z: np.ndarray, a: int) -> np.ndarray:\n return np.array([self._lerchphi(z_, a) for z_ in z])",
"def get_z(theta, phi):\n return math.cos(phi)/math.tan(theta/2) + 1j*math.sin(phi)/math.tan(theta/2)",
"def __phi(x):\n return max([1 - abs(x), 0])",
"def Z(phi = None):\n if p... | [
"0.7914443",
"0.65681076",
"0.6435109",
"0.6432777",
"0.62693334",
"0.6253677",
"0.62178755",
"0.6203702",
"0.6139488",
"0.6075881",
"0.60546553",
"0.5954539",
"0.594207",
"0.5890718",
"0.58856523",
"0.58819497",
"0.58702683",
"0.5864873",
"0.5826224",
"0.5771205",
"0.5769248... | 0.78623563 | 1 |
Equivalent to fit(m_tokens, n_types).predict(m_tokens) | def fit_predict(self, m_tokens: np.ndarray, n_types: np.ndarray) -> np.ndarray:
# fit and predict
return self.fit(m_tokens, n_types).predict(m_tokens) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_tokens(self, tokens):\n return",
"def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray:\n\n # allow scalar\n return_scalar = np.isscalar(m_tokens)\n m_tokens = np.array(m_tokens).reshape(-1)\n\n # run model\n K, B = self.params\n ... | [
"0.7779649",
"0.73221636",
"0.70830023",
"0.6999615",
"0.6885678",
"0.6868568",
"0.6573257",
"0.6553992",
"0.6472437",
"0.64069986",
"0.63722783",
"0.63283336",
"0.631563",
"0.6238089",
"0.6219484",
"0.6217989",
"0.6209873",
"0.61776686",
"0.61699307",
"0.6155449",
"0.6138378... | 0.86812186 | 0 |
Vectorized wrapper function for mpmath.polylog() | def _vpolylog(self, s: float, z: np.ndarray) -> np.ndarray:
def _polylog(s, z_):
return float(polylog(s, z_).real)
return np.array([_polylog(s, z_) for z_ in z]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loglnumpy(store):\n xbeta = dot(store['xmat'], store['beta'])\n lamb = exp(xbeta)\n return sum(store['yvec'] * xbeta - lamb)",
"def IntegratePolynomialPartLogExt(poly, fieldTower):\n #print(poly)\n #print(poly.degree)\n #print(poly.fieldTower)\n if poly == 0 or poly.isZero():\n re... | [
"0.6472516",
"0.63923484",
"0.6258953",
"0.624462",
"0.62249404",
"0.619804",
"0.61791533",
"0.61325204",
"0.6129933",
"0.6125757",
"0.608846",
"0.6077444",
"0.60673094",
"0.60201836",
"0.598951",
"0.5984881",
"0.59739053",
"0.59476596",
"0.59213316",
"0.5906993",
"0.58948123... | 0.6842833 | 0 |
Calculate & return n_types = N formula(m_tokens/M) | def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray:
# allow scalar
return_scalar = np.isscalar(m_tokens)
m_tokens = np.array(m_tokens).reshape(-1)
# redirect: E(m) = N * formula(m/M)
n_types = self.N * self.formula(m_tokens / self.M)
# roun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_types(corpus):\n number_of_types = len(set(corpus))\n return number_of_types",
"def _get_token_cnts(self, doc, doc_type):\n tokenized_doc = self.nlp(doc)\n self.stat_dict[doc_type][0].append(len([s for s in tokenized_doc.sents]))\n doc_len = len([t for t in tokenized_doc])\n... | [
"0.67526203",
"0.62566036",
"0.62371844",
"0.5901608",
"0.5888075",
"0.58496165",
"0.57824427",
"0.5770406",
"0.5752158",
"0.5723402",
"0.571023",
"0.5654798",
"0.5651176",
"0.56446815",
"0.5636102",
"0.5617561",
"0.558259",
"0.5553394",
"0.5552679",
"0.5541281",
"0.5538353",... | 0.634425 | 1 |
Equivalent to fit(m_tokens, n_types).predict(m_tokens) | def fit_predict(self, m_tokens: np.ndarray, n_types: np.ndarray) -> np.ndarray:
# fit and predict
return self.fit(m_tokens, n_types).predict(m_tokens) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_tokens(self, tokens):\n return",
"def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray:\n\n # allow scalar\n return_scalar = np.isscalar(m_tokens)\n m_tokens = np.array(m_tokens).reshape(-1)\n\n # run model\n K, B = self.params\n ... | [
"0.7781518",
"0.73240215",
"0.7084659",
"0.7001472",
"0.6887836",
"0.6869992",
"0.6573101",
"0.65558875",
"0.6472882",
"0.6406988",
"0.6373421",
"0.6328009",
"0.63156056",
"0.62392",
"0.62203497",
"0.6218441",
"0.62113047",
"0.61780936",
"0.6171465",
"0.6155943",
"0.6139154",... | 0.8682314 | 1 |
The frequency distribution, as a dataframe. | def fdist(self) -> pd.DataFrame:
df = pd.DataFrame.from_dict(self, orient="index").reset_index()
df.columns = ["type", "freq"]
df = df.sort_values("freq", ascending=False).reset_index(drop=True)
df.index = df.index + 1
df.index.name = "rank"
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kdf(self) -> pd.DataFrame:\n k = self.k\n df = pd.DataFrame({\"freq\": k})\n df = df.query(\"freq > 0\")\n return df",
"def freq_table(a):\n Detail_freq = a.loc[:, (a.dtypes == object) | (a.dtypes == long) ].columns.get_values().tolist()\n print(Detail_freq)\n for freq in... | [
"0.7015139",
"0.70034003",
"0.69050044",
"0.67988557",
"0.66653955",
"0.6634818",
"0.6430949",
"0.6413127",
"0.63767004",
"0.6323943",
"0.62729007",
"0.6254082",
"0.6240195",
"0.6230129",
"0.62288827",
"0.62209",
"0.61965597",
"0.6145627",
"0.61223084",
"0.6080821",
"0.602591... | 0.7425145 | 0 |
List of tetrakis legomena (words that appear exactly four times) | def tetrakis(self):
return self.nlegomena(4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def long_words(words):\n words_longer_than_four = []\n for word in words:\n if len(word) > 4:\n words_longer_than_four.append(word)\n return words_longer_than_four",
"def spellingBeeSolutions(wordlist, puzzles):\n counter = []\n word_counter = 0\n\n for puzzle in puzzles:\n\n ... | [
"0.63501143",
"0.62058187",
"0.61091346",
"0.6090198",
"0.6072124",
"0.6050098",
"0.6045462",
"0.59422415",
"0.592569",
"0.58884233",
"0.58610547",
"0.5836775",
"0.58207697",
"0.5820003",
"0.58184505",
"0.5811583",
"0.58039045",
"0.580003",
"0.5789296",
"0.578027",
"0.5759076... | 0.7097487 | 0 |
List of pentakis legomena (words that appear exactly five times) | def pentakis(self):
return self.nlegomena(5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spellingBeeSolutions(wordlist, puzzles):\n counter = []\n word_counter = 0\n\n for puzzle in puzzles:\n\n for word in wordlist:\n\n if len(word) < 5 or puzzle[0][0] not in word:\n word_counter += 0\n elif not set(word).issubset(set(puzzle)):\n ... | [
"0.63574743",
"0.61537546",
"0.60389626",
"0.60285294",
"0.59958076",
"0.5985367",
"0.5875503",
"0.58625233",
"0.57821107",
"0.5780373",
"0.572211",
"0.56892055",
"0.56762123",
"0.56759745",
"0.5654279",
"0.5650885",
"0.5640835",
"0.56299686",
"0.5619005",
"0.56152874",
"0.56... | 0.65256196 | 0 |
Entropy content of this corpus in bans. Alias for corpus.entropy(base=10) | def bans(self) -> float:
return self.entropy(base=10) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(self):\n ent = 0.0\n for f in self.byte_freq:\n if f > 0:\n freq = float(f) / self.byte_total\n ent = ent + freq * math.log(freq, 2)\n return -ent",
"def entropy(self):\n return -np.sum(self.log_likelihoods * np.exp(self.log_likelih... | [
"0.70751554",
"0.7065577",
"0.7030088",
"0.70103115",
"0.70071584",
"0.6898724",
"0.6885471",
"0.6854623",
"0.6845571",
"0.6833479",
"0.68299824",
"0.6805772",
"0.6804219",
"0.67963296",
"0.6787629",
"0.6783454",
"0.67623",
"0.67574275",
"0.67453134",
"0.67439795",
"0.6727648... | 0.7201912 | 0 |
Return a report that matches ``name`` | def get_by_name(cls, request_handler, name) -> Optional['Report']:
data = request_handler.make_request(
'GET',
'/reports'
)
for item in data:
if item['reportName'] == name:
return cls(request_handler, item, False)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _lookup_report(self, name):\n join = os.path.join\n\n # First lookup in the deprecated place, because if the report definition\n # has not been updated, it is more likely the correct definition is there.\n # Only reports with custom parser sepcified in Python are still there.\n ... | [
"0.6853577",
"0.62809956",
"0.6192643",
"0.59630734",
"0.59579366",
"0.5907598",
"0.5829875",
"0.5815571",
"0.5706736",
"0.5666769",
"0.56577384",
"0.5649815",
"0.55669826",
"0.55585176",
"0.5488637",
"0.5387013",
"0.53585726",
"0.53358823",
"0.5304978",
"0.5289828",
"0.52720... | 0.72802335 | 0 |
Check whether a report with the name (case sensitive) exists | def exists(request_handler, name) -> bool:
data = request_handler.make_request(
'GET',
'/reports'
)
for item in data:
if item['reportName'] == name:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prompt_report_file_name(self):\n while True:\n report_file = input(\"Enter name for your report file: \")\n if os.path.isfile(report_file):\n print(\"'{}' is already exist!\".format(report_file))\n else:\n break\n return report_file",... | [
"0.6400386",
"0.62383264",
"0.61647785",
"0.61240596",
"0.5892352",
"0.5886611",
"0.5847345",
"0.5765161",
"0.5716618",
"0.5715015",
"0.56347984",
"0.56011236",
"0.5545829",
"0.554371",
"0.5507774",
"0.55055326",
"0.5505301",
"0.5472425",
"0.5455854",
"0.54495406",
"0.5425733... | 0.74193585 | 0 |
Load groups from a YAML file in the config folder | def load_group_from_config(self):
group_file_name = "cicada/config/group.yaml"
if os.path.isfile(group_file_name):
self.group_data = dict()
with open(group_file_name, 'r') as stream:
self.group_data = yaml.safe_load(stream)
self.all_groups = deepcopy(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load():\n with open('groups.pkl', \"rb\") as f:\n while True:\n try:\n groups = yield pickle.load(f)\n except EOFError:\n break\n return groups",
"def load_groups(filename):\r\n with open(filename, 'rb') as f:\r\n saved_data = pickle.... | [
"0.65959233",
"0.64898235",
"0.64154387",
"0.6401552",
"0.63734794",
"0.6257335",
"0.623626",
"0.6220587",
"0.6212126",
"0.6127406",
"0.61166525",
"0.61151856",
"0.6106009",
"0.6093432",
"0.6090286",
"0.60723686",
"0.6064391",
"0.60514224",
"0.60509735",
"0.604319",
"0.603630... | 0.7781451 | 0 |
Keep path to last data directory selected in a YAML in config | def save_last_data_location(self, dir_name):
# TODO think about where to keep the config yaml file
config_file_name = "cicada/config/config.yaml"
config_dict = None
if os.path.isfile(config_file_name):
with open(config_file_name, 'r') as stream:
config_dict = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_yaml_path(options):\n if '/' not in options['config_yaml']:\n dir_name = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n options['config_yaml'] = os.path.join(dir_name, options['config_yaml'])\n return options",
"def configs() -> Path:\n return TEST_RO... | [
"0.6551428",
"0.6194027",
"0.6087345",
"0.6048823",
"0.5975001",
"0.5923837",
"0.5874789",
"0.5872855",
"0.5858172",
"0.58444166",
"0.57109195",
"0.56871974",
"0.56857955",
"0.567317",
"0.5672065",
"0.56700754",
"0.5640668",
"0.561254",
"0.55931914",
"0.5587805",
"0.55854946"... | 0.7011594 | 0 |
Populate the menu to load groups | def populate_menu(self):
# TODO : Performance issue ?
self.showGroupMenu.clear()
self.addGroupDataMenu.clear()
counter = 0
for group_name in self.group_data.keys():
counter +=1
exec('self.groupAct' + str(counter) + ' = QAction("' + group_name+'", self)')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_group(self):\n items = self.group_list.selectedItems()\n counter = 0\n for item in items:\n if counter == 0:\n self.parent.load_group(item.text())\n else:\n self.parent.add_group_data(item.text())\n counter += 1",
"def m... | [
"0.7500009",
"0.6833545",
"0.6763835",
"0.6695808",
"0.6598628",
"0.65358573",
"0.6460276",
"0.635643",
"0.6344677",
"0.6300626",
"0.61615777",
"0.6161559",
"0.6140795",
"0.6076778",
"0.6062436",
"0.60474885",
"0.6024077",
"0.6014315",
"0.5905576",
"0.5900018",
"0.58814174",
... | 0.77946186 | 0 |
Display a widget with all existing groups | def see_all_groups(self):
self.all_group_window = AllGroups(self)
self.all_group_window.show()
self.object_created.append(self.all_group_window) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(self, session: Session) -> None:\n buttons = []\n for group in groups_api.get_user_groups(session.user):\n if session.user in group.admins:\n buttons.append(self.ui.create_button_view(group.name,\n lambda s: s... | [
"0.65709853",
"0.65663856",
"0.65644485",
"0.65421635",
"0.65280133",
"0.64636356",
"0.64218944",
"0.6376457",
"0.6360781",
"0.63253874",
"0.62325615",
"0.62173945",
"0.6206902",
"0.61970323",
"0.6093062",
"0.609157",
"0.60860276",
"0.6067449",
"0.606232",
"0.6043758",
"0.602... | 0.75397146 | 0 |
Uncheck all checkboxes in sort menu | def uncheck_all_sort(self):
self.param_list = []
self.ageSort.setChecked(False)
self.sexSort.setChecked(False)
self.speciesSort.setChecked(False)
self.genotypeSort.setChecked(False)
self.subjectIDSort.setChecked(False)
self.weightSort.setChecked(False)
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _uncheck_all(self):\n for item in self.list_cb_data.values():\n data_ctrl, _, _, _, _, _, _, _ = item\n self.tree_ctrl.CheckItem(data_ctrl, False)\n self.enable_append()\n self.enable_freeze()\n self.enable_plot()\n self.enable_import()\n self.ena... | [
"0.72601676",
"0.6726408",
"0.657636",
"0.62095094",
"0.62095094",
"0.60626274",
"0.5698548",
"0.5637104",
"0.5637104",
"0.56126153",
"0.55147564",
"0.54877746",
"0.5466746",
"0.5438217",
"0.54364055",
"0.53939456",
"0.5389247",
"0.53833723",
"0.53738457",
"0.53720176",
"0.53... | 0.8237576 | 0 |
Uncheck group menu parameter | def uncheck_group(self, param=''):
self.param_group_list = []
param_value_list = ['age', 'sex', 'species', 'raster', 'genotype', 'subjectID', 'weight', 'birth', 'fluorescence',
'imageseg', 'raster']
for value in param_value_list:
if value is not param:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deSelect(self):\n for i in range(len(self.__controlsChecks)):\n self.__controlsChecks[i].setChecked(False)",
"def remove_checks(self):\n for checkbox in self.checkboxes:\n checkbox.setChecked(False)\n mw.checked_stats = []\n mw.bonuses = {'Charisma': 2}",
"... | [
"0.62023604",
"0.5943233",
"0.59362906",
"0.5904742",
"0.5887329",
"0.58729535",
"0.58031875",
"0.57545954",
"0.5694991",
"0.56908864",
"0.56908864",
"0.56908864",
"0.56908864",
"0.569008",
"0.5686398",
"0.5664812",
"0.56092334",
"0.5595471",
"0.5594885",
"0.5594102",
"0.5582... | 0.81725067 | 0 |
Get item which was double clicked and call the function to load the group | def double_click_event(self, clicked_item):
item = self.group_list.item(clicked_item.row())
self.parent.load_group(item.text()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectitem_double_click(a):\n\n view_thumbnail_main(treeview)",
"def __itemDoubleClicked(self, index):\n self.__itemClicked(index)\n\n obj = index.data(self._model.ObjectRole)\n Events.OpenDetails.emit(\"worker\", obj.id)",
"def on_double_click(self, event):\n del event\n... | [
"0.654185",
"0.6531166",
"0.6398607",
"0.626244",
"0.6227709",
"0.61823887",
"0.60586107",
"0.6039766",
"0.6019913",
"0.5941906",
"0.59150326",
"0.58683527",
"0.57862693",
"0.5730637",
"0.5727311",
"0.5683523",
"0.56778467",
"0.56778467",
"0.5628967",
"0.5549079",
"0.5532867"... | 0.8749318 | 0 |
Add all selected groups to the current session list | def add_group(self):
items = self.group_list.selectedItems()
for item in items:
self.parent.add_group_data(item.text()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refreshGroups(self):\n self.groups = []\n\n self.addGroupsWithIds(self._getGroupIdsJoined())\n self.addGroupsWithIds(self._getGroupIdsInvited(), False)",
"def add_groups(self, groups):\n\n if isinstance(groups, list):\n self.groups.extend(groups)\n else:\n ... | [
"0.7198782",
"0.65768206",
"0.6516849",
"0.649049",
"0.63447",
"0.633779",
"0.62852854",
"0.62480265",
"0.62076575",
"0.61926115",
"0.61926115",
"0.61926115",
"0.61926115",
"0.61872953",
"0.6126039",
"0.6066471",
"0.6044021",
"0.6041064",
"0.59948653",
"0.5971394",
"0.5945446... | 0.7007145 | 1 |
Display a context menu at the cursor position. Allow the user to add or load the group at the given position. | def showContextMenu(self, pos):
self.global_pos = self.mapToGlobal(pos)
self.context_menu = QMenu()
self.context_menuAct = QAction("Load group", self, triggered=self.load_group)
self.context_menuAct.setIcon(QtGui.QIcon('cicada/gui/icons/svg/question-mark.svg'))
self.context_menu.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_context_menu(self, pos):\n pass",
"def context_menu(self, treeview, position):\n\n all_item = get_current_item(self,treeview,single=False)\n\n if len(all_item) == 1:\n\n item = all_item[0]\n data = get_group_data(get_current_hdf5_group(self,item))\n\n if data is None... | [
"0.7212771",
"0.678654",
"0.65126127",
"0.64903605",
"0.6424609",
"0.6273866",
"0.6197641",
"0.615202",
"0.6123941",
"0.61029315",
"0.6096487",
"0.60755485",
"0.6071013",
"0.60664713",
"0.60274",
"0.60050493",
"0.5987533",
"0.59152305",
"0.5884155",
"0.58706045",
"0.5829349",... | 0.78167677 | 0 |
Hypothesis test between two means and a test value. | def hypothesis_test_two_means_testvalue(datae,dataf,test_value,alpha):
# Dataset E
data_e = 1.0*np.array(datae)
n_e = data_e.shape[0]*data_e.shape[1]
mean_e = np.array(data_e).mean()
var_e = np.array(data_e).var(ddof=1)
df_e = n_e-1
# Dataset F
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ztest_mean(self, value=0, alternative=\"two-sided\"):\n tstat = (self.mean - value) / self.std_mean\n # TODO: use outsourced\n if alternative == \"two-sided\":\n pvalue = stats.norm.sf(np.abs(tstat)) * 2\n elif alternative == \"larger\":\n pvalue = stats.norm.s... | [
"0.6710968",
"0.6620438",
"0.6591137",
"0.6552622",
"0.6482526",
"0.6482526",
"0.64806324",
"0.6331792",
"0.6331792",
"0.6331792",
"0.627764",
"0.627764",
"0.627764",
"0.6153879",
"0.6121712",
"0.6088862",
"0.5960355",
"0.5959184",
"0.58887804",
"0.587921",
"0.58151937",
"0... | 0.69773674 | 0 |
Function to run MCMC to decrypt the given text | def decrypt_full_text(encrypt_text, num_mcmc_iters = 2500):
best_score = 0
store_iter_texts = []
lc_encrypt = copy.copy(lc_alph)
random.shuffle(lc_encrypt)
lc_alph_c = copy.copy(lc_alph)
## Initialize a random decryption dict
old_decrypt_dict = {}
for l, e in zip(lc_alph, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt(self, text):\n return self.encrypt(text)",
"def decrypt(text,key):\r\n aes = pyaes.AESModeOfOperationCTR(key)\r\n decrypted = aes.decrypt(text)\r\n return decrypted",
"def decrypt(self, data):",
"def brute_force_decrypt(text):\n for n in range(26):\n ... | [
"0.656711",
"0.651175",
"0.6417851",
"0.63948435",
"0.636516",
"0.6217032",
"0.6092972",
"0.60881126",
"0.6066977",
"0.5999001",
"0.59818745",
"0.59265184",
"0.59110427",
"0.59004205",
"0.58550304",
"0.58400905",
"0.5837091",
"0.5831699",
"0.58255726",
"0.58239216",
"0.579112... | 0.7016229 | 0 |
Get the image directory | def get_image_dir():
directory = os.path.abspath(os.path.dirname(__file__))
directory = os.path.join(directory, 'images')
return directory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_dir(self):\n return self.img_dir",
"def img_dir(self):\n try:\n return dirname(self.img_files[0])\n except:\n return \"Not available\"",
"def getImagePath():\n currentPath = os.path.dirname(__file__)\n resourcesPath = os.path.join(currentPath, \"Re... | [
"0.8793968",
"0.84042066",
"0.77433044",
"0.76953804",
"0.74764985",
"0.73420596",
"0.73061466",
"0.72368455",
"0.7196323",
"0.71532214",
"0.71343267",
"0.7119933",
"0.70874393",
"0.70609367",
"0.6979767",
"0.6938392",
"0.6902296",
"0.6884043",
"0.6879346",
"0.68787575",
"0.6... | 0.8774431 | 1 |
Do the two sprites intersect? sprite Sprite The Sprite to test | def intersect(self, sprite):
return not ((self.left > sprite.right)
or (self.right < sprite.left)
or (self.top < sprite.bottom)
or (self.bottom > sprite.top)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collide(obj1, obj2):\n offset_x = obj2.x - obj1.x #The difference between obj1 and obj 2\n offset_y = obj2.y - obj1.y \n return obj1.mask.overlap(obj2.mask, (int(offset_x), int(offset_y))) != None # (x,y)",
"def check_collide(self):\r\n for raindrop in self.overlapping_sprites:\r\n ... | [
"0.69023377",
"0.6828504",
"0.66966444",
"0.6652892",
"0.6606588",
"0.6513285",
"0.65090466",
"0.6431784",
"0.63963944",
"0.6376261",
"0.63616073",
"0.6354351",
"0.62159806",
"0.6202103",
"0.6198012",
"0.61656076",
"0.6162445",
"0.6159237",
"0.6142227",
"0.6126394",
"0.612616... | 0.783341 | 0 |
Determing ther are collisions with this sprite and the list of sprites sprite_list A list of sprites list List of collisions | def collide(self, sprite_list):
lst_return = []
for sprite in sprite_list:
if (self.intersect(sprite)):
lst_return.append(sprite)
return lst_return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def e_collisions(rect, enemy_list):\r\n for enemy in enemy_list:\r\n if rect.colliderect(enemy[1]) and rect.bottom - 4 < enemy[1].top:\r\n dropped_objects.append([[enemy[1].x, enemy[1].y], heart_img, [0, 0], 45])\r\n enemy_list.remove(enemy)",
"def is_collision(self):\n to_... | [
"0.6842545",
"0.6460546",
"0.64304525",
"0.6426143",
"0.6256541",
"0.6211209",
"0.62064403",
"0.6188275",
"0.61544716",
"0.61448425",
"0.61448425",
"0.6114543",
"0.609662",
"0.60907686",
"0.6049961",
"0.6025568",
"0.60046536",
"0.59867775",
"0.59822077",
"0.59715503",
"0.5949... | 0.7027629 | 0 |
Determine if there is at least one collision between this sprite and the list sprite_list A list of sprites None No Collision, or the first sprite to collide | def collide_once(self, sprite_list):
for sprite in sprite_list:
if (self.intersect(sprite)):
return sprite
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collide(self, sprite_list):\n\n lst_return = []\n for sprite in sprite_list:\n if (self.intersect(sprite)):\n lst_return.append(sprite)\n return lst_return",
"def check_collide(self):\r\n for raindrop in self.overlapping_sprites:\r\n raindrop.h... | [
"0.76459634",
"0.6861803",
"0.67869467",
"0.67277163",
"0.6404311",
"0.63971245",
"0.63583386",
"0.6321546",
"0.6310485",
"0.6258321",
"0.6196923",
"0.61400634",
"0.6084565",
"0.6059887",
"0.60567945",
"0.59895366",
"0.5981568",
"0.59409964",
"0.58866584",
"0.5883322",
"0.586... | 0.8650495 | 0 |
Given a view object, tells you if that view represents a help source file. | def is_authoring_source(view):
if view.match_selector(0, "text.hyperhelp.help"):
return not view.is_read_only()
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_for_view(view):\n if view.file_name() is not None:\n spp = sublime.packages_path()\n if view.file_name().startswith(spp):\n file_name = view.file_name()[len(spp)+1:]\n for pkg_name, pkg_info in help_index_list().items():\n if file_name.startswith(pk... | [
"0.64434224",
"0.6221",
"0.61636925",
"0.5855022",
"0.5569256",
"0.5569256",
"0.55248463",
"0.55218595",
"0.5490958",
"0.5458554",
"0.54406416",
"0.54218847",
"0.53848445",
"0.5383498",
"0.53619915",
"0.53554165",
"0.53252333",
"0.5302516",
"0.52975994",
"0.52934253",
"0.5279... | 0.7374875 | 0 |
Given a view object, provides you back the help index tuple for the help package that contains this file. This may be None if this file is not a Sublime package file, or if it doesn't correspond to a loaded help package. This does not verify that the file is actually a part of the provided help package, only that it is... | def package_for_view(view):
if view.file_name() is not None:
spp = sublime.packages_path()
if view.file_name().startswith(spp):
file_name = view.file_name()[len(spp)+1:]
for pkg_name, pkg_info in help_index_list().items():
if file_name.startswith(pkg_info.doc_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_help_index(pkg_info, window=None):\n window = window if window is not None else sublime.active_window()\n\n # The index file is stored as a resource file spec, so strip the prefix\n local_path = local_help_index(pkg_info)\n\n if not os.path.exists(local_path):\n return log(format_templa... | [
"0.6871109",
"0.6823521",
"0.64809155",
"0.6385842",
"0.60667676",
"0.6026283",
"0.59947926",
"0.59919167",
"0.5991301",
"0.5935679",
"0.5878535",
"0.58728653",
"0.5842411",
"0.58300155",
"0.5813974",
"0.5789508",
"0.57894164",
"0.57725763",
"0.57585585",
"0.5727645",
"0.5701... | 0.75560325 | 0 |
Determine what the full file name of a help file from a given package would be if it was stored locally. | def local_help_filename(pkg_info, help_file):
return os.path.normpath(os.path.join(sublime.packages_path(),
pkg_info.doc_root, help_file)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_help_index(pkg_info):\n return os.path.normpath(os.path.join(sublime.packages_path(),\n pkg_info.index_file[len(\"Packages/\"):]))",
"def name_from_file(pth = getattr(modules['__main__'], '__file__', 'optimize.default')):\n\treturn '{0:s}'.format(splitext(basename(pth))[0]... | [
"0.7155894",
"0.64388376",
"0.6425103",
"0.6395578",
"0.63303095",
"0.6289822",
"0.6247393",
"0.619017",
"0.61771953",
"0.613666",
"0.61287826",
"0.60831016",
"0.606742",
"0.60500973",
"0.6015383",
"0.59999245",
"0.5986673",
"0.59850043",
"0.5959858",
"0.5953095",
"0.5944372"... | 0.8257178 | 0 |
Determine what the full file name of the help index file for the given package would be if it was stored locally. | def local_help_index(pkg_info):
return os.path.normpath(os.path.join(sublime.packages_path(),
pkg_info.index_file[len("Packages/"):])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_help_filename(pkg_info, help_file):\n return os.path.normpath(os.path.join(sublime.packages_path(),\n pkg_info.doc_root, help_file))",
"def _template_file_default(self):\n return \"index\"",
"def open_help_index(pkg_info, window=None):\n window = window if wind... | [
"0.7559249",
"0.64428043",
"0.6427507",
"0.6295475",
"0.6083822",
"0.60460234",
"0.59824336",
"0.59647536",
"0.58642995",
"0.5853091",
"0.5838828",
"0.5836808",
"0.58200973",
"0.5815175",
"0.58049196",
"0.580457",
"0.5802551",
"0.57947975",
"0.5784477",
"0.5781049",
"0.573363... | 0.78894776 | 0 |
Attempt to open the provided help file locally for editing. | def open_local_help(pkg_info, help_file, window=None):
window = window if window is not None else sublime.active_window()
local_path = local_help_filename(pkg_info, help_file)
if not os.path.exists(local_path):
return log(format_template(
"""
Specified help file does not exi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def os_open_help_file( cls, help_file ):\n #help_file = self.parameters.help_file\n if help_file.startswith( \"http:\" ) or help_file.startswith( \"https:\" ):\n ret = webbrowser.open( help_file, new=0, autoraise=True ) # popopen might also work with a url\n# print(... | [
"0.74577296",
"0.67560256",
"0.67560256",
"0.6645325",
"0.64900404",
"0.6351481",
"0.6331407",
"0.62790215",
"0.6220714",
"0.6169091",
"0.6098027",
"0.6042996",
"0.60400534",
"0.5978792",
"0.5902903",
"0.5882742",
"0.5872984",
"0.582122",
"0.57693267",
"0.57081306",
"0.567081... | 0.760992 | 0 |
Attempt to open the provided help index file localy for editing. | def open_help_index(pkg_info, window=None):
window = window if window is not None else sublime.active_window()
# The index file is stored as a resource file spec, so strip the prefix
local_path = local_help_index(pkg_info)
if not os.path.exists(local_path):
return log(format_template(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openFile(self, index):\n page_name = index.data().toString()\n file_name = self.file_names[str(page_name)]\n self.main_help_window.setHtml(open(file_name, 'r').read())",
"def os_open_help_file( cls, help_file ):\n #help_file = self.parameters.help_file\n if help_... | [
"0.6962194",
"0.65130967",
"0.65087134",
"0.64038634",
"0.60102427",
"0.5912191",
"0.58855593",
"0.58855593",
"0.58015025",
"0.5717869",
"0.56538856",
"0.56368715",
"0.563381",
"0.5614867",
"0.55863905",
"0.5571036",
"0.5564107",
"0.55595046",
"0.5534661",
"0.5512867",
"0.542... | 0.74973387 | 0 |
Filter returns a list containing range made from given value | def get_range(value):
return list(range(value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_range( value ):\n return list(range(value))",
"def ex_range(data):\n a, b, step = _cleanse_range_args(data)\n return list(range(a, b+sign(step), step))",
"def _range_to_list(cls, rng):\n ends = rng.split(\"-\")\n if len(ends) != 2:\n return []\n\n return list(ra... | [
"0.7232286",
"0.6389737",
"0.6220292",
"0.6103578",
"0.6096528",
"0.60947645",
"0.6037131",
"0.60205203",
"0.6008224",
"0.59948736",
"0.59946954",
"0.5991958",
"0.5981121",
"0.5955905",
"0.5937625",
"0.59324116",
"0.5920362",
"0.59036714",
"0.589868",
"0.5882526",
"0.5868773"... | 0.72140145 | 1 |
subtract the arg from the value. | def subtract(value, arg):
try:
return int(value) - int(arg)
except (ValueError, TypeError):
try:
return value - arg
except Exception:
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract(self, value):\n return self.number - value",
"def subtract(val, otherval=None):\n if otherval is None:\n return val\n\n try:\n answer = val - int(otherval)\n return answer\n except ValueError:\n return val",
"def subtract(*args):\n\n # TODO: Fill ... | [
"0.7714425",
"0.71640867",
"0.71093124",
"0.69877523",
"0.69389325",
"0.6776049",
"0.67269045",
"0.6721766",
"0.6658199",
"0.6658199",
"0.66268027",
"0.66268027",
"0.66268027",
"0.66232294",
"0.66111463",
"0.6543256",
"0.65196186",
"0.6496731",
"0.6493978",
"0.6485772",
"0.64... | 0.7948222 | 0 |
Send a payment confirmation email. Certain products may need to send a confirmation seperately. Maybe eventually there will need to be a settings.DROP_MAIL_CONFIRMATION_NO_MATTER_WHAT option? | def send_payment_confirmation_email(self,order):
order_items = [i for i in order.items.all()]
for cls in set([i.product.__class__ for i in order_items]):
if not hasattr(cls,"send_payment_confirmation_email"):
continue
cls_items = [i for i in order_items if isinsta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_payment_email(order):\n if not settings.LOCAL:\n if order.latest_action == OrderAction.Action.BANKNOTE_UPLOADED:\n title = \"Order #{} Banknote Received\".format(order.id)\n else:\n title = \"Order #{} Payment Received\".format(order.id)\n\n mail.send_mail(\n ... | [
"0.70650756",
"0.6956238",
"0.6937234",
"0.6903004",
"0.6883585",
"0.6694232",
"0.66092557",
"0.6589168",
"0.6447598",
"0.64447516",
"0.6420641",
"0.6387323",
"0.63784933",
"0.6378442",
"0.63290316",
"0.6279329",
"0.62416524",
"0.60740715",
"0.6064392",
"0.605832",
"0.5989102... | 0.80389726 | 0 |
Marks the specified amount for the given order as paid. This allows to hook in more complex behaviors (like saving a history of payments in a Payment model) The optional save argument allows backends to explicitly not save the order yet | def confirm_payment(self, order, amount, transaction_id, backend, description, save=True):
#! TODO this bit should probably be in the "if save..." block below. Check rest of code base first
OrderPayment.objects.get_or_create(
order=order,
amount=Decimal(amount),
trans... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paid(self, paid):\n\n self._paid = paid",
"def transaction_amount_paid(self, transaction_amount_paid):\n\n self._transaction_amount_paid = transaction_amount_paid",
"def paid_interest(self, paid_interest):\n\n self._paid_interest = paid_interest",
"def save(self, *args, **kwargs):\n ... | [
"0.6905266",
"0.6039232",
"0.6021345",
"0.59171605",
"0.5789729",
"0.57723475",
"0.5649608",
"0.5606408",
"0.5603221",
"0.5592143",
"0.554666",
"0.5468819",
"0.5401203",
"0.5376429",
"0.5343095",
"0.5258786",
"0.52550066",
"0.523511",
"0.5198044",
"0.51331836",
"0.51278967",
... | 0.66326064 | 1 |
A helper for backends to let them redirect to a generic "order was cancelled" URL of their choosing. | def get_cancel_url(self):
return reverse('checkout_payment') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _order_not_found():\n pecan.abort(404, u._('Order not found.'))",
"def do_cancel(order):\r\n self.gox.cancel(order.oid)",
"def _order_cancel(self, bo):\n log.info(\"bo_blotter: order_cancel bracket order bo#%s\" % bo.ticket) \n cancelled = bo.cancel()\n return(canc... | [
"0.63242435",
"0.6176782",
"0.6108915",
"0.6008895",
"0.5965189",
"0.59537345",
"0.5943401",
"0.5943401",
"0.5923187",
"0.58964926",
"0.58032817",
"0.58032817",
"0.5802958",
"0.58013177",
"0.5782521",
"0.5767809",
"0.57137996",
"0.5702149",
"0.5667031",
"0.56372297",
"0.55683... | 0.68018407 | 0 |
Extrapolate the next value for `values`, based on the last `n` samples. | def extrapolate_with_worst_case(values: List[float], n: int = 5) -> float:
n = min(len(values), n)
return values[-1] + max(v_next - v_prev for v_prev, v_next in zip(values[-n:], values[-n+1:])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _append_value(self, v_values, next_value, v_idx=None, n_vals=1):\n for _ in range(n_vals):\n if v_idx:\n try:\n v_i = next(v_idx)\n except StopIteration:\n # Repeating commas are null-statements and can be ignored\n ... | [
"0.5853784",
"0.5652507",
"0.5483655",
"0.54175586",
"0.53613377",
"0.5355311",
"0.5346964",
"0.52661806",
"0.52464515",
"0.5240065",
"0.5202819",
"0.5179259",
"0.51771766",
"0.5159131",
"0.51569784",
"0.51434296",
"0.5133736",
"0.51274586",
"0.51172006",
"0.5096899",
"0.5076... | 0.735803 | 0 |
Renders samples from voices and maintains a voice pool | def voice_combiner(iterable):
t = 0.0
stopping = False
voice_pool = []
voice_time, voice_list = next(iterable)
while True:
# add new voices to the pool
while t >= voice_time:
voice_pool.extend(voice_list)
try:
voice_time, voice_list = next(it... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_samplers(self):\n raise NotImplementedError(\" The draw_samplers() method has not been implemented \")",
"def vad_collector(sample_rate, frame_duration_ms,\n padding_duration_ms, vad, frames):\n num_padding_frames = int(padding_duration_ms / frame_duration_ms)\n # We use a ... | [
"0.6162303",
"0.5727719",
"0.55910593",
"0.5577907",
"0.5498214",
"0.5483886",
"0.54681635",
"0.5461217",
"0.54054",
"0.5372851",
"0.53714526",
"0.5359456",
"0.5333311",
"0.5311192",
"0.5289894",
"0.52676386",
"0.5251842",
"0.52288085",
"0.52242666",
"0.5217163",
"0.5215833",... | 0.57762194 | 1 |
Returns a set of SparseVectorDimensions which are each assigned a transformation function appropriate for standardizing the respective dimension. | def generateStandardizedColumns(self, data_set, columns):
cstat = data_set.colStats()
stdDevs = np.sqrt(cstat.variance())
means = cstat.mean()
normalizingFactors = map(lambda x: x if x != 0.0 else 1.0, stdDevs)
result = []
for col, mean, nf in zip(columns, means, normaliz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_scale_features_standardize(self):\n data = array([[0.564, 20.661], [-18.512, 41.168], [-0.009, 20.440]])\n cdata = CData(data)\n\n # correct answer computed in Mathematica\n # TODO: can we compute the right answer in Python?\n answer = array([[0.60355, -0.568043], [-1.15... | [
"0.58996356",
"0.5885209",
"0.562922",
"0.5424146",
"0.5354879",
"0.5301714",
"0.52051574",
"0.5184689",
"0.51839614",
"0.51808983",
"0.5156929",
"0.5156137",
"0.5154081",
"0.51329243",
"0.5126789",
"0.50431347",
"0.49799955",
"0.4977521",
"0.4954653",
"0.4950907",
"0.4950194... | 0.60437644 | 0 |
Finalize OIDC login and create a new session with the data from the OIDC provicer. | async def oidc_end(request: aiohttp.web.Request) -> aiohttp.web.Response:
# Response from AAI must have the query params `state` and `code`
if "state" in request.query and "code" in request.query:
request.app["Log"].debug("AAI response contained the correct params.")
params = {"state": request.q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def oidc_start(request: aiohttp.web.Request) -> aiohttp.web.Response:\n try:\n oidc = request.app[\"oidc_client\"].begin(\"oidc\")\n except Exception as e:\n # This can be caused if config is improperly configured, and\n # oidcrp is unable to fetch oidc configuration from the given... | [
"0.60672337",
"0.59889543",
"0.5987495",
"0.589744",
"0.5842709",
"0.5828801",
"0.5826942",
"0.57812965",
"0.57745713",
"0.570731",
"0.5674367",
"0.5672693",
"0.5672693",
"0.56480044",
"0.5619016",
"0.56117016",
"0.55854535",
"0.55616057",
"0.55613655",
"0.55609727",
"0.55518... | 0.6306145 | 0 |
Lock down to a specific project. | async def handle_project_lock(request: aiohttp.web.Request) -> aiohttp.web.Response:
log = request.app["Log"]
log.info("Call for locking down the project.")
session = await aiohttp_session.get_session(request)
project = request.match_info["project"]
# Ditch all projects that aren't the one specif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def StopProject (paser):\n\tModKeyProjectProtection = Project.status()\t\t#Status del proyecto\n\n\tif ModKeyProjectProtection == False:\n\t\trepositorio.stopChanges()",
"def f_unlock(self):\n self._locked = False",
"def unlock(project, env_spec_name):\n failed = _check_problems(project)\n if fail... | [
"0.6348069",
"0.6022437",
"0.6013928",
"0.59228545",
"0.5799038",
"0.5796983",
"0.5793839",
"0.57587075",
"0.5754687",
"0.5732977",
"0.56677544",
"0.5666943",
"0.5657372",
"0.56248546",
"0.56235677",
"0.5605617",
"0.5602566",
"0.5585458",
"0.55657995",
"0.55327934",
"0.552069... | 0.70834726 | 0 |
Parse projects from userinfo. | def _get_projects_from_userinfo(
userinfo: typing.Dict[str, typing.Any],
) -> typing.List[typing.Any] | None:
if "sdConnectProjects" in userinfo:
# Remove the possibly existing "project_" prefix
projects = [
p.removeprefix("project_") for p in userinfo["sdConnectProjects"].split(" ")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_project(src_url: str) -> tuple:\n # TODO: improve the splitting with regex .. this way it misses some projects\n gh_user, gh_project = src_url.rsplit('/', 2)[-2:]\n\n return gh_user, gh_project",
"def get_user_projects(username):\n\n tx = cypher_transaction()\n query = \"\... | [
"0.638",
"0.6257913",
"0.6091854",
"0.5990585",
"0.5930123",
"0.5728555",
"0.5728555",
"0.570004",
"0.5605483",
"0.5585763",
"0.55782217",
"0.5531046",
"0.5516802",
"0.5503669",
"0.5475661",
"0.5474088",
"0.5468539",
"0.5466969",
"0.53591806",
"0.53487664",
"0.53265506",
"0... | 0.77144426 | 0 |
Transform the IO data into the requested format and projection if necessary. | def transform_data(self, outformat=None, epsg=None):
out_data = geopandas.GeoDataFrame.copy(self.data)
if epsg and str(self.get_epsg()) != epsg:
out_data[out_data.geometry.name] = \
self.data.geometry.to_crs(epsg=epsg)
out_data.crs = fiona.crs.from_epsg(epsg)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_converter(self, **kwds):\n if (self.reformat == 'zarr'):\n # output zarr file\n self.HDF5_to_zarr(**kwds)\n elif (self.reformat == 'HDF5'):\n # output rechunked HDF5 file\n self.HDF5_to_HDF5(**kwds)\n # elif (reformat == 'JPL'):\n # ... | [
"0.5569975",
"0.5505671",
"0.5388421",
"0.5375472",
"0.5293689",
"0.52527857",
"0.5248115",
"0.51841456",
"0.517878",
"0.51682824",
"0.5125906",
"0.50980085",
"0.50823504",
"0.5060049",
"0.50447756",
"0.49652284",
"0.49562937",
"0.4953078",
"0.49232402",
"0.49127552",
"0.4909... | 0.5966752 | 0 |
Create a FeatureIO object | def __init__(self, features=None, **kwargs):
super(FeatureIO, self).__init__(**kwargs)
self.features = features | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, features=None):\n self.features = features",
"def construct(data_dir, fname, X=None, normalize=False, _type='sparse'):\n if _type == 'sparse':\n return SparseFeatures(data_dir, fname, X, normalize)\n elif _type == 'dense':\n return DenseFeatures(data_dir, fname, X, n... | [
"0.649636",
"0.63637304",
"0.6343216",
"0.63154984",
"0.6243798",
"0.62359333",
"0.62053484",
"0.6069705",
"0.6026877",
"0.6018775",
"0.6010477",
"0.59540987",
"0.5934894",
"0.59044176",
"0.5893953",
"0.58894765",
"0.58461726",
"0.583732",
"0.58244425",
"0.58146846",
"0.58110... | 0.7322272 | 0 |
Apply filters to the dataset | def filter_data(self):
self.data = filter_pandas(self.data, self.filters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_filters(self, filters):\n self._data = self.model.objects.filter(**filters)",
"def filter(self, filters):",
"def filter_data(self, data):\n for f in self.filters:\n data = getattr(self, f)(data)\n return data",
"def filter_data(data,filters):\n final_filter = pd.S... | [
"0.76852214",
"0.7679097",
"0.75132066",
"0.7299479",
"0.7155812",
"0.7077142",
"0.6961737",
"0.6916808",
"0.68126285",
"0.67535377",
"0.6718354",
"0.66857404",
"0.6545745",
"0.6495445",
"0.6494822",
"0.6489582",
"0.6474239",
"0.645313",
"0.645255",
"0.6376576",
"0.6371919",
... | 0.7998662 | 0 |
Create an IO object containing a GaiaProcess to run | def __init__(self, process=None, parent=None, **kwargs):
super(ProcessIO, self).__init__(**kwargs)
self.process = process
self.parent = parent
self.default_output = process.default_output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_process() -> Process:\n return multiprocessing.Process()",
"async def open_process(\r\n cls, args: \"Union[str, List[str]]\", env_additions: Dict[str, str] = {}\r\n ) -> \"AsyncIterator[Expect]\":\r\n printer_channels: (\r\n \"Tuple[MemorySendChannel[bytes], MemoryReceiveCh... | [
"0.63116145",
"0.57088315",
"0.56168306",
"0.55841285",
"0.5541996",
"0.5525313",
"0.5505391",
"0.5478076",
"0.5466999",
"0.5392637",
"0.53815526",
"0.53630763",
"0.533476",
"0.5331508",
"0.53179747",
"0.5307854",
"0.5251125",
"0.5241876",
"0.5231719",
"0.52115893",
"0.520870... | 0.60687447 | 1 |
Instantiate a PostgisIO object for querying a PostGIS table | def __init__(self, table, **kwargs):
super(PostgisIO, self).__init__(**kwargs)
self.table = table
self.host = kwargs.get('host') or gaia.config['gaia_postgis']['host']
self.dbname = kwargs.get(
'dbname') or gaia.config['gaia_postgis']['dbname']
self.user = kwargs.get(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createPostgisConnection(dbFormat, dbHost, dbName, dbSchema, dbUser, dbPWD):\r\n\r\n pg = ogr.GetDriverByName(dbFormat)\r\n if pg is None:\r\n raise RuntimeError('{0} driver not available'.format(dbFormat))\r\n conn = pg.Open(\"PG:dbname='{0}' user='{1}' password='{2}'\".format(dbName, dbUser, d... | [
"0.6855516",
"0.67369133",
"0.6698161",
"0.64499944",
"0.62568384",
"0.6199102",
"0.603529",
"0.60263604",
"0.5996107",
"0.590071",
"0.5864445",
"0.58015627",
"0.56797826",
"0.5659731",
"0.56208915",
"0.55889374",
"0.55734766",
"0.5566591",
"0.5559148",
"0.55440044",
"0.54781... | 0.68292403 | 1 |
Make sure that all PostgisIO columns exist in the actual table | def verify(self):
for col in self.columns:
if col not in self.table_obj.columns.keys():
raise Exception('{} column not found in {}'.format(
col, self.table_obj)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify(self):\n for col in self._columns:\n if col not in self._table_obj.columns.keys():\n raise GaiaException('{} column not found in {}'.format(\n col, self._table_obj))",
"def test_missing_column(self):\n df = pd.DataFrame({\"notlat\": [1, 2, 3],... | [
"0.6435384",
"0.57924956",
"0.5753893",
"0.57230234",
"0.56842715",
"0.5627222",
"0.5578372",
"0.55553114",
"0.5551072",
"0.5520966",
"0.55202276",
"0.55151975",
"0.54960734",
"0.54696405",
"0.54570687",
"0.5438926",
"0.5419409",
"0.5386217",
"0.53728265",
"0.53636533",
"0.53... | 0.6008417 | 1 |
Get connection string based on host, dbname, username, password | def get_connection_string(self):
auth = ''
if self.user:
auth = self.user
if self.password:
auth = auth + ':' + self.password
if auth:
auth += '@'
conn_string = 'postgresql://{auth}{host}/{dbname}'.format(
auth=auth, host=self.host,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_connection_string(self):\n auth = ''\n if self._user:\n auth = self._user\n if self._password:\n auth = auth + ':' + self._password\n if auth:\n auth += '@'\n conn_string = 'postgresql://{auth}{host}/{dbname}'.format(\n auth=aut... | [
"0.7930437",
"0.7801941",
"0.76585364",
"0.7592892",
"0.75295997",
"0.7524706",
"0.74851537",
"0.73222303",
"0.72575486",
"0.7244134",
"0.72296304",
"0.7219336",
"0.7214253",
"0.71637756",
"0.70156115",
"0.6987775",
"0.69751585",
"0.6895092",
"0.6813161",
"0.68097425",
"0.680... | 0.7869148 | 1 |
Use SQLALchemy reflection to gather data on the table, including the geometry column, geometry type, and EPSG code, and assign to the PostgisIO object's attributes. | def get_table_info(self):
epsg = None
meta = MetaData()
table_obj = Table(self.table, meta,
autoload=True, autoload_with=self.engine)
if not self.columns:
self.columns = table_obj.columns.keys()
geo_cols = [(col.name, col.type) for col in tab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_info(self):\n epsg = None\n meta = MetaData()\n table_obj = Table(self._table, meta,\n autoload=True, autoload_with=self._engine)\n if not self._columns:\n self._columns = table_obj.columns.keys()\n geo_cols = [(col.name, col.type... | [
"0.70732105",
"0.68428886",
"0.6452087",
"0.624894",
"0.61648315",
"0.61188686",
"0.61173916",
"0.60497487",
"0.5862017",
"0.5860301",
"0.5783066",
"0.5763595",
"0.5719233",
"0.5694905",
"0.5623751",
"0.5593062",
"0.55429846",
"0.55166006",
"0.5488583",
"0.54816383",
"0.54250... | 0.71974653 | 0 |
Get the geometry type of the data | def get_geometry_type(self):
return self.geometry_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_geometry_type(self):\n return self._geometry_type",
"def geometry_type(self) -> ir.StringValue:\n return ops.GeoGeometryType(self).to_expr()",
"def geom_type(self): # -> str:\n ...",
"def geometry_type(number):\n try:\n return GDAL_GEOMETRY_TYPES[number]\n ... | [
"0.8112586",
"0.7843717",
"0.7644851",
"0.76259863",
"0.7605449",
"0.7579384",
"0.68932897",
"0.6887345",
"0.66878814",
"0.6671334",
"0.6600797",
"0.6596621",
"0.6585204",
"0.6499065",
"0.6425121",
"0.641309",
"0.6407867",
"0.6349588",
"0.6349588",
"0.6349588",
"0.6292295",
... | 0.8192831 | 0 |
Formulate a query string and parameter list based on the table name, columns, and filter | def get_query(self):
columns = ','.join(['"{}"'.format(x) for x in self.columns])
query = 'SELECT {} FROM "{}"'.format(columns, self.table)
filter_params = []
if self.filters:
filter_sql, filter_params = filter_postgis(self.filters)
query += ' WHERE {}'.format(fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_query(self):\n columns = ','.join(['\"{}\"'.format(x) for x in self._columns])\n query = 'SELECT {} FROM \"{}\"'.format(columns, self._table)\n filter_params = []\n if self._filters:\n filter_sql, filter_params = filter_postgis(self._filters)\n query += ' W... | [
"0.6481889",
"0.6394177",
"0.6319321",
"0.62386817",
"0.6229315",
"0.6171959",
"0.6170874",
"0.6115932",
"0.61042583",
"0.6103268",
"0.61031204",
"0.6026723",
"0.6023874",
"0.6014606",
"0.6011875",
"0.6009841",
"0.5997763",
"0.59938264",
"0.5971514",
"0.597093",
"0.5968318",
... | 0.6632733 | 0 |
Run a PostGIS query and return results as a GeoDataFrame | def df_from_postgis(engine, query, params, geocolumn, epsg):
data = geopandas.GeoDataFrame.from_postgis(
query,
engine,
geom_col=geocolumn,
crs={'init': 'epsg:{}'.format(epsg)},
params=params)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queryToPDTable(postgreSql_selectQuery):\n\n import os\n import psycopg2\n import pandas as pd\n\n #basic query function to the database using environmental variables for\n #the user name and password\n conn=psycopg2.connect(host=\"postgis1\",\n dbname=\"sdad\",\n ... | [
"0.68622106",
"0.6783693",
"0.6631549",
"0.65065295",
"0.64609385",
"0.6398335",
"0.63537514",
"0.63044345",
"0.629543",
"0.6189722",
"0.6184706",
"0.61680967",
"0.6097106",
"0.6089787",
"0.60863835",
"0.60695153",
"0.60299134",
"0.6028463",
"0.6016495",
"0.5989992",
"0.59744... | 0.83570623 | 0 |
Reproject a dataset to the specified EPSG code | def reproject(dataset, epsg):
dataclass = dataset.__class__.__name__
# Run appropriate reprojection method
if dataclass == 'GeoDataFrame':
repro = geopandas.GeoDataFrame.copy(dataclass)
repro[repro.geometry.name] = repro.geometry.to_crs(epsg=epsg)
repro.crs = fiona.crs.from_epsg(epsg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reproject_dataset_example(dataset, dataset_example, method=1):\n # open dataset that must be transformed\n try:\n if (os.path.splitext(dataset)[-1] == '.tif' or os.path.splitext(dataset)[-1] == '.TIF'):\n g = gdal.Open(dataset)\n else:\n g = dataset\n except:\n ... | [
"0.6619954",
"0.62397677",
"0.61324847",
"0.60862654",
"0.60619205",
"0.6057335",
"0.6052431",
"0.60024583",
"0.5995381",
"0.5954171",
"0.590265",
"0.58267164",
"0.58260304",
"0.57626706",
"0.5728477",
"0.56918794",
"0.5690801",
"0.5552014",
"0.55259335",
"0.5460811",
"0.5403... | 0.7723594 | 0 |
A configurable scatterplot of all activities. | def main_scatterplot(self) -> Component:
logger.debug('Generating main scatterplot.')
x_dropdown = dcc.Dropdown('overview_main_scatterplot_x_dropdown', options=[
{'label': 'Distance', 'value': 'distance'},
{'label': 'Average speed', 'value': 'mean_speed'},
{'label': ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_scatter(self):\n plt.scatter(self.a1[:, 0], self.a1[:, 1], c=\"red\", alpha=0.5, s=10)\n plt.scatter(self.a2[:, 0], self.a2[:, 1], c=\"blue\", alpha=0.5, s=10)\n plt.scatter(0, 0, marker=\"D\", c=\"black\", alpha=0.8)\n plt.scatter(2, 2, marker=\"D\", c=\"black\", alpha=0.8)\n ... | [
"0.67238843",
"0.6708577",
"0.66642416",
"0.6630281",
"0.630712",
"0.63052666",
"0.6298917",
"0.6278833",
"0.6265205",
"0.6168853",
"0.6166783",
"0.6123382",
"0.61222416",
"0.6115842",
"0.6083699",
"0.60783607",
"0.607288",
"0.6068224",
"0.6062484",
"0.6058355",
"0.6018583",
... | 0.7072408 | 0 |
Generate the chart figure for the main time plot. | def main_time_fig(self, freq: str, y: str) -> go.Figure:
if freq == 'weekly':
df = self.activity_manager.metadata_weekly_time_series()
date_label = 'Week of'
elif freq == 'monthly':
df = self.activity_manager.metadata_monthly_time_series()
date_label = 'Mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_time_chart(self) -> Component:\n logger.debug('Generating time graph.')\n df = self.activity_manager.metadata_weekly_time_series(activity_type='run')\n\n freq_dropdown = dcc.Dropdown('overview_main_time_chart_freq_dropdown', options=[\n {'label': 'Weekly', 'value': 'weekly'... | [
"0.7703338",
"0.68641454",
"0.6779474",
"0.6707098",
"0.65798086",
"0.65385634",
"0.65024126",
"0.6488374",
"0.6484134",
"0.64522904",
"0.6446261",
"0.6431686",
"0.63733166",
"0.63720703",
"0.6272359",
"0.62661344",
"0.6259788",
"0.6258643",
"0.62565494",
"0.62492335",
"0.623... | 0.7200148 | 1 |
Generate all graphs based on the contents of config.overview_graphs (which is in turn generated based on the contents of test_overview_graphs.json). See docs/graphs.rst for help on how test_overview_graphs.json is interpreted. | def custom_graphs(self) -> List[Component]:
graphs = []
# TODO: Figure this out
for i, go_data in enumerate(self.config.overview_graphs):
groupby = go_data.pop('groupby', None)
agg = go_data.pop('agg', None)
if groupby and agg:
data = getattr(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_statistics_plots(graph_name, graph_steps):\n df_final_situation = pd.DataFrame(columns=[\"type\", \"value\"])\n df_step = pd.DataFrame(columns=[\"type\", \"step\", \"value\"])\n df_exposed = pd.DataFrame(columns=[\"step\", \"type\", \"value\"])\n\n st.markdown(\"\")\n\n for i in range(g... | [
"0.57757014",
"0.571238",
"0.56258476",
"0.5602885",
"0.55782235",
"0.5502178",
"0.5366498",
"0.53558487",
"0.53391075",
"0.5319257",
"0.5311666",
"0.52981985",
"0.5294715",
"0.5271559",
"0.525541",
"0.5254248",
"0.5241613",
"0.5230479",
"0.522659",
"0.52127856",
"0.52093905"... | 0.62306833 | 0 |
Extracts square patches of patch_dim by patch_dim from the data. Returns a patch_dim^2 by numpatches matrix. | def extract_patches(data,patch_dim):
m = data.shape[0]
im_x = data.shape[1]
im_y = data.shape[2]
assert im_x%float(patch_dim)==0 and im_y%float(patch_dim)==0, \
"patch_size must divide x and y dimensions of image"
numpatchs = m*(im_x/patch_dim)*(im_y/patch_dim)
patch_size = patch_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patches_sampling(self, image, patch_size, stride):\n h, w = image.shape[2:4]\n patches = []\n for i in range(0, h - patch_size + 1, stride):\n for j in range(0, w - patch_size + 1, stride):\n patches.append(image[:, :, i:i + patch_size, j:j + patch_size])\n ... | [
"0.6891319",
"0.6779682",
"0.66917896",
"0.6450875",
"0.64256436",
"0.6412834",
"0.6366795",
"0.63452667",
"0.6342837",
"0.6332445",
"0.63294715",
"0.6287567",
"0.62787473",
"0.6240202",
"0.6159606",
"0.6138685",
"0.606784",
"0.60129994",
"0.597121",
"0.5943119",
"0.59225255"... | 0.7664922 | 0 |
Subtract DC component (mean) from each patch, and contrast normalize (divide by std dev). | def normalize(data):
p_means = np.mean(data,axis=0)
p_vars = np.var(data,axis=0)
# subtract dc component
data = data-p_means
# contrast normalize
data = data/np.sqrt(p_vars+10) # plus 10 to account for small variances
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_patches(patches):\n patches = array_ops.concat(patches, 0)\n mean, variance = nn.moments(patches, [1, 2, 3], keep_dims=True)\n patches = (patches - mean) / math_ops.sqrt(variance)\n return array_ops.reshape(patches, [array_ops.shape(patches)[0], -1])",
"def color_normalize(x, mean, std):\n ... | [
"0.6298055",
"0.5891793",
"0.58737147",
"0.58737147",
"0.5847109",
"0.5814175",
"0.57039946",
"0.5647964",
"0.5528056",
"0.5524043",
"0.55056757",
"0.5503953",
"0.54944885",
"0.5488362",
"0.54770255",
"0.5466837",
"0.5453476",
"0.54484415",
"0.53919643",
"0.53899807",
"0.5378... | 0.68733734 | 0 |
Makes ZCA whitening matrix (U(V+epsilonI)^(1/2)U^T), where U is the matrix of orthogonal eigenvectors and V the corresponding eigenvalues from eigenvalue decomposition of the covariance matrix for the data. | def whiten(data):
from numpy.linalg import eig
eps = 0.01
# covariance matrix
Sigma = np.cov(data)
# eigenvalue decomposition
V,U = eig(Sigma)
W = U.dot(np.diag((V+eps)**(-0.5)).dot(U.transpose()))
return W | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zca_whitening_matrix(X):\n # Covariance matrix [column-wise variables]: Sigma = (X-mu)' * (X-mu) / N\n sigma = np.cov(X, rowvar=True) # [M x M]\n # Singular Value Decomposition. X = U * np.diag(S) * V\n U,S,V = np.linalg.svd(sigma)\n # U: [M x M] eigenvectors of sigma.\n # S: [M x 1] ... | [
"0.76188344",
"0.69833094",
"0.69694257",
"0.668602",
"0.6582816",
"0.6568755",
"0.65559185",
"0.6485466",
"0.64088285",
"0.63796425",
"0.58479804",
"0.58176255",
"0.57855535",
"0.5762374",
"0.5539313",
"0.5447399",
"0.54079866",
"0.5402104",
"0.5383259",
"0.53804785",
"0.536... | 0.7267214 | 1 |
Extracts patches from data and whitens the patches. Returns whitened patches and whitening matrix. | def process(data,patch_dim,W=None):
# pull patches from image
patches = extract_patches(data,patch_dim)
# remove dc component and contrast normalize
patches = normalize(patches)
if W is None:
# build whitening matrix
W = whiten(patches)
# apply whitening
patches = W.dot(p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_patches(data, idxs=None, patch_size=3, min_val=0, ctx_radius=(3,5,7), economy_patch=True, mean=False):\n # catch errors and setup the initialize values of required variables\n if idxs is None:\n idxs = np.where(data > min_val)\n if patch_size % 2 != 1 and patch_size > 0:\n raise ... | [
"0.6271824",
"0.6121198",
"0.5840078",
"0.56840724",
"0.5544035",
"0.5534577",
"0.55345744",
"0.5533361",
"0.55265146",
"0.5479646",
"0.5470446",
"0.5416568",
"0.5400108",
"0.53770685",
"0.5371271",
"0.532619",
"0.531805",
"0.5317908",
"0.5315576",
"0.5302089",
"0.5280466",
... | 0.7724127 | 0 |
Saves images and corresponding whitened patches in a format that makes sense for the images class. | def save_data(data,patches,labels,name,patch_dim,size=None):
patchPerIm = (data.shape[1]*data.shape[2])/(patch_dim**2)
if size is None:
size = labels.shape[0]
img_f = open('data/images_'+name,'w')
patches_f = open('data/patches_'+name,'w')
label_f = open('data/labels_'+name,'w')
patc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_patches(self):\n filename = tkFileDialog.asksaveasfilename(initialdir = self.cwd, title = \"Save patches\", filetypes = ((\"inp file\",\"*.inp\"),(\"all files\",\"*.*\")))\n if filename:\n patches = self.myGlycosylator.export_patches(self.linked_glycans)\n with open(f... | [
"0.7023205",
"0.67222565",
"0.65105355",
"0.64340895",
"0.63914835",
"0.6342699",
"0.6314629",
"0.61798173",
"0.6148035",
"0.61195004",
"0.60702795",
"0.6026399",
"0.6015969",
"0.6014457",
"0.600203",
"0.5998917",
"0.59706134",
"0.5965257",
"0.5957205",
"0.59544414",
"0.59414... | 0.69192946 | 1 |
Save whitening matrix. (Probably don't need this funtion) | def save_whiten_mat(W):
w_id = open('data/W.bin','w')
W.tofile(w_id)
w_id.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, filename):\n hebbian_weights = open(filename, \"w\")\n for i in xrange(self.hidden):\n hebbian_weights.write(\"\\t\".join(self.vis_layer[i].get_weights()) + '\\n')\n for i in xrange(self.layers):\n for j in xrange(self.hidden):\n hebbian_weig... | [
"0.6092257",
"0.60249054",
"0.58878946",
"0.5833244",
"0.5784645",
"0.5762371",
"0.575296",
"0.56992406",
"0.5612847",
"0.5594328",
"0.5574145",
"0.5554583",
"0.5548206",
"0.5548206",
"0.55330473",
"0.5496872",
"0.5472161",
"0.54410243",
"0.54121757",
"0.5404685",
"0.53983784... | 0.76458836 | 0 |
Specific to CIFAR dataset Loads data from file, returns color, grayscale images and labels. | def load_cifar_images(filename):
from load_cifar import load_file
from load_cifar import label_dict
data,labels = load_file(filename)
# two classes to keep
class0 = label_dict['airplane']
class1 = label_dict['bird']
# remove all but two classes
keep = np.logical_or(labels==class0,labe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_CIFAR_batch(filename):\r\n with open(filename, 'rb') as f:\r\n datadict = pickle.load(f, encoding='latin1')\r\n X = datadict['data']\r\n Y = datadict['labels']\r\n X = X.reshape(10000, 3, 32, 32).transpose(0,2,3,1).astype(\"float\")\r\n Y = np.array(Y)\r\n return X, Y",
"def load_CIFA... | [
"0.73128104",
"0.7272266",
"0.7227609",
"0.7224899",
"0.7196789",
"0.71712595",
"0.71459734",
"0.7134772",
"0.7129105",
"0.7112924",
"0.70436376",
"0.6898891",
"0.6793835",
"0.67866397",
"0.6777393",
"0.6743453",
"0.67378056",
"0.67167586",
"0.6703161",
"0.66613394",
"0.66538... | 0.8135456 | 0 |
Main function to process the input file with the nlp pipeline. | def main(nlp, file_path, final_file_path, from_line=0, to_line=None):
with open(final_file_path, "w") as parsed_file:
with open(file_path) as cnn_dm:
line = cnn_dm.readline().strip()
article_idx = 0
while article_idx < from_line:
line = cnn_dm.readline().s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main ():\n\n\tfio = fileIo('input.txt')\n text = fio.getInput()\n\n\tp = re.compile(r'#?\\d[\\s\\.]?[\\s]?')\n\tout = filter(None, p.split(text))\n\ti = 0\n\tlistOfLists = []\n\t\n\n\tfor s in out:\n\t\ti += 1\n\t\ttext = nltk.word_tokenize(s)\n\t\tpos = nltk.pos_tag(text)\n\t\tpattern = \"NP: {<DT>?<JJ... | [
"0.6942143",
"0.65095925",
"0.6476295",
"0.64673996",
"0.62523973",
"0.625186",
"0.6231466",
"0.6204096",
"0.61911345",
"0.61845344",
"0.61776495",
"0.6155281",
"0.6135536",
"0.6135536",
"0.6135536",
"0.6103798",
"0.6096503",
"0.60951585",
"0.60811174",
"0.60290784",
"0.60128... | 0.6569378 | 1 |
Calculate the closest cruising altitude to the given altitude. | def closest_cruising_altitude(altitude):
return 1000 * ((altitude + 500) // 1000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def altitude(self):\n if self.__altitude:\n return sum(self.__altitude) / len(self.__altitude)\n else:\n return -9999",
"def altitude(self):\r\n pressure = self.pressure # in Si units for hPascal\r\n return 44330 * (1.0 - math.pow(pressure / self.sea_level_pressu... | [
"0.68563944",
"0.6599064",
"0.6381891",
"0.6333543",
"0.6299421",
"0.6299421",
"0.62524825",
"0.61202556",
"0.609955",
"0.60223883",
"0.5997195",
"0.595264",
"0.5929024",
"0.59270704",
"0.58204633",
"0.5791743",
"0.5770483",
"0.5733085",
"0.5660749",
"0.5638563",
"0.5614531",... | 0.8231129 | 0 |
Determine whether an altitude may be a cruising altitude. | def is_cruising(altitude, cruise_altitude=None):
if cruise_altitude is None:
cruise_altitude = closest_cruising_altitude(altitude)
return abs(altitude - cruise_altitude) <= 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_elevation(self):\n return not self._is_depth",
"def altitude(self):\n if self.__altitude:\n return sum(self.__altitude) / len(self.__altitude)\n else:\n return -9999",
"def is_slope(self):\n\t\tif self.high_elevation != self.low_elevation:\n\t\t\treturn True\n\... | [
"0.62690014",
"0.60328066",
"0.58956814",
"0.58533365",
"0.57905114",
"0.5768535",
"0.57448244",
"0.5742459",
"0.56997365",
"0.56776786",
"0.56776786",
"0.5669931",
"0.566654",
"0.56537473",
"0.5641513",
"0.56306905",
"0.5626469",
"0.56141675",
"0.55750054",
"0.5573237",
"0.5... | 0.713465 | 0 |
Find pairs of start/finish indicies of consecutive altitudes with the same value. I.e. where an aircraft was in level flight. | def find_level_sections(alts):
# Get the indicies of positions at the starts and end of levels
level_indicies = []
if len(alts) > 2:
prev_alt = alts[0]
alt = alts[1]
# If the first two altitudea are the same, mark as is_level
is_level = (prev_alt == alt)
if is_level... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection_distances(self, altitude, start_distance, finish_distance):\n distances = []\n alt_index, alt_ratio = calculate_value_reference(self.distances,\n start_distance)\n start_alt = calculate_value(self.altitudes, alt_index, al... | [
"0.61895657",
"0.57591677",
"0.5693731",
"0.55963063",
"0.5349171",
"0.5304589",
"0.52295",
"0.51885813",
"0.51586705",
"0.51529676",
"0.5115243",
"0.51014274",
"0.5073773",
"0.5066128",
"0.5040757",
"0.50405693",
"0.5022069",
"0.5019296",
"0.50123805",
"0.50085217",
"0.49733... | 0.61840254 | 1 |
Find pairs of start/finish indicies of altitudes where an aircraft was cruising. | def find_cruise_sections(altitudes):
indicies = find_level_sections(altitudes)
if indicies:
prev_altitude = altitudes[indicies[0]]
cruise_altitude = closest_cruising_altitude(prev_altitude)
was_cruising = is_cruising(prev_altitude, cruise_altitude)
prev_altitude = cruise_altitud... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection_distances(self, altitude, start_distance, finish_distance):\n distances = []\n alt_index, alt_ratio = calculate_value_reference(self.distances,\n start_distance)\n start_alt = calculate_value(self.altitudes, alt_index, al... | [
"0.6280308",
"0.59270215",
"0.58374995",
"0.5785568",
"0.5549861",
"0.54942876",
"0.5423105",
"0.539191",
"0.5391667",
"0.5305186",
"0.5304457",
"0.5252072",
"0.5251932",
"0.5228445",
"0.5205544",
"0.51648146",
"0.5155315",
"0.51186764",
"0.5109229",
"0.5094685",
"0.5079075",... | 0.59695065 | 1 |
Set cruising altitudes to the closest cruising altitude. | def set_cruise_altitudes(altitudes, cruise_indicies):
if cruise_indicies:
for index in range(0, len(cruise_indicies), 2):
start = cruise_indicies[index]
stop = cruise_indicies[index + 1]
if start < stop:
cruise_altitude = closest_cruising_altitude(altitude... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_altitude(self):\n self.altitude = self.Calculations.convert_to_altitude( self.declination, self.right_ascension, self.Latitude, self.LHA)\n print('altitude set to', self.altitude)\n if self.altitude < 0:\n self.altitude = self.altitude + 360.0\n return self.altitu... | [
"0.6397559",
"0.60705537",
"0.58555746",
"0.58198625",
"0.5693789",
"0.55685645",
"0.5377789",
"0.5350137",
"0.5192501",
"0.5148783",
"0.51282614",
"0.51085854",
"0.51039815",
"0.49786505",
"0.49037406",
"0.48799503",
"0.48787838",
"0.48784757",
"0.48330465",
"0.48201117",
"0... | 0.6250826 | 1 |
Classify an altitude profile based on the altitudes. | def classify_altitude_profile(altitudes):
max_alt = altitudes.max()
has_climb = (max_alt > altitudes[0])
has_descent = (max_alt > altitudes[-1])
if has_climb or has_descent:
if has_climb != has_descent:
return AltitudeProfileType.CLIMBING if has_climb \
else Altitude... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def altitude_profile(self, alt):\n # checking if the units entered are km\n if alt.unit == u.km:\n if 150 <= alt.value < 500:\n alt_properties = self._altitude_profile(500)\n else:\n alt_properties = self._altitude_profile(alt.value)\n\n retu... | [
"0.7040563",
"0.60490364",
"0.5742719",
"0.569368",
"0.56679446",
"0.5570887",
"0.5441801",
"0.54371053",
"0.5434901",
"0.53988135",
"0.52956814",
"0.5294227",
"0.5294227",
"0.52853245",
"0.5224944",
"0.52045184",
"0.51312333",
"0.51289755",
"0.50556916",
"0.50430584",
"0.503... | 0.7570481 | 0 |
Interpolate altitudes at distance values. Uses the scipy.interpolate.interp1d function to linearly interpolate altitudes at the required distances. | def interpolate(self, distances):
cs = interp1d(self.distances, self.altitudes, fill_value='extrapolate')
return cs(distances) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate(self, distance, normalized=...): # -> BaseGeometry:\n ...",
"def interpolate(i0, d0, i1, d1):\n if i0 == i1:\n return [d0]\n values = []\n a = (d1 - d0) / (i1 - i0)\n d = d0\n for i in range(i0,i1+1):\n values.append(d)\n d = d + a\n return values",
... | [
"0.6566528",
"0.5902961",
"0.58026075",
"0.57675046",
"0.5665642",
"0.5541325",
"0.5525913",
"0.5521779",
"0.5509595",
"0.5484826",
"0.5441326",
"0.54245895",
"0.5362832",
"0.5246091",
"0.52411157",
"0.5231471",
"0.5227989",
"0.5221338",
"0.5212287",
"0.520249",
"0.5196203",
... | 0.8268463 | 0 |
Determine the range of altitudes between start_distance and finish_distance. | def altitude_range(self, start_distance, finish_distance):
start_index, start_ratio = calculate_value_reference(self.distances,
start_distance)
start_alt = calculate_value(self.altitudes, start_index, start_ratio)
finish_index, finish_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection_distances(self, altitude, start_distance, finish_distance):\n distances = []\n alt_index, alt_ratio = calculate_value_reference(self.distances,\n start_distance)\n start_alt = calculate_value(self.altitudes, alt_index, al... | [
"0.7745811",
"0.5996923",
"0.58210236",
"0.5799497",
"0.5713338",
"0.57017654",
"0.56947106",
"0.5679401",
"0.5613159",
"0.5584916",
"0.5583578",
"0.55816114",
"0.5579437",
"0.54959893",
"0.54946244",
"0.5478117",
"0.5467547",
"0.5465406",
"0.54653704",
"0.54519516",
"0.54467... | 0.912184 | 0 |
Determine the index of the top of climb altitude. Returns The index of the first cruising altitude. | def top_of_climb_index(self):
return self.altitudes.argmax() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_of_descent_index(self):\n tod = self.altitudes.argmax()\n # if the altitude profile is not just a climb\n # and there is a cruising section\n if (tod < len(self.altitudes) - 1) and \\\n (self.altitudes[tod] == self.altitudes[tod + 1]):\n tod += 1\n\n ... | [
"0.82650274",
"0.6586973",
"0.64087886",
"0.63747007",
"0.63523763",
"0.62209785",
"0.60802037",
"0.6078412",
"0.60293245",
"0.60026336",
"0.59891087",
"0.5984468",
"0.5980566",
"0.5978508",
"0.5973972",
"0.59719825",
"0.59692377",
"0.5964401",
"0.59599084",
"0.59111434",
"0.... | 0.84036976 | 0 |
Determine the index of the top of climb altitude. Returns The index of the last cruising altitude. | def top_of_descent_index(self):
tod = self.altitudes.argmax()
# if the altitude profile is not just a climb
# and there is a cruising section
if (tod < len(self.altitudes) - 1) and \
(self.altitudes[tod] == self.altitudes[tod + 1]):
tod += 1
return to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_of_climb_index(self):\n return self.altitudes.argmax()",
"def alt_index(self) -> Optional[int]:\n if not self.is_hom_alt():\n return None\n return max(self.allele1, self.allele2) - 1",
"def top_offset(self):\n raise NotImplementedError",
"def top(self):\n ... | [
"0.845523",
"0.66592854",
"0.6438688",
"0.64357513",
"0.64272976",
"0.64195174",
"0.6181029",
"0.6179077",
"0.6126768",
"0.61237574",
"0.6112536",
"0.61075664",
"0.61017954",
"0.60960674",
"0.60574836",
"0.6043104",
"0.60421985",
"0.6038397",
"0.6038397",
"0.60144544",
"0.601... | 0.82606477 | 1 |
Determine the path distance of the top of climb altitude. Returns The path distance of the first cruising altitude. | def top_of_climb_distance(self):
return self.distances[self.top_of_climb_index()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest_cruising_altitude(altitude):\n return 1000 * ((altitude + 500) // 1000)",
"def find_closest_path(self):\n\t\tclosest_distance = sys.maxint\n\t\tclosest_path = 0\n\t\tbike_position = (self.map_model.bike.xB, self.map_model.bike.yB)\n\t\tfor path_index in range(len(self.map_model.paths)):\n\t\t\tnea... | [
"0.6739397",
"0.63740313",
"0.62297326",
"0.6201111",
"0.61479735",
"0.6109232",
"0.58568966",
"0.57820773",
"0.5728556",
"0.5677432",
"0.5653691",
"0.5620571",
"0.5601367",
"0.55796075",
"0.55561036",
"0.5536733",
"0.5516684",
"0.55092776",
"0.54958546",
"0.5482631",
"0.5458... | 0.69647264 | 0 |
Determine the path distance of the top of descent altitude. Returns The path distance of the first cruising altitude. | def top_of_descent_distance(self):
return self.distances[self.top_of_descent_index()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest_cruising_altitude(altitude):\n return 1000 * ((altitude + 500) // 1000)",
"def top_of_descent_index(self):\n tod = self.altitudes.argmax()\n # if the altitude profile is not just a climb\n # and there is a cruising section\n if (tod < len(self.altitudes) - 1) and \\\n ... | [
"0.6641679",
"0.6360074",
"0.6237355",
"0.6115602",
"0.6089604",
"0.5971742",
"0.5874693",
"0.58288443",
"0.5771951",
"0.57360345",
"0.5729539",
"0.57193947",
"0.56928456",
"0.5685602",
"0.5612506",
"0.5589079",
"0.5577618",
"0.557536",
"0.55737656",
"0.55690765",
"0.55622447... | 0.660244 | 1 |
Calculate distances where the profile is at the given altitude. | def intersection_distances(self, altitude, start_distance, finish_distance):
distances = []
alt_index, alt_ratio = calculate_value_reference(self.distances,
start_distance)
start_alt = calculate_value(self.altitudes, alt_index, alt_ratio)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def altitude_profile(self, alt):\n # checking if the units entered are km\n if alt.unit == u.km:\n if 150 <= alt.value < 500:\n alt_properties = self._altitude_profile(500)\n else:\n alt_properties = self._altitude_profile(alt.value)\n\n retu... | [
"0.69530743",
"0.65202653",
"0.6478382",
"0.6396903",
"0.639056",
"0.6178385",
"0.6178385",
"0.6144988",
"0.60816115",
"0.58620787",
"0.58369505",
"0.58215445",
"0.58118826",
"0.57391644",
"0.5735804",
"0.5733575",
"0.57045203",
"0.5664503",
"0.56433076",
"0.5625876",
"0.5607... | 0.67026734 | 1 |
Search for the best move from the available legal moves and return a result before the time limit expires. This function must perform iterative deepening if self.iterative=True, and it must use the search method (minimax or alphabeta) corresponding to the self.method value. | def get_move(self, game, legal_moves, time_left):
self.time_left = time_left
# TODO: finish this function!
# Perform any required initializations, including selecting an initial
# move from the game board (i.e., an opening book), or returning
# immediately if there are no lega... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_move(self, game, legal_moves, time_left):\n\n self.time_left = time_left\n move = (-1, -1) #Default\n\n # Perform any required initializations, including selecting an initial\n # move from the game board (i.e., an opening book), or returning\n # immediately if there are n... | [
"0.7615938",
"0.7580609",
"0.75804436",
"0.7556078",
"0.7551935",
"0.7549352",
"0.7547239",
"0.7546612",
"0.749754",
"0.74660885",
"0.74633837",
"0.74536973",
"0.74295133",
"0.74123883",
"0.73986655",
"0.7377251",
"0.7368126",
"0.73495144",
"0.73442507",
"0.73434174",
"0.7336... | 0.77402973 | 0 |
project model points onto a unit cylinder, r=1, h=1. | def project_to_cylinder(points):
r, phi, z = cs.cart2cyl(points[:, 0], points[:, 1], points[:, 2])
# NOTE: z is unchanged
# print(np.array_equal(z, points[:, 2]))
# project onto unit cylinder
x_cyl = points[:, 0] / r
y_cyl = points[:, 1] / r
z_cyl = (z - z.min()) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makecylinder(model=[0,0,0,1,0,0,1],height = 1,density=10):\n # extract info from cylinder model\n radius = model[6]\n X,Y,Z = model[:3]\n # get 3d points to make an upright cylinder centered to the origin\n n = np.arange(0,360,int(360/density))\n height = np.arange(0,height,height/density)\n ... | [
"0.64186925",
"0.6152617",
"0.6123609",
"0.59477514",
"0.5873414",
"0.5837798",
"0.57903296",
"0.57313627",
"0.57169354",
"0.5623152",
"0.5608285",
"0.5554857",
"0.5532812",
"0.5519945",
"0.5469074",
"0.5449008",
"0.54360414",
"0.54175097",
"0.538803",
"0.53823644",
"0.534602... | 0.7416266 | 0 |
Fetch all the snapshots for the website. | def fetch_all_snapshots(archive_dir, wayback_filename, target_url):
# Read the list of snapshots.
with open(wayback_filename) as f:
data = f.read()
url_template = "http://web.archive.org/web/{timestamp}/{target_url}"
snapshots = data.split("\n")
pages_downloaded = 0
pages_failed = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_snapshots(self):\n _url = f\"{self.connector.base_url}/projects/{self.project_id}/snapshots\"\n\n response = self.connector.http_call(\"get\", _url)\n self.snapshots = response.json()",
"def getSnapshots(self):\n snapshots = []\n for x in self.root.goto('CommonDataObjec... | [
"0.7107948",
"0.6342461",
"0.63190186",
"0.6062705",
"0.6008981",
"0.60044056",
"0.59348845",
"0.5923568",
"0.5910609",
"0.58923537",
"0.58885777",
"0.5885084",
"0.58506715",
"0.5839381",
"0.5786904",
"0.5775894",
"0.57698756",
"0.5746789",
"0.5741458",
"0.5722078",
"0.570577... | 0.6720883 | 1 |
Evaluate modules in stack, starting at module start. When stack is fitting (valmode is False), simply calls mod.evaluate() for each module in the stack. However, when the stack is testing (valmode is True), evaluate first calls an est/val function to create a list of validation datasets ("nest"). It then extracts the f... | def evaluate(self, start=0):
if self.valmode and self.meta['nests'] > 0:
# new nested eval, doesn't require special evaluation procedure
# by modules. instead, all the remapping and collecting of val
# data from each nest handled inside this evaluation function.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_old(self, start=0):\n\n if self.valmode and self.nests > 0:\n # evaluate using the old nesting scheme devised by Noah\n # this section is deprecated and should be deleted\n\n log.info('Evaluating nested validation data')\n mse_idx = ut.utils.find_modu... | [
"0.68430686",
"0.6166602",
"0.55665743",
"0.5501617",
"0.54066515",
"0.54039",
"0.53980684",
"0.53958213",
"0.53774875",
"0.5376684",
"0.537446",
"0.53603584",
"0.52973723",
"0.52973723",
"0.52973723",
"0.52870274",
"0.5280845",
"0.52624315",
"0.52150756",
"0.5192127",
"0.516... | 0.77966243 | 0 |
Insert a module at index in stack, then evaluate the inserted module and reappend all the modules that were in the stack previously, starting with the insertion index. | def insert(self, mod=None, idx=None, **xargs):
# if no index is given or index is out of bounds,
# just append mod to the end of the stack
if (not idx) or (idx > len(self.modules) - 1)\
or (idx < -1 * len(self.modules) - 1):
self.append(mod, **xargs)
idx ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, index: int, tree: 'Tree') -> None:\n ...",
"def insert(self, indexes: Tuple[int, ...], tree: 'Tree') -> None:\n ...",
"def insert(self, *a):\r\n return self.stack.insert(*a)",
"def insert_index(self):\n pass",
"def remove(self, idx=None, mod=None, all_idx=False)... | [
"0.5868107",
"0.5672296",
"0.54033864",
"0.5368524",
"0.5336604",
"0.5311128",
"0.5281682",
"0.526412",
"0.5255213",
"0.5232728",
"0.51956016",
"0.5193696",
"0.51654994",
"0.5146614",
"0.51329195",
"0.5129675",
"0.51240057",
"0.509366",
"0.5091687",
"0.5084046",
"0.50813216",... | 0.7795618 | 0 |
Remove the module at the given index in stack, then reappend all modules that came after the removed module. | def remove(self, idx=None, mod=None, all_idx=False):
if mod and not idx:
idx = ut.utils.find_modules(self, mod.name)
if not idx:
log.warn("Module does not exist in stack.")
return
if not all_idx:
# Only remove the instance with... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_at(self, index):\n if len(self.stacks[index]) < 1:\n return\n popped = self.stacks[index].pop()\n if index == len(self.stacks)-1:\n return popped\n for i in range(index, len(self.stacks)-1):\n # append to last operation\n self.stacks[i... | [
"0.62720364",
"0.6165815",
"0.6154364",
"0.6141485",
"0.58771044",
"0.580344",
"0.57758456",
"0.56776845",
"0.5672032",
"0.56380874",
"0.56142616",
"0.5602583",
"0.5561665",
"0.5540167",
"0.5531981",
"0.5488315",
"0.5434079",
"0.54173774",
"0.5400926",
"0.5400379",
"0.5378563... | 0.70490533 | 0 |
For remove and insert wasn't sure if the original popmodule method had a specific usecase, so I didn't want to modify it. Can merge the two if these changes won't cause issues. Removes the last module from stack lists, along with its corresponding data and name (and id?). | def popmodule_2(self):
m = self.modules.pop(-1)
self.data.pop(-1)
self.mod_names.pop(-1)
# Doesn't look like this one is being used yet?
# self.mod_ids.pop(-1)
return m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self):\n return self.stack_list.pop()",
"def pop():",
"def delete_stack(Name=None):\n pass",
"def delModule(name):",
"def pop(self):",
"def pop(self):",
"def pop(self):\n del self.args[self.type_stack.pop()]\n self.id_stack.pop()",
"def popleft(self):\n return... | [
"0.6424905",
"0.60469043",
"0.6003137",
"0.59415084",
"0.5937875",
"0.5937875",
"0.59241915",
"0.5911617",
"0.5885596",
"0.581243",
"0.5812425",
"0.5803043",
"0.5738069",
"0.5673044",
"0.5652739",
"0.5649205",
"0.56475323",
"0.5647359",
"0.5626168",
"0.56206787",
"0.56127673"... | 0.78367704 | 0 |
Copy of quick_plot for easy save or embed. | def quick_plot_save(self, mode='png'):
batch = self.meta['batch']
cellid = self.meta['cellid']
modelname = self.meta['modelname']
fig = plt.figure(figsize=(8, 9))
plot_set = []
for idx, m in enumerate(self.modules):
if m.auto_plot:
plot_set.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_plot(self, ):\n pass",
"def showPlot1(): \n raise NotImplementedError",
"def showPlot2():\n raise NotImplementedError",
"def defineQuickplot(self, file, var):\n if self.quickplotItem is None:\n self.quickplotItem = QDefinedVariableItem(file, var, 'quickplot')\n ... | [
"0.6487135",
"0.636231",
"0.6337448",
"0.6284134",
"0.62655956",
"0.6180178",
"0.61296946",
"0.6100648",
"0.5995507",
"0.598488",
"0.58660775",
"0.58647877",
"0.58567715",
"0.5847191",
"0.58060396",
"0.5795975",
"0.5787422",
"0.5727069",
"0.5726445",
"0.57166964",
"0.5672869"... | 0.6503567 | 0 |
Set the source path | def set_source_path(self, folder):
self.source_path = folder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setSourcePath(self, sourcePath):\n self.__sourcePath = sourcePath",
"def set_source_file(self, source_file):\n self.set_attribute(\"source_file\", source_file)",
"def set_source(self, source):\n self.data['source'] = source",
"def set_source(self, source_name):\n self.source =... | [
"0.83226603",
"0.74998415",
"0.71865904",
"0.7161414",
"0.70848644",
"0.707815",
"0.7022367",
"0.7016785",
"0.6977186",
"0.6977186",
"0.6977186",
"0.6977186",
"0.6977186",
"0.6977186",
"0.6977186",
"0.6824116",
"0.6796334",
"0.67032343",
"0.6652705",
"0.65941703",
"0.65592533... | 0.8053338 | 1 |
Get the source path | def get_source_path(self):
return self.source_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_file_path(self) -> str:\n return self._source_file_path",
"def GetSrc():\n return os.path.abspath(os.path.join(_THIS_DIR, os.pardir, os.pardir,\n os.pardir))",
"def path(self) -> str:\n return self.src + \"/\"",
"def get_source_file(self):\n ... | [
"0.8576688",
"0.8262134",
"0.79809034",
"0.7795228",
"0.77610385",
"0.7651921",
"0.76108766",
"0.7521036",
"0.75103116",
"0.75041884",
"0.7452256",
"0.7439682",
"0.7434683",
"0.73519576",
"0.73273706",
"0.7324913",
"0.7315504",
"0.72917026",
"0.72893727",
"0.72733146",
"0.727... | 0.8933967 | 0 |
Retrieves the base MAC address for the module | def get_base_mac(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_mac_address(self):\n str_hex_mac = uuid.UUID(int=uuid.getnode()).hex[-12:]\n return str_hex_mac",
"def _get_mac_address():\n if not sys.platform.startswith('linux'):\n raise RuntimeError(\n 'Cannot get the MAC address on non-Linux platforms'\n )... | [
"0.7351595",
"0.73193",
"0.7172374",
"0.7152699",
"0.7143644",
"0.69826794",
"0.6948817",
"0.6934663",
"0.6881184",
"0.68360406",
"0.6744061",
"0.6730958",
"0.6698504",
"0.66975266",
"0.66299105",
"0.6609018",
"0.6609018",
"0.65955216",
"0.65718997",
"0.6496191",
"0.6475652",... | 0.80171996 | 0 |
Retrieves a list of the names of components available on the module (e.g., BIOS, CPLD, FPGA, etc.) | def get_component_name_list(self):
return self._component_name_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chipset_driver_modules(self):\n\t\treturn self.__info_dict['info']['chipset_driver_modules']['value']",
"def list_components(self) -> Dict[str, Any]:\n return self._manager.list_components()",
"def getModuleNames():\n import setup\n names = [e.name[1:] for e in setup.wxpExtensions]\n return... | [
"0.675362",
"0.6675968",
"0.6539068",
"0.6341745",
"0.63289636",
"0.62775135",
"0.6247974",
"0.62147105",
"0.6186656",
"0.6176592",
"0.6158209",
"0.6141283",
"0.6056836",
"0.605391",
"0.60498637",
"0.6042864",
"0.6035058",
"0.602026",
"0.59946656",
"0.59918433",
"0.59878767",... | 0.6718576 | 1 |
Install firmware to component | def install_component_firmware(self, component_name, image_path):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_firmware(self, firmware_file_path: str) -> None:\n raise NotImplementedError()",
"def install_firmware(self, image_path):\n \"\"\"Not Implement\"\"\"\n return False",
"def install_firmware(self, pbz_path, recovery=False):\n\n\t\tresources = None\n\t\twith zipfile.ZipFile(pb... | [
"0.7489954",
"0.73957425",
"0.70389396",
"0.68635696",
"0.6861828",
"0.67708874",
"0.67589694",
"0.67289037",
"0.6711583",
"0.66553813",
"0.64939946",
"0.6420946",
"0.63295645",
"0.6287184",
"0.62524647",
"0.61841255",
"0.61578",
"0.60796416",
"0.6072762",
"0.6050385",
"0.604... | 0.7738532 | 0 |
Retrieves fan module represented by (0based) index | def get_fan(self, index):
fan = None
try:
fan = self._fan_list[index]
except IndexError:
sys.stderr.write("Fan index {} out of range (0-{})\n".format(
index, len(self._fan_list)-1))
return fan | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index(self):\n\t\treturn call_sdk_function('PrlBootDev_GetIndex', self.handle)",
"def index(self):\n return self._data.get('index')",
"def get(self, index):\n raise NotImplementedError() # pragma: no cover",
"def index(self):\n return self.container['index']",
"def index(self) ... | [
"0.6386185",
"0.58992296",
"0.5883011",
"0.58483106",
"0.5820761",
"0.5784802",
"0.56571335",
"0.56555796",
"0.5613986",
"0.55979806",
"0.5572192",
"0.5569636",
"0.55565727",
"0.5548922",
"0.5546313",
"0.55427456",
"0.554139",
"0.554139",
"0.5529777",
"0.55279493",
"0.5519806... | 0.6381616 | 1 |
Retrieves the number of thermals available on this module | def get_num_thermals(self):
return len(self._thermal_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_herbs(self):\n return self._num_herbs",
"def n_thres(self):\n return np.size(self.thres)",
"def module_count(self):\n return self._module_count",
"def thres(self):\n return self._thres",
"def num_tanks(self):\n return len(self._node_reg.tank_names)",
"def get_num_cl... | [
"0.65417665",
"0.64836925",
"0.6480519",
"0.6358993",
"0.61816263",
"0.6166796",
"0.61326504",
"0.6097328",
"0.6085249",
"0.60553885",
"0.60377574",
"0.6029889",
"0.6029889",
"0.60067743",
"0.6000151",
"0.5981292",
"0.59744334",
"0.59277475",
"0.59189385",
"0.58891124",
"0.58... | 0.70140344 | 0 |
Retrieves all thermals available on this module | def get_all_thermals(self):
return self._thermal_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thres(self):\n return self._thres",
"def listOfTTHalfModules():\n hm = TTModulesMap_instance.dictOfHalfModules\n listOfHalfModules = []\n for ul in hm.keys():\n for reg in hm[ul].keys():\n for module in hm[ul][reg]:\n for halfmod in hm[ul][reg][module]:\n ... | [
"0.62711614",
"0.59908235",
"0.59710574",
"0.5953332",
"0.56614625",
"0.56347954",
"0.5541476",
"0.5494775",
"0.5479787",
"0.5398086",
"0.5393271",
"0.5389046",
"0.53820115",
"0.5353621",
"0.5340566",
"0.53130895",
"0.52500635",
"0.5216711",
"0.51958674",
"0.5191442",
"0.5184... | 0.6584657 | 0 |
Retrieves thermal unit represented by (0based) index | def get_thermal(self, index):
thermal = None
try:
thermal = self._thermal_list[index]
except IndexError:
sys.stderr.write("THERMAL index {} out of range (0-{})\n".format(
index, len(self._thermal_list)-1))
return thermal | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_at(self, index):\n return self.child_at(index)",
"def unit_of_measurement(self):\n return 'index'",
"def get_wave_unit(tag, hdulist, idx=None):\n from astropy.units import Unit\n if idx is None:\n idx = 1\n # Use Table\n if isinstance(hdulist[idx],BinTableHDU):\n ... | [
"0.6782312",
"0.6672872",
"0.6465281",
"0.62784415",
"0.61447746",
"0.6080922",
"0.6078993",
"0.60755485",
"0.60755485",
"0.60755485",
"0.5995953",
"0.59833705",
"0.5874957",
"0.5864363",
"0.5839025",
"0.5820442",
"0.5817567",
"0.5805475",
"0.5805475",
"0.57990026",
"0.579775... | 0.7130597 | 0 |
Retrieves the number of sfps available on this module | def get_num_sfps(self):
return len(self._sfp_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_count():\n _check_init()\n return _pypm.CountDevices()",
"def get_num_psus(self):\n return len(self._psu_list)",
"def module_count(self):\n return self._module_count",
"def get_spitfp_error_count(self):\n return GetSPITFPErrorCount(*self.ipcon.send_request(self, BrickletBaromet... | [
"0.68690604",
"0.6832386",
"0.6471102",
"0.63796633",
"0.6281832",
"0.6270548",
"0.62695867",
"0.6203247",
"0.6201169",
"0.6189551",
"0.61816835",
"0.6102134",
"0.60676277",
"0.6062961",
"0.6058272",
"0.6052856",
"0.6033939",
"0.60258675",
"0.60258675",
"0.6015374",
"0.601395... | 0.8088208 | 0 |
Retrieves all sfps available on this module | def get_all_sfps(self):
return self._sfp_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sp_policys(self, context):\n # handling policys method in RPC\n response = self.dns_manager.get_sp_policys(context)\n return response",
"def get_services(self):\r\n return get_service_list()",
"def get_num_sfps(self):\n return len(self._sfp_list)",
"def available_se... | [
"0.58436906",
"0.5787607",
"0.57075214",
"0.5639271",
"0.5581612",
"0.55547",
"0.5551602",
"0.55474824",
"0.5540281",
"0.551357",
"0.5476573",
"0.54620093",
"0.54596883",
"0.54454136",
"0.54394895",
"0.5405636",
"0.54031163",
"0.5376224",
"0.5344542",
"0.5316873",
"0.53115666... | 0.8060464 | 0 |
Retrieves sfp represented by (0based) index | def get_sfp(self, index):
sfp = None
try:
sfp = self._sfp_list[index]
except IndexError:
sys.stderr.write("SFP index {} out of range (0-{})\n".format(
index, len(self._sfp_list)-1))
return sfp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index):\n raise NotImplementedError() # pragma: no cover",
"def GetSashPosition(self, idx):\n assert idx < len(self._sashes)\n return self._sashes[idx]",
"def refFromIndex(index):\n fileno = math.floor(index // 100000)\n frame = index % 100000\n return fileno, frame",
"... | [
"0.60268134",
"0.59960663",
"0.5991602",
"0.5973616",
"0.59693825",
"0.59281826",
"0.5861673",
"0.58611625",
"0.5817246",
"0.58011967",
"0.57925785",
"0.5776426",
"0.57741547",
"0.57703364",
"0.57695585",
"0.5764657",
"0.5751148",
"0.5742006",
"0.5740557",
"0.5737907",
"0.571... | 0.8008134 | 0 |
create u_{x} matrix operator using the upwind method. | def create_Ux_mat(x):
dx = x[1] - x[0]
## upwind method based on left cells moving right
## and right cells moving left (similar to a scratch assay)
'''x_int = np.arange(1,len(x)-1,dtype=int)
Ux_mat_row = np.hstack((x_int, x_int))
Ux_mat_col = np.hstack((x_int, x_int[:len(x_int)/2]-1,x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_Uxx_mat(x):\n \n\n dx = x[1] - x[0]\n \n x_int = np.arange(1,len(x)-1,dtype=int)\n #create u_{xx} matrix operator\n Uxx_mat_row = np.hstack((x_int,x_int,x_int))\n Uxx_mat_col = np.hstack((x_int-1,x_int,x_int+1))\n Uxx_entry = (1/(dx**2))*np.hstack((np.ones(len(x)-2),-2*np.ones(le... | [
"0.6904973",
"0.67573005",
"0.618727",
"0.58783466",
"0.5850389",
"0.57314026",
"0.5695365",
"0.5695365",
"0.56091934",
"0.55918",
"0.5560309",
"0.5517079",
"0.54789305",
"0.547467",
"0.5455033",
"0.5443935",
"0.5443935",
"0.5387152",
"0.537313",
"0.5366446",
"0.53465855",
... | 0.77150667 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.