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
Gets the player list
def getPlayerList(self): return(self.playerList)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _player_list(self):\n game = self.ctrl.game\n return game.players[self.i_to_player_id(0)], game.players[self.i_to_player_id(1)]", "def get_players(self):\n\n # Append the current player to the list and return it\n players_list = list(self._players.queue)\n players_list.appe...
[ "0.84512764", "0.7847707", "0.7833121", "0.7736268", "0.7659726", "0.76551896", "0.7576859", "0.75621367", "0.74152815", "0.7401695", "0.7394392", "0.7308477", "0.73007417", "0.7262631", "0.72595024", "0.7234624", "0.72236747", "0.72043324", "0.71869403", "0.71733487", "0.715...
0.8480106
0
Resets the player list
def resetPlayerList(self): self.playerList = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearList(self):\r\n self.players.clear()", "def reset(self):\n self.board_cards = []\n self.position = -1\n self._reset_players()", "def Reset(self): \r\n self.player_draws.clear()\r\n self.player_points.clear()\r\n self.num_players=0\r\n self.car...
[ "0.83051455", "0.7911027", "0.76908463", "0.7556388", "0.74714035", "0.7445043", "0.73784745", "0.7369854", "0.73216003", "0.71424335", "0.7129414", "0.7110906", "0.7039333", "0.7008726", "0.697688", "0.6962779", "0.69450843", "0.6891331", "0.6891331", "0.68692124", "0.683343...
0.9049031
0
Prints the player order in the order that they roll the dice during the game.
def printPlayerOrder(self): print("The order of players is ...") print() for i in range(len(self.playerList)): print("\t" + str(i+1) + ".", end = " ") print(self.playerList[i]) print()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_dice(self):\n\n stage_to_print = 3 if self.current_stage == 4 else self.current_stage\n print(\"You rolled:\\n a = [ {} ]\\n b = [ {} ]\\n\\nYou are in Stage {}\"\n .format(self.die_a, self.die_b, stage_to_print))", "def display_current_dice(self):\n print(\"You rolled:...
[ "0.7036044", "0.68171906", "0.64965594", "0.6425018", "0.62958133", "0.62821066", "0.62800306", "0.62373453", "0.6219937", "0.62110054", "0.61861604", "0.607185", "0.60702354", "0.6064018", "0.6057145", "0.6055642", "0.60338086", "0.59997267", "0.59900594", "0.59423006", "0.5...
0.81367517
0
Resets all values on the board to zero
def resetBoard(self): self.space1 = 0 self.space2 = 0 self.space3 = 0 self.space4 = 0 self.space5 = 0 self.space6 = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, board):", "def resetBoard(self):\n\t\tself.board = np.zeros((self.boardSize,self.boardSize))", "def resetBoard(self):\n\t\tself.board = np.zeros((self.boardSize,self.boardSize))", "def resetBoard(self):\n pass", "def reset_board(self):\n\n self.board = np.array(self.initial_bo...
[ "0.8115818", "0.7757122", "0.7757122", "0.7633754", "0.7617267", "0.75734997", "0.7470113", "0.74428475", "0.7372754", "0.73664916", "0.7353308", "0.732944", "0.73151636", "0.7290008", "0.7249329", "0.72266376", "0.7198487", "0.71958363", "0.7183818", "0.7174716", "0.7174449"...
0.7828157
1
Calculate the count of gram_list in candidate.
def calculate_candidate(gram_list, candidate): gram_sub_str = ' '.join(gram_list) return len(re.findall(gram_sub_str, candidate))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_candidate(gram_list, candidate):\n gram_sub_str = ' '.join(gram_list)\n return len(re.findall(gram_sub_str, candidate))", "def _count_ngram(ngram_input_list: Sequence[str], n_gram: int) ->Counter:\n ngram_counter: Counter = Counter()\n for i in range(1, n_gram + 1):\n for j in ra...
[ "0.7786504", "0.6955796", "0.6907873", "0.6830941", "0.6794327", "0.671934", "0.64967024", "0.6346814", "0.6268384", "0.62342256", "0.6189109", "0.6189109", "0.6109382", "0.5960297", "0.59168494", "0.588593", "0.5845502", "0.5845156", "0.5819503", "0.58000195", "0.57985204", ...
0.78204966
0
Calculate the count of gram_list in references
def calculate_reference(gram_list, references): gram_sub_str = ' '.join(gram_list) gram_count = [] for item in references: # calculate the count of the sub string gram_count.append(len(re.findall(gram_sub_str, item))) return gram_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_reference(gram_list, references):\n gram_sub_str = ' '.join(gram_list)\n gram_count = []\n for item in references:\n # calculate the count of the sub string\n gram_count.append(len(re.findall(gram_sub_str, item)))\n return gram_count", "def _calc_refs(counts):\n refs = ...
[ "0.8647627", "0.689659", "0.6763122", "0.6518512", "0.6485166", "0.6414057", "0.6387156", "0.6300615", "0.6289671", "0.6286565", "0.62701064", "0.6248385", "0.62226564", "0.6220881", "0.6185307", "0.6133009", "0.6123148", "0.61110526", "0.60962856", "0.6092867", "0.6092867", ...
0.86743796
0
Sets the bills of this PaymentTerm.
def bills(self, bills): self._bills = bills
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, bills=None, sales=None): # noqa: E501 # noqa: E501\n\n self._bills = None\n self._sales = None\n self.discriminator = None\n\n if bills is not None:\n self.bills = bills\n if sales is not None:\n self.sales = sales", "def bills():\n ...
[ "0.55518144", "0.5310862", "0.5198775", "0.5156278", "0.50817764", "0.5029538", "0.50045544", "0.5002613", "0.4951056", "0.49510494", "0.48997986", "0.47876436", "0.4785741", "0.47471455", "0.46833822", "0.4663396", "0.45678157", "0.45547917", "0.4549016", "0.45235193", "0.44...
0.8075642
0
Sets the sales of this PaymentTerm.
def sales(self, sales): self._sales = sales
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sales_rep(self, sales_rep):\r\n self._sales_rep = sales_rep", "def sells(self, sells):\n\n self._sells = sells", "def sales(self):\n\n # Scalar to range (consider creating function for this)\n if np.isscalar(self.demand_decr):\n self.demand_decr = np.full((1, self...
[ "0.6126827", "0.602496", "0.56689394", "0.5279737", "0.5215819", "0.5194685", "0.51591015", "0.4797136", "0.47962275", "0.47865313", "0.47671393", "0.4763767", "0.4688577", "0.46609876", "0.46363702", "0.46235058", "0.46217558", "0.46022666", "0.45736754", "0.45663998", "0.45...
0.8079007
0
Merge observations that have the same exposure times in place.
def merge_like_observations(self, overlap_handling="adjust Aeff", min_rate_ratio=0.5): def get_signal(): if 'r' in self: signal = self['r'] > 0 else: signal = _np.ones(len(self), bool) return signal signal = get_signal() # make...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_orders(self, overlap_handling=\"adjust Aeff\"):\n\n # split into separate photons objects for each observation, and split the orders within that observation into\n # faux separate observations, then merge them\n if len(self.obs_times) > 1:\n separate = [self.get_obs(i) for...
[ "0.5370777", "0.53692865", "0.531485", "0.5142003", "0.5070778", "0.5064868", "0.505093", "0.5038538", "0.50028855", "0.49981388", "0.49660435", "0.49648497", "0.4962812", "0.49279064", "0.49048823", "0.48895195", "0.4877224", "0.48613888", "0.48542717", "0.48448008", "0.4829...
0.5507637
0
Merge the orders in each observation in place.
def merge_orders(self, overlap_handling="adjust Aeff"): # split into separate photons objects for each observation, and split the orders within that observation into # faux separate observations, then merge them if len(self.obs_times) > 1: separate = [self.get_obs(i) for i in range(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders(self, orders):\n\n self._orders = orders", "def orders(self, orders):\n\n self._orders = orders", "def add_orders(self, response_data):\n orders = response_data[self.DATA][self.DATA]\n for order in orders:\n self.orders.append(self.process_order_data(order))", ...
[ "0.586836", "0.586836", "0.57435864", "0.55714554", "0.55012214", "0.5470867", "0.5441464", "0.5425784", "0.5357006", "0.5336386", "0.5326964", "0.52989537", "0.5288738", "0.52683765", "0.5259434", "0.5259434", "0.52486", "0.5215949", "0.5214064", "0.52139366", "0.52069664", ...
0.6861683
0
When adding, the photon recarrays will be added. The observation numbers will be adjusted or added as appropriate and times will be referenced to the first of the two objects.
def __add__(self, other): if not isinstance(other, Photons): raise ValueError('Can only add a Photons object to another Photons object.') # don't want to modify what is being added other = other.copy() # make column units consistent with self other.match_units(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__ ( self, other, resample_opts=None ):\n result = ObservationStorage (datadir=self.datadir, \\\n resample_opts=resample_opts )\n if self.date[0] > other.date[0]:\n start_date = other.date[0]\n else:\n start_date = self.date[0]\n if self.date[-1...
[ "0.61430186", "0.58678955", "0.5672647", "0.56705725", "0.56213546", "0.55732477", "0.55628985", "0.5520685", "0.551362", "0.54867333", "0.54829043", "0.5465281", "0.5434063", "0.54020816", "0.53678995", "0.53363043", "0.5323221", "0.53189373", "0.52950954", "0.5290331", "0.5...
0.657136
0
Modifies the Photons object inplace to have a new time datum. Default is to set to the time of the earliest photon.
def set_time_datum(self, new_datum=None): if new_datum is None: dt = _time.TimeDelta(self['t'].min(), format=self['t'].unit.to_string()) new_datum = self.time_datum + dt else: dt = new_datum - self.time_datum dt = dt.to(self['t'].unit).value # ensure ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_time(self):\n pass # Do nothing", "def setTimepoint(self, tp):\n\t\tpass", "def change_time(self, new_time):\r\n self.when = new_time", "def set_time(self, time):\n self._time = time", "def update_timestamp(self):\n self._timestamp = datetime.datetime.now()", "def ...
[ "0.6607164", "0.6334444", "0.6280729", "0.6252302", "0.62219167", "0.6194368", "0.61878926", "0.6179244", "0.61751014", "0.61751014", "0.61751014", "0.61751014", "0.61751014", "0.6143386", "0.61251175", "0.61251175", "0.6088479", "0.60619813", "0.59638584", "0.59400856", "0.5...
0.68505067
0
Converts the units of each column in self to the units of hte corresponding column in other, if mathcing columns are present.
def match_units(self, other): for key in self.photons.colnames: if key in other.photons.colnames: if other[key].unit: unit = other[key].unit if str(unit).lower() == 'none' and str(self[key].unit).lower() == 'none': conti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_units(self):\n for prod in (\"ier\", \"ier_inc_rain\"):\n self.data[prod].data[:] /= 1e6", "def unit_convert(df, coln1, coln2, unit, conversion_factor, coln3):\n df.loc[df[coln2] == unit, coln1] = conversion_factor * df[coln3]\n return df", "def table_standardise_units_inpla...
[ "0.6352647", "0.60670984", "0.60323286", "0.58100045", "0.57413846", "0.56471616", "0.564188", "0.5630694", "0.5610457", "0.5551951", "0.55241525", "0.5483095", "0.5481531", "0.5478554", "0.54472667", "0.5417077", "0.53583586", "0.5329351", "0.5301925", "0.5285195", "0.526069...
0.61165273
1
Compute the cumulative time of the observations. Returns
def total_time(self): obs_times = self.clean_obs_times() return _np.sum(obs_times[:, 1] - obs_times[:, 0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumulate(self):\n name = self.getName() + '_Cumulated'\n c_names = self.getColumnNames()\n # create the new table an add the first column to it\n t_cumulate = DataTable(name)\n time = self.getColumn(0)\n t_cumulate.addColumn(c_names[0],time)\n # for each other c...
[ "0.661021", "0.6383181", "0.6265506", "0.62239486", "0.62239486", "0.62239486", "0.6206423", "0.60860175", "0.6071931", "0.60464954", "0.5963435", "0.59059876", "0.589834", "0.58912027", "0.58884025", "0.58699846", "0.5856842", "0.58202827", "0.58170724", "0.58063585", "0.579...
0.7168127
0
Computes energy per effective area, applying weights (if available). No distinction is made between background and signal counts. Returns epera
def _compute_epera(self, units='erg'): if 'a' not in self: raise ValueError('Photons must have effective area data to permit the computation of fluxes.') energy = _const.h * _const.c / self['w'] energy = energy.to(units).value epera = energy / self['a'] return epera
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_energy(self):\n temp_e = 0\n\n for i in range(0,self.neuron_count):\n for j in range(0, self.neuron_count):\n if i != j:\n temp_e += self.get_weight(i, j) * self.current_state[i] * \\\n self.current_state[j]\n re...
[ "0.67550355", "0.65011144", "0.6412281", "0.63132465", "0.6304825", "0.6157981", "0.61240315", "0.60584134", "0.60072523", "0.60027325", "0.59518224", "0.59330714", "0.59209657", "0.59109896", "0.58882797", "0.5882908", "0.5837159", "0.58316195", "0.5821723", "0.5786851", "0....
0.69066924
0
integrate(wa, wb, gap_handling='error') integrate(ranges, gap_handling='error') Integrate a range or set of ranges in a spectrum.
def integrate(self, *args): wbin = Spectrum._groom_integration_ranges(*args) try: wbin.to(self.w.unit) except AttributeError as xxx_todo_changeme: _u.UnitConversionError = xxx_todo_changeme raise ValueError('Input must be astropy quantity with units ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrate(self, *args, **kws):\n gap_handling = kws.get('gap_handling', 'error')\n wbin = Spectrum._groom_integration_ranges(*args)\n\n # check for gap overlap\n # sometimes small numerical errors cause trouble, so compare to size\n # of pixels\n if self.any_gap_overal...
[ "0.7561628", "0.629409", "0.6022133", "0.5990441", "0.5945802", "0.589766", "0.5800456", "0.57025635", "0.5670215", "0.5635362", "0.5605366", "0.550595", "0.5474466", "0.54456025", "0.54328984", "0.5427082", "0.53748286", "0.53633803", "0.53340495", "0.5246296", "0.5215325", ...
0.7197214
1
Reads in a spectrum from the BTSETTL models from
def read_bt_settl(cls, path, DF=-8): w, f = [], [] with open(path) as file: for line in file: pieces = line.split() _w, logf = pieces[:2] _w = float(_w) logf = logf.replace('D', 'E') _f = 10**(float(logf) + DF) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectrum(self):\r\n f, spectrum = tsa.get_spectra(self.input.data, method=self.method)\r\n return spectrum", "def model_spectrum(infile, txt=False, dataframe=False, alpha=None, temp=None,\n wmin=40., wmax=300., df_index=0):\n if txt:\n power_law = False\n blac...
[ "0.62477744", "0.5998323", "0.58866525", "0.588349", "0.57493764", "0.5725306", "0.56513405", "0.56495297", "0.56003684", "0.5593395", "0.5588688", "0.55714035", "0.5541813", "0.55410665", "0.54591894", "0.54219526", "0.54188335", "0.54152894", "0.5404291", "0.53843737", "0.5...
0.6723388
0
integrate(wa, wb, gap_handling='error') integrate(ranges, gap_handling='error') Integrate a range or set of ranges in a spectrum.
def integrate(self, *args, **kws): gap_handling = kws.get('gap_handling', 'error') wbin = Spectrum._groom_integration_ranges(*args) # check for gap overlap # sometimes small numerical errors cause trouble, so compare to size # of pixels if self.any_gap_overalp(wbin): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrate(self, *args):\n wbin = Spectrum._groom_integration_ranges(*args)\n try:\n wbin.to(self.w.unit)\n except AttributeError as xxx_todo_changeme:\n _u.UnitConversionError = xxx_todo_changeme\n raise ValueError('Input must be astropy quantity with units...
[ "0.7198446", "0.62951845", "0.60250896", "0.5992881", "0.5947427", "0.58993167", "0.58005035", "0.57049096", "0.56705976", "0.56361306", "0.56049377", "0.5507031", "0.54753643", "0.5445079", "0.5433137", "0.5429304", "0.53761375", "0.5365952", "0.533674", "0.5247461", "0.5218...
0.7562714
0
Set the passphrase used in TKIP and AES, and generate the PMK.
def setPassphrase( self , passphrase ): self.passphrase = passphrase # Generate and log the generated PMK. self.PMK = pbkdf2_bin( self.passphrase , self.ssid , 4096 , 32 ) self.logger.logKey( 'Pairwise Master Key' , self.PMK )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _derive_key(\n self, passphrase: str, otp: YubikeyOTP, *args : bytes\n ) -> bytes:\n return self._context_kdf.derive(\n combine_keys(\n passphrase.encode('utf-8'),\n otp.token.private_uid,\n *args\n )\n ...
[ "0.635851", "0.6265482", "0.60787463", "0.60269797", "0.59361345", "0.59193933", "0.5915363", "0.5894473", "0.5868643", "0.5863321", "0.5812229", "0.5701552", "0.5696947", "0.5637236", "0.56315845", "0.562272", "0.5610249", "0.5602456", "0.5577322", "0.5542072", "0.5514838", ...
0.7733064
0
Set the cryptographic handlers for encapsulation and decapsulation.
def setCryptographicHandlers( self , tkip = None , aes = None ): self.handleTKIP = tkip self.handleAES = aes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addHandlers(self, handlers):\n self._eventHandlers.update(handlers)\n keys = self._eventHandlers.keys()\n pygame.event.set_allowed(keys)", "def set_jwt_handlers(jwt):\n\n @jwt.authentication_handler\n def authenticate(username, password):\n pass\n\n @jwt.jwt_error_handler...
[ "0.5776411", "0.5599662", "0.5444123", "0.54365975", "0.53574115", "0.5248126", "0.521632", "0.51826847", "0.51620126", "0.5043949", "0.50299275", "0.5027302", "0.49723986", "0.49723986", "0.49191386", "0.49123454", "0.48952657", "0.48635775", "0.48069152", "0.48056138", "0.4...
0.6715883
0
Assert that the EAPoL WPA Key layer has a valid MIC.
def __assertWPAKeyMIC( self , packet , digest ): # Get the Key Information and assert that the MIC bit was set. keyinfo = packet.getlayer( EAPOL_WPAKey ).KeyInfo flaglist = self.__getFlaglist( keyinfo ) assert( 'mic' in flaglist ), \ 'The MIC flag in the EAPoL WPA Key layer was not set.' # Save the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkMIC(self, key):\n\n # Calculate the MIC for this message using key\n msg = self.mhdr.encode() + self.payload.encode()\n B0 = struct.pack('<BLBLLBB',\n int('0x49', 16), 0, 0, self.payload.fhdr.devaddr,\n self.payload.fhdr.fcnt, 0, len(msg...
[ "0.70442915", "0.6647134", "0.5537131", "0.54686534", "0.5328444", "0.5293856", "0.52469015", "0.5200082", "0.5188678", "0.51047045", "0.5049053", "0.49658602", "0.49283254", "0.4926165", "0.49239734", "0.48833504", "0.48811823", "0.48766124", "0.4874867", "0.48511982", "0.48...
0.77989507
0
Generates the integer for the Key Information field. Note that not all the bits defined in the specification are supported here. Ref. IEEE 802.11i specification; EAPOLKey frames.
def __getKeyInformation( self , flaglist ): keyinfo = 0 if 'HMAC_MD5_RC4' in flaglist: keyinfo = setBit( keyinfo , 0 ) if 'HMAC_SHA1_AES' in flaglist: keyinfo = setBit( keyinfo , 1 ) if 'group' in flaglist: pass if 'pairwise' in flaglist: keyinfo = setBit( keyinfo , 3 ) if 'idx0' in flaglist: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_bits(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"key_bits\")", "def calc_keyid(flags, protocol, algorithm, st):\n # Remove spaces and create the wire format\n st0=st.replace(' ', '')\n st2=struct.pack('!HBB', int(flags), int(protocol), int(algorithm))\n st2+=base64.b64de...
[ "0.6220905", "0.6191316", "0.6121069", "0.60238856", "0.60238856", "0.6003645", "0.5966623", "0.5899271", "0.58622986", "0.5769623", "0.5755905", "0.5741465", "0.5740746", "0.57384217", "0.56625897", "0.56585544", "0.5632151", "0.5576915", "0.55752677", "0.5569453", "0.556275...
0.6726099
0
Generates the flaglist from the Key Information field. Note that not all the bits defined in the specification are supported here. Ref. IEEE 802.11i specification; EAPOLKey frames.
def __getFlaglist( self , keyinfo ): flaglist = [] if( getBit( keyinfo , 0 ) == 1 ): flaglist.append( 'HMAC_MD5_RC4' ) if( getBit( keyinfo , 1 ) == 1 ): flaglist.append( 'HMAC_SHA1_AES' ) if( getBit( keyinfo , 3 ) == 0 ): flaglist.append( 'group' ) if( getBit( keyinfo , 3 ) == 1 ): flaglist.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getKeyInformation( self , flaglist ):\n\t\tkeyinfo = 0\n\t\tif 'HMAC_MD5_RC4' in flaglist:\n\t\t\tkeyinfo = setBit( keyinfo , 0 )\n\t\tif 'HMAC_SHA1_AES' in flaglist:\n\t\t\tkeyinfo = setBit( keyinfo , 1 )\n\t\tif 'group' in flaglist:\n\t\t\tpass\n\t\tif 'pairwise' in flaglist:\n\t\t\tkeyinfo = setBit( keyin...
[ "0.6743408", "0.5599987", "0.54831153", "0.54222727", "0.5411979", "0.530009", "0.52766114", "0.5181283", "0.51444834", "0.5068981", "0.50592893", "0.5043546", "0.50303626", "0.5005824", "0.49645144", "0.49421084", "0.49409097", "0.49077618", "0.48360735", "0.4824332", "0.478...
0.78312045
0
Set the key ID from the flaglist.
def __setKeyIDFromFlaglist( self , flaglist ): if 'idx0' in flaglist: self.keyID = 'idx0' if 'idx1' in flaglist: self.keyID = 'idx1' if 'idx2' in flaglist: self.keyID = 'idx2'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_key_id(self, key_id=''):\n self.key_id = key_id", "def key_id(self, key_id):\n\n self._key_id = key_id", "def get_key_id(self):", "def __init__(self, key):\n self.key = [int_mapping(k) for k in key]", "def _set_id(self, value):\n pass", "def set_key(self, key):\n\t\tif...
[ "0.6454805", "0.59250164", "0.5873637", "0.58335394", "0.5757778", "0.5733422", "0.56739056", "0.5673275", "0.5654884", "0.5590533", "0.5590533", "0.55903417", "0.55585337", "0.5539609", "0.5518129", "0.5518129", "0.5518129", "0.5518129", "0.5505997", "0.54609674", "0.5459089...
0.85215884
0
4Way Handshake 2/4 (TKIP).
def fw_handshake_2_4_tkip( self , vendor , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , customRC = None ): parameterList = 'vendor=' + str(vendor) + ',eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',customRC=' + str(customRC) self.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw_handshake_4_4_tkip( self , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ):\n\t\tparameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',addNonce=' + str(addNonce) +...
[ "0.6646956", "0.64540124", "0.6431143", "0.6407858", "0.6301635", "0.6258781", "0.58257896", "0.57159686", "0.5581246", "0.5543797", "0.5446876", "0.5438237", "0.5398689", "0.52769226", "0.52320427", "0.51876277", "0.504449", "0.4999626", "0.4977589", "0.49746817", "0.4970787...
0.68462443
0
4Way Handshake 3/4 (TKIP).
def fw_handshake_3_4_tkip( self , packet ): # Check if the Frame Check Sequence (FCS) flag is set in the Radiotap header, and # if so assert the correctness of the FCS. radiotapFCSFlag = hasFCS( packet ) if radiotapFCSFlag is True: assertDot11FCS( packet ) packet.getlayer( EAPOL_WPAKey ).remove_payload() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw_handshake_4_4_tkip( self , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ):\n\t\tparameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',addNonce=' + str(addNonce) +...
[ "0.67468935", "0.6737194", "0.6664823", "0.635603", "0.6308225", "0.62145877", "0.56858593", "0.54955584", "0.54889023", "0.5332052", "0.5225432", "0.50472337", "0.50272524", "0.50106573", "0.5003098", "0.50025594", "0.49503523", "0.49494582", "0.49482146", "0.48204303", "0.4...
0.6929152
0
4Way Handshake 3/4 (WPA).
def fw_handshake_3_4_aes( self , packet ): # Check if the Frame Check Sequence (FCS) flag is set in the Radiotap header, and # if so assert the correctness of the FCS. radiotapFCSFlag = hasFCS( packet ) if radiotapFCSFlag is True: assertDot11FCS( packet ) packet.getlayer( EAPOL_WPAKey ).remove_payload() #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw_handshake_3_4_tkip( self , packet ):\n\t\t# Check if the Frame Check Sequence (FCS) flag is set in the Radiotap header, and\n\t\t# if so assert the correctness of the FCS.\n\t\tradiotapFCSFlag = hasFCS( packet )\n\t\tif radiotapFCSFlag is True:\n\t\t\tassertDot11FCS( packet )\n\t\t\tpacket.getlayer( EAPOL_W...
[ "0.7503889", "0.71692896", "0.7107094", "0.6600701", "0.6530017", "0.5932827", "0.5868875", "0.56008786", "0.5591584", "0.5503641", "0.5416842", "0.53957826", "0.53105396", "0.5301601", "0.52631265", "0.52446353", "0.5230233", "0.51974016", "0.51889485", "0.51476973", "0.5143...
0.7285889
1
4Way Handshake 4/4 (TKIP).
def fw_handshake_4_4_tkip( self , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ): parameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',addNonce=' + str(addNonce) + ',custo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handshake4(self, r, w):\n s4r = socks4_recv_request(r)\n if s4r['version'] != 4:\n logger.warning(\"SOCKS4 rejecting invalid version %r\", s4r[\"version\"])\n return\n if s4r['cmd'] != CMD_CONNECT:\n logger.warning(\"SOCKS4 rejecting unsupported command %r\...
[ "0.6700548", "0.66541535", "0.66516834", "0.65175414", "0.6437206", "0.6193248", "0.5628278", "0.54505783", "0.5313436", "0.5230357", "0.5210843", "0.5048025", "0.49701482", "0.48996294", "0.4860243", "0.4858004", "0.48476747", "0.4838114", "0.48340616", "0.48327902", "0.4826...
0.6844773
0
Group Key Handshake 1/2 (TKIP).
def gk_handshake_1_2_tkip( self , packet ): try: # Decapsulate the TKIP packet, and rebuild the plaintext packet. plaintext = self.handleTKIP.decapsulate( packet , self.TK , self.MMICTxK ) packet = LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey() new_packet = packet.__class__( plaintext ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gk_handshake_1_2_aes( self , packet ):\n\t\ttry:\n\n\t\t\t# Decapsulate the TKIP packet, and rebuild the plaintext packet.\n\t\t\tplaintext\t= self.handleAES.decapsulate( packet , self.TK )\n\t\t\tpacket \t\t= LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey()\n\t\t\tnew_packet \t= packet.__class__( plaintext )\n...
[ "0.6993158", "0.6710398", "0.61452496", "0.5839547", "0.55907094", "0.55886805", "0.5588011", "0.5540909", "0.54761565", "0.54022527", "0.5274508", "0.5211209", "0.52015334", "0.5186773", "0.5183748", "0.51658136", "0.51587534", "0.5151239", "0.51409864", "0.51297235", "0.509...
0.73095936
0
Group Key Handshake 1/2 (WPA). The packet is decrypted with AES under the CTR with CBCMAC Protocol (CCMP). CCM combines CTR for data confidentiality and CBCMAC for authentication and integrity.
def gk_handshake_1_2_aes( self , packet ): try: # Decapsulate the TKIP packet, and rebuild the plaintext packet. plaintext = self.handleAES.decapsulate( packet , self.TK ) packet = LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey() new_packet = packet.__class__( plaintext ) # Assert on the flags i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gk_handshake_1_2_tkip( self , packet ):\n\t\ttry:\n\t\t\t\n\t\t\t# Decapsulate the TKIP packet, and rebuild the plaintext packet.\n\t\t\tplaintext \t\t= self.handleTKIP.decapsulate( packet , self.TK , self.MMICTxK )\n\t\t\tpacket \t\t\t= LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey()\n\t\t\tnew_packet \t\t= p...
[ "0.7056146", "0.6873941", "0.65584064", "0.61416614", "0.608635", "0.59748024", "0.57996607", "0.5774626", "0.57702816", "0.5761186", "0.5711205", "0.56224453", "0.5621123", "0.5591313", "0.5571625", "0.55693746", "0.5557239", "0.55543816", "0.552348", "0.54867536", "0.545564...
0.75585914
0
Calculating weighted entropy of the children nodes.
def entropy_children(self): assert self.true assert self.false my_size = float(self.size()) return (self.true.size() / my_size) * self.true.entropy_root() + (self.false.size() / my_size) * self.false.entropy_root()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children_impurity(self):\n\n\t\tentropy_left = 0.0\n\t\tentropy_right = 0.0\n\n\t\tfor c in range(self.n_classes):\n\t\t\ttmp = self.label_count_left[c]\n\t\t\tif tmp > 0.0:\n\t\t\t\ttmp /= self.weighted_n_left\n\t\t\t\tentropy_left -= tmp * log(tmp)\n\n\t\t\ttmp = self.label_count_right[c]\n\t\t\tif tmp > 0.0...
[ "0.72342324", "0.65909487", "0.6433547", "0.63930863", "0.62466687", "0.62310815", "0.6181685", "0.6172098", "0.6165551", "0.6143705", "0.60962546", "0.6086807", "0.608194", "0.6074888", "0.6074888", "0.60482925", "0.60432416", "0.6004288", "0.5999693", "0.59879094", "0.59718...
0.74124616
0
Infers whether the target is in indices format or one_hot format.
def infer_target_type(input: torch.Tensor, targets: torch.Tensor) -> str: if input.shape == targets.shape: return 'one_hot' elif input.ndim == targets.ndim + 1: return 'indices' else: raise RuntimeError(f'Unable to infer indices or one_hot. Targets has shape {targets.shape}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_targets_one_hot(input: torch.Tensor,\n targets: torch.Tensor,\n num_classes: Optional[int] = None) -> torch.Tensor:\n if infer_target_type(input, targets) == 'indices':\n # If the number of classes isn't specified, attempt to infer it from th...
[ "0.6951809", "0.68581086", "0.6681324", "0.66152394", "0.66152394", "0.66152394", "0.66152394", "0.6578733", "0.6549587", "0.65139776", "0.63884944", "0.63483554", "0.63066226", "0.6301925", "0.6278177", "0.6259506", "0.6223372", "0.61686593", "0.61447483", "0.61230075", "0.6...
0.7429881
0
r"""Ensures that the targets are in a onehot format rather than an index format.
def ensure_targets_one_hot(input: torch.Tensor, targets: torch.Tensor, num_classes: Optional[int] = None) -> torch.Tensor: if infer_target_type(input, targets) == 'indices': # If the number of classes isn't specified, attempt to infer it from the input ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_one_hot(targets, num_classes):\n ret = np.zeros((num_classes, targets.shape[0]))\n ret[targets, np.arange(targets.size)] = 1\n return ret", "def infer_target_type(input: torch.Tensor, targets: torch.Tensor) -> str:\n if input.shape == targets.shape:\n return 'one_hot'\n ...
[ "0.70892847", "0.70067805", "0.6761015", "0.6672298", "0.652522", "0.64999425", "0.6430373", "0.62493813", "0.62427723", "0.6210333", "0.6210333", "0.6210333", "0.6210333", "0.616038", "0.6130909", "0.609137", "0.6088862", "0.60704434", "0.6039818", "0.60286826", "0.6021816",...
0.75631934
0
Checks if a given set of targets are indices by looking at the type.
def check_for_index_targets(targets: torch.Tensor) -> bool: index_dtypes = [torch.uint8, torch.int8, torch.int16, torch.int32, torch.int64] return targets.dtype in index_dtypes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _idxs_are_present(self, *args):\n return set(args).issubset(set(range(self.n_atoms)))", "def test_where_targets():\n num_multi_targets = 0\n for where_targets_day in where_targets:\n # All inputs have a label\n assert np.all(where_targets_day.sum(axis=3).sum(axis=3).sum(axis=1).sum...
[ "0.60485214", "0.5889833", "0.5874883", "0.5825459", "0.5714331", "0.5704013", "0.56712264", "0.5618384", "0.55533653", "0.5513131", "0.5502767", "0.54754364", "0.54153454", "0.53931", "0.5359128", "0.53402877", "0.5328796", "0.5318108", "0.53159976", "0.52739215", "0.5260177...
0.8416542
0
Convert a job string (dba, svg, dxf, or gcode).
def convert(job, optimize=True, tolerance=conf['tolerance'], matrix=None): type_ = get_type(job) if type_ == 'dba': if type(job) is bytes: job = job.decode('utf-8') if type(job) is str: job = json.loads(job) if optimize: if 'defs' in job: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(job):\n # figure out type\n if type(job) is dict:\n type_ = 'dba'\n elif type(job) in [str, bytes]:\n if type(job) is bytes:\n job = job.decode('utf-8')\n jobheader = job[:1024].lstrip()\n if jobheader and jobheader[0] == '{':\n type_ = 'dba'\...
[ "0.584424", "0.5817721", "0.577906", "0.56308305", "0.53230834", "0.52930534", "0.51798236", "0.5088676", "0.5066885", "0.5064404", "0.5053654", "0.50107867", "0.49824375", "0.49557483", "0.49440598", "0.49340597", "0.48770815", "0.48703986", "0.48525834", "0.48219013", "0.48...
0.62155473
0
Read a svg file string and convert to dba job.
def read_svg(svg_string, workspace, tolerance, forced_dpi=None, optimize=True): svgReader = SVGReader(tolerance, workspace) res = svgReader.parse(svg_string, forced_dpi) # {'boundarys':b, 'dpi':d, 'lasertags':l, 'rasters':r} # create an dba job from res # TODO: reader should generate an dba job to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(filename, imageprops):\n with gzip.open(filename, 'rb') as f:\n file_content = f.read()\n return parse_svg.parse_svg_string(file_content, imageprops, \"en\")", "def convert(filename,\nRenderer: \"\"\"By default, the schematic is converted to an SVG file,\n written to the standard out...
[ "0.583088", "0.5518693", "0.52893054", "0.5273715", "0.521292", "0.5151042", "0.50893706", "0.5085327", "0.5066948", "0.5044671", "0.50433487", "0.4998983", "0.49872452", "0.4840981", "0.48366708", "0.47892964", "0.47813255", "0.4772477", "0.47670302", "0.47522056", "0.474910...
0.65959406
0
Read a dxf file string and optimize returned value.
def read_dxf(dxf_string, tolerance, optimize=True): dxfParser = DXFParser(tolerance) # second argument is the forced unit, TBI in Driverboard job = dxfParser.parse(dxf_string, None) if 'vector' in job: if optimize: vec = job['vector'] pathoptimizer.dxf_optimize(vec['paths...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readstring(self, fstring):\n return self.parse(fstring)", "def readfile(filename, encoding=None, legacy_mode=False):\n if not is_dxf_file(filename):\n raise IOError(\"File '{}' is not a DXF file.\".format(filename))\n\n info = dxf_file_info(filename)\n with io.open(filename, mode='rt',...
[ "0.6891667", "0.61871874", "0.61306417", "0.6099318", "0.6006468", "0.59101367", "0.5892573", "0.58453", "0.57657695", "0.57569593", "0.57072806", "0.56301016", "0.5602342", "0.5579656", "0.55789405", "0.557593", "0.55731946", "0.5565903", "0.5554117", "0.55455285", "0.554523...
0.67127746
1
Read a gcode file string and convert to dba job.
def read_gcode(gcode_string, tolerance, optimize=False): reader = GcodeReader() job = reader.parse(gcode_string) if optimize: pass return job
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_gcode(filename):\n\t##TODO: parse/read file line by line for memory considerations\n\twith open(filename, 'r') as fh_in:\n\t\tgcode_raw = fh_in.readlines()\n\t\tgcode_raw = [gcode.rstrip(';\\n') for gcode in gcode_raw] # stripping off trailing semicolon and newlines\n\treturn gcode_raw", "def read_code(...
[ "0.605922", "0.56325203", "0.5597015", "0.55194545", "0.5511298", "0.5441651", "0.53879595", "0.536156", "0.5337163", "0.52230054", "0.51988596", "0.5162434", "0.51498", "0.51092756", "0.5086217", "0.5081328", "0.50811666", "0.5080986", "0.50737935", "0.50295", "0.501998", ...
0.6651488
0
Figure out file type from job string.
def get_type(job): # figure out type if type(job) is dict: type_ = 'dba' elif type(job) in [str, bytes]: if type(job) is bytes: job = job.decode('utf-8') jobheader = job[:1024].lstrip() if jobheader and jobheader[0] == '{': type_ = 'dba' elif '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_type(file_str):\n process_list = [\"file\", \"--mime-type\", file_str]\n p = subprocess.Popen(process_list, stdout=subprocess.PIPE)\n file_type, err = p.communicate()\n\n return file_type.decode(\"utf-8\")", "def find_file_type(file_str):\n try:\n #p = subprocess.Popen(\n ...
[ "0.70865875", "0.6961908", "0.6805858", "0.66984457", "0.66983753", "0.66839826", "0.65622485", "0.6553481", "0.6537292", "0.65352625", "0.6480396", "0.6473575", "0.6473575", "0.6421381", "0.6342401", "0.631688", "0.63012516", "0.62735415", "0.6210128", "0.6163858", "0.615030...
0.77883315
0
Return nodes in tree with value of term
def find_matches(term, tree): if not isinstance(tree, KTree): raise TypeError('argument must be of type <KTree>') matches = [] tree.pre_order(lambda n: matches.append(n) if n.val == term else False) return matches
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_by_term(nodes, term):\n return nodes[sum([ord(c) for c in term]) % len(nodes)]", "def visit_term(self, node, children):\n if self.debug:\n print(\"Term {}\".format(children))\n term = children[0]\n for i in range(2, len(children), 2):\n if children[i-1] ...
[ "0.6986421", "0.61513734", "0.5921448", "0.58736944", "0.5862751", "0.5831741", "0.58146954", "0.56619805", "0.56611484", "0.5639314", "0.55790526", "0.5555535", "0.5530433", "0.5506146", "0.54981244", "0.54642147", "0.546144", "0.5453978", "0.5403352", "0.540323", "0.5325055...
0.61939466
1
Initialize OpanXYZ geometry object from OpenBabel file Import of an arbitrary number of multiple geometries from an OpenBabel file. All geometries must have the same number and type of atoms, and the ordering of atom types must be retained throughout.
def _load_file(self, XYZ_path, bohrs=False): # Imports import numpy as np from .const import CIC, PHYS, atom_num, atom_sym from .error import XYZError from .utils import safe_cast as scast # Complain if already initialized if 'geoms' in dir(self): ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n line: List[str],\n args: Namespace = None,\n features: np.ndarray = None,\n use_compound_names: bool = False):\n if args is not None:\n self.features_generator = args.features_generator\n self.args = a...
[ "0.56026757", "0.5540906", "0.5528329", "0.5364663", "0.53284216", "0.53252584", "0.5266082", "0.52634025", "0.52541685", "0.5250091", "0.5241198", "0.514692", "0.5138467", "0.51343966", "0.51267344", "0.5109389", "0.5102671", "0.5095474", "0.50853413", "0.506901", "0.5065143...
0.5555224
1
Iterator over a subset of geometries. The indices of the geometries to be returned are indicated by an iterable of |int|\\ s passed as `g_nums`.
def geom_iter(self, g_nums): # Using the custom coded pack_tups to not have to care whether the # input is iterable from .utils import pack_tups vals = pack_tups(g_nums) for val in vals: yield self.geom_single(val[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_iterator((x_min, x_max, y_min, y_max)):\n for row in xrange(y_min, y_max):\n for col in xrange(x_min, x_max):\n yield (row, col)", "def _iterCoordsets(self):\n\n for i in range(self._n_csets):\n yield self._coords[i]", "def vertex_iterator(self):\n for X ...
[ "0.5779938", "0.57045865", "0.56929266", "0.55291986", "0.5527328", "0.5402063", "0.53830856", "0.53448653", "0.52876896", "0.52826023", "0.52761483", "0.5234629", "0.5232288", "0.52209127", "0.51792836", "0.51745635", "0.51471794", "0.5135813", "0.51231736", "0.5116178", "0....
0.7158514
0
Spanning angle among three atoms. The indices `at_1` and `at_3` can be the same (yielding a trivial zero angle), but `at_2` must be different from both `at_1` and `at_3`.
def angle_single(self, g_num, at_1, at_2, at_3): # Imports import numpy as np from .utils import safe_cast as scast from .utils.vector import vec_angle # The below errors are explicitly thrown since they are multiplied by # three when they are used as an index and thus...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle( nt1, nt2, nt3 ):\n if vector(nt1, nt2) == [0,0]:\n print(\"nt1\", nt1.seqpos, \" at \", nt1.x, nt1.y, \" is at the same position as nt2\", nt2.seqpos)\n if vector(nt2, nt3) == [0,0]:\n print(\"nt2\", nt2.seqpos, \" at \", nt2.x, nt2.y, \" is at the same position as nt3\", nt3.seqpos)...
[ "0.6621639", "0.62787753", "0.62721163", "0.6219383", "0.616731", "0.61254215", "0.61223984", "0.60984504", "0.6068697", "0.60079587", "0.5870599", "0.5851276", "0.5847751", "0.5736352", "0.5641874", "0.5633563", "0.5566232", "0.5555014", "0.5548194", "0.55439526", "0.5532424...
0.7929128
0
Dihedral/outofplane angle among four atoms. Returns the outofplane angle among four atoms from geometry `g_num`, in degrees. The reference plane is spanned by `at_1`, `at_2` and `at_3`. The outofplane angle is defined such that a positive angle represents a counterclockwise
def dihed_single(self, g_num, at_1, at_2, at_3, at_4): # library imports import numpy as np from scipy import linalg as spla from .utils.vector import ortho_basis, rej, vec_angle from .utils import safe_cast as scast from .error import XYZError from .const import ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_single(self, g_num, at_1, at_2, at_3):\n\n # Imports\n import numpy as np\n from .utils import safe_cast as scast\n from .utils.vector import vec_angle\n\n # The below errors are explicitly thrown since they are multiplied by\n # three when they are used as an i...
[ "0.62320507", "0.5513286", "0.5477218", "0.5460022", "0.5291179", "0.5227382", "0.5224077", "0.5219758", "0.5208271", "0.51954705", "0.51799554", "0.5173653", "0.51502854", "0.5115369", "0.51109487", "0.5099053", "0.50951463", "0.5083831", "0.505489", "0.5045638", "0.50434184...
0.60114694
1
Displacement vector between two atoms. Returns the displacement vector pointing from `at_1` toward `at_2` from geometry `g_num`. If `at_1` == `at_2` a strict zero vector is returned. Displacement vector is returned in units of Bohrs.
def displ_single(self, g_num, at_1, at_2): # Library imports import numpy as np from .utils import safe_cast as scast # The below errors are explicitly thrown since they are multiplied by # three when they are used as an index and thus give non-intuitive # errors. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist_single(self, g_num, at_1, at_2):\n\n # Import used math library function(s)\n import numpy as np\n from scipy import linalg as spla\n from .utils import safe_cast as scast\n\n # The below errors are explicitly thrown since values are multiplied by\n # three when ...
[ "0.6828026", "0.63209164", "0.62243074", "0.5588467", "0.54166085", "0.54103637", "0.53110236", "0.53094816", "0.52225846", "0.5219", "0.52034783", "0.5185372", "0.51553935", "0.5150667", "0.51422375", "0.511167", "0.50929797", "0.50642675", "0.5045502", "0.5032917", "0.50302...
0.73728895
0
Helper function to insert full ranges for |None| for X_iter methods. Custom method, specifically tailored, taking in the arguments from an X_iter method and performing the replacement of |None| after errorchecking the arguments for a max of one |None| value, and ensuring that if a |None| is present, no other non|str| i...
def _none_subst(self, *args): # Imports import numpy as np # Initialize argument list return value, and as None not found arglist = [a for a in args] none_found = False # Check for None values none_vals = list(map(lambda e: isinstance(e, type(None)), arglist)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __dynamic_range_process(info):\n if 'range' in info:\n for i in range(len(info['range'])):\n if info['range'][i][1] == -1:\n info['range'][i][1] = None\n return info", "def restrict_once(self):\n l = list(self)\n for i, arg in enumerate(self.sig):\n ...
[ "0.6032078", "0.5548745", "0.54662424", "0.5449462", "0.5438166", "0.5367288", "0.5254939", "0.5251298", "0.52095854", "0.5154835", "0.51438975", "0.5128024", "0.5127296", "0.50919783", "0.50894165", "0.5048798", "0.50049394", "0.49737692", "0.4965266", "0.49602643", "0.49274...
0.6425502
0
Wrapper for exception/|None| output handling of X_iter methods. Attempts to pass `tup` as arguments to `fxn`. If the call is successful, returns the value produced. If
def _iter_return(tup, fxn, invalid_error): try: val = fxn(*tup) except (IndexError, ValueError): if invalid_error: # Raise the exception if invalid_error indicates raise else: # Otherwise, just return a 'None' value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_func_tuple(f_args):\n return f_args[0](*f_args[1:])", "def wrapit(fn):\n def inside(dummy, *args):\n try:\n return fn(*args)\n except Exception as e:\n print(\"Error in XSLT extension: %s\" % e)\n raise\n return inside", "def __call__ ( self , *x...
[ "0.54071575", "0.506021", "0.50338674", "0.5007572", "0.4873577", "0.48561063", "0.48419422", "0.48373547", "0.4821068", "0.48024175", "0.47795138", "0.47174263", "0.47157645", "0.4645071", "0.46301335", "0.45946258", "0.4569231", "0.4554146", "0.45464298", "0.45464298", "0.4...
0.7071328
0
Compares speed of functions across input conditions. 'funcs' should be a list of functions expressed as strings. String substitution is done on each function while iterating over ranges of values in 'inputs' to compare speed. 'inputs' should be an iterable range of values over which 'funcs' should be tested. 'setups' c...
def timeit_compare(funcs, inputs, setups='pass', **kwargs): number = kwargs.get('number', 100000) print_conditions = kwargs.get('print_conditions', False) performance = defaultdict(list) if isinstance(setups, list): # user specifies their own list of setups corresponding to funcs pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_timings_perinput(funcs, input_=None):\n\n global _TIMEOUT\n global _NUM_REPEATS\n\n timings_l = []\n\n from IPython import get_ipython\n if get_ipython() is None:\n iter_funcs = trange(len(funcs), desc='Loop functions', leave=False)\n else:\n iter_funcs = range(len(funcs))\...
[ "0.6532997", "0.6067574", "0.5981965", "0.58139783", "0.5802524", "0.5739622", "0.5668803", "0.56225157", "0.54053986", "0.5306131", "0.5264208", "0.52628356", "0.5256946", "0.5210447", "0.51905584", "0.5185012", "0.5178295", "0.51312095", "0.51214105", "0.51147574", "0.51056...
0.8455328
0
Converts conditions for individual variables into an exhaustive list of combinations for timeit_compare().
def get_conditions(inputs): # itertools.product summarizes all combinations of ordered conditions # at len = 1 it wraps values in tuples (0,) that confuse the timer below if hasattr(inputs[0], '__iter__'): return list(product(*inputs)) else: return [[n] if not isinstance(n,(list,tuple)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_different(variables) :\n constraints = []\n for i in xrange(len(variables)):\n var1 = variables[i]\n for j in xrange(i+1,len(variables)):\n var2 = variables[j]\n if var1!=var2:\n constraints.append(Constraint(var1,var2,constraint_different))\n ret...
[ "0.6311022", "0.61849254", "0.60068643", "0.58457434", "0.5723604", "0.5540094", "0.5520736", "0.54754466", "0.5429853", "0.54289407", "0.5408784", "0.5364044", "0.53570276", "0.53367054", "0.5330969", "0.5319483", "0.53005606", "0.5298023", "0.52649146", "0.5194227", "0.5183...
0.683482
0
3D plot of timeit data, one chart per function.
def timeit_plot3D(data, xlabel='xlabel', ylabel='ylabel', **kwargs): dataT = {} figs = [] series = kwargs.get('series', (0,1)) cmap = kwargs.get('cmap', cm.coolwarm) for k, v in data.items(): dataT[k] = zip(*v) fig = plt.figure() ax = fig.gca(projection='3d') X, Y, Z ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_results_traj_3d(p_x, p_y, p_z, xmin, xmax, ymin, ymax, zmin, zmax):\n fig, ax = plt.subplots(2 , 2, figsize = (10, 10))\n \n for p in np.arange(0, p_x.shape[0], step = 1): \n for t in np.arange(0, p_x.shape[1], step = 1): \n ax[0,0].plot(t, p_x[p, t], 'rx') \n ax[0...
[ "0.6823655", "0.64680564", "0.6386386", "0.63781416", "0.6293766", "0.6287212", "0.62837124", "0.61736697", "0.61295396", "0.6103058", "0.60559446", "0.602441", "0.6017617", "0.5986467", "0.59750056", "0.5937993", "0.5929257", "0.5915024", "0.5913098", "0.58936155", "0.589318...
0.70203567
0
Heatmap plot of timeit data, one chart per function.
def timeit_heatmap(data, xlabel='xlabel', ylabel='ylabel', **kwargs): dataT = {} figs = [] series = kwargs.get('series', (0,1)) cmap = kwargs.get('cmap', cm.coolwarm) for k, v in data.items(): dataT[k] = zip(*v) X, Y, Z = dataT[k][series[0]], dataT[k][series[1]], dataT[k][-1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matplotlib_heatmap_chart() -> Tuple:\n df = read_dataset(Path('..', '..', 'iris.csv'))\n df.drop(\"species\", axis=1, inplace=True)\n # Default is pearson's correlation coefficient\n corr_df = df.corr()\n\n fig, ax = a_libraries.matplotlib_heatmap_chart(corr_df.values)\n\n return fig, ax", ...
[ "0.61510575", "0.61060256", "0.6084988", "0.6076633", "0.6073375", "0.6024223", "0.60044134", "0.59975386", "0.5975684", "0.5969831", "0.596719", "0.5944489", "0.594429", "0.59286827", "0.5918338", "0.5899142", "0.5887171", "0.5877043", "0.58721083", "0.5865014", "0.58345026"...
0.6993276
0
returns mahalanobis distance of each input for each gaussian parameterized by mu[i], cov[i]. mu = (k, d) numpy array where k is number of mixtures and d is the dimension of the data. cov = (k, d, d) numpy array with the same setup as mu in terms of k and d.
def mahalanobis(data, mu, cov, k=2): mhd = np.zeros((data.shape[0], mu.shape[0])) for i in range(mu.shape[0]): _mu = mu[i, :] _cov = cov[i, :, :] mhd[:, i] = np.sum( (data - _mu) @ np.linalg.inv(_cov) * (data - _mu), axis=1 ) return np.sqrt(mhd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mahalanobis_dist_factory(X):\n\t# compute the average vector location\n\tavg = class_average(X)\n\t# compute the variance-covariance matrix of the input matrix\n\tvarcovar = np.cov(X, rowvar=False)\n\t# compute the inverse of the variance-covariance matrix\n\tinv_varcovar = np.linalg.pinv(varcovar)\n\n\t# func...
[ "0.66977125", "0.65298855", "0.64811194", "0.6442887", "0.64422977", "0.61270535", "0.60174", "0.60146606", "0.6008952", "0.59352744", "0.5921679", "0.587831", "0.579491", "0.57288444", "0.5714017", "0.5707229", "0.55162406", "0.55084175", "0.5483291", "0.54774976", "0.546596...
0.7921236
0
Generator that iterates over all objects in a given s3 bucket
def iterate_bucket_objects(self, bucket): client = self.credentials.session.client('s3') page_iterator = client.list_objects_v2(Bucket=bucket) if 'Contents' not in page_iterator: return [] for item in page_iterator['Contents']: yield item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_s3_keys_as_generator(s3_client,bucket, prefix):\n kwargs = {'Bucket': bucket, 'Prefix' : prefix}\n while True:\n resp = s3_client.list_objects_v2(**kwargs)\n for obj in resp['Contents']:\n yield obj\n\n try:\n kwargs['ContinuationToken'] = resp['NextContinua...
[ "0.8061774", "0.78454584", "0.7636215", "0.75269794", "0.7432275", "0.7339902", "0.7302619", "0.72996944", "0.7233975", "0.7216875", "0.7203796", "0.71446174", "0.7140059", "0.71253085", "0.7119356", "0.7085106", "0.7067508", "0.6997889", "0.6971213", "0.69600886", "0.6849436...
0.83988297
0
Set up variables for the GrandCanonicalMonteCarloSampler
def setup_BaseGrandCanonicalMonteCarloSampler(): # Make variables global so that they can be used global base_gcmc_sampler global base_gcmc_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb'))) ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml') system = ff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_setup(self):\n self.DNN = SganMLP(self.settings.number_of_bins)\n self.D = SganMLP(self.settings.number_of_bins)\n self.G = Generator()", "def initialize(self):\n self.gc1.reset_parameters()\n self.gc2.reset_parameters()\n\n for s in self.scores:\n s...
[ "0.65247303", "0.64355326", "0.6290882", "0.62845963", "0.6265411", "0.6215736", "0.6098296", "0.60891455", "0.60858494", "0.6080878", "0.60772467", "0.6068644", "0.60400265", "0.603621", "0.60180527", "0.6005577", "0.59941375", "0.5993957", "0.59704316", "0.59679365", "0.595...
0.72094464
0
Set up variables for the GCMCSphereSampler
def setup_GCMCSphereSampler(): # Make variables global so that they can be used global gcmc_sphere_sampler global gcmc_sphere_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb'))) ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml') system = ff.createSystem(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_StandardGCMCSphereSampler():\n # Make variables global so that they can be used\n global std_gcmc_sphere_sampler\n global std_gcmc_sphere_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n ...
[ "0.70422375", "0.62401485", "0.6174525", "0.60479116", "0.59983546", "0.5985195", "0.59568286", "0.5914662", "0.58969736", "0.58124846", "0.58091885", "0.57982147", "0.575604", "0.5727869", "0.57278335", "0.56950855", "0.56897867", "0.5652037", "0.56375766", "0.5635338", "0.5...
0.71677244
0
Set up variables for the StandardGCMCSphereSampler
def setup_StandardGCMCSphereSampler(): # Make variables global so that they can be used global std_gcmc_sphere_sampler global std_gcmc_sphere_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb'))) ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml') system = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_GCMCSphereSampler():\n # Make variables global so that they can be used\n global gcmc_sphere_sampler\n global gcmc_sphere_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n system = ff.c...
[ "0.7230866", "0.64710623", "0.63545537", "0.6177041", "0.6059987", "0.6001161", "0.59810454", "0.59458554", "0.59250724", "0.5810696", "0.5796983", "0.57875997", "0.5764037", "0.57382625", "0.5712826", "0.5710626", "0.56650996", "0.5653145", "0.56498593", "0.5624879", "0.5621...
0.74774736
0
Set up variables for the GCMCSystemSampler
def setup_GCMCSystemSampler(): # Make variables global so that they can be used global gcmc_system_sampler global gcmc_system_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb'))) ff = ForceField('tip3p.xml') system = ff.createSystem(pdb.topology, nonbondedMet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_StandardGCMCSystemSampler():\n # Make variables global so that they can be used\n global std_gcmc_system_sampler\n global std_gcmc_system_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb')))\n ff = ForceField('tip3p.xml')\n system = ff.createSyste...
[ "0.73459214", "0.6634865", "0.6564363", "0.65134656", "0.6442558", "0.64188296", "0.63949424", "0.6207153", "0.6156057", "0.6122879", "0.6117317", "0.611441", "0.601784", "0.59655565", "0.5935689", "0.5922263", "0.58999264", "0.58888024", "0.5882525", "0.5874189", "0.58622843...
0.7534252
0
Set up variables for the StandardGCMCSystemSampler
def setup_StandardGCMCSystemSampler(): # Make variables global so that they can be used global std_gcmc_system_sampler global std_gcmc_system_simulation pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb'))) ff = ForceField('tip3p.xml') system = ff.createSystem(pdb.topolo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_GCMCSystemSampler():\n # Make variables global so that they can be used\n global gcmc_system_sampler\n global gcmc_system_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'water-ghosts.pdb')))\n ff = ForceField('tip3p.xml')\n system = ff.createSystem(pdb.topology, ...
[ "0.7308907", "0.6762758", "0.6539486", "0.6444159", "0.6409054", "0.6210909", "0.6188153", "0.6183125", "0.60796523", "0.6073801", "0.6063694", "0.60533386", "0.5910438", "0.59057194", "0.5897044", "0.58700055", "0.583869", "0.58104205", "0.57944477", "0.5793852", "0.57618254...
0.75966007
0
Make sure the BaseGrandCanonicalMonteCarloSampler.reset() method works correctly
def test_reset(self): # Set tracked variables to some non-zero values base_gcmc_sampler.n_accepted = 1 base_gcmc_sampler.n_moves = 1 base_gcmc_sampler.Ns = [1] # Reset base_gcmc_sampler base_gcmc_sampler.reset() # Check that the values have been reset as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.st = segment_tree.SegmentTreeSampler(self.n, np.ones(self.n) * self.reg, self.random_state)", "def setup_BaseGrandCanonicalMonteCarloSampler():\n # Make variables global so that they can be used\n global base_gcmc_sampler\n global base_gcmc_simulation\n\n pdb = PDBFile(...
[ "0.7006503", "0.6610244", "0.6507081", "0.64523005", "0.6371905", "0.6332127", "0.6324144", "0.63123316", "0.6293652", "0.624985", "0.624754", "0.62317836", "0.62037873", "0.62037873", "0.62037873", "0.61578816", "0.6154015", "0.6154015", "0.61478823", "0.6144965", "0.6130272...
0.69381005
1
Make sure the GCMCSphereSampler.deleteWatersInGCMCSphere() method works correctly
def test_deleteWatersInGCMCSphere(self): # Now delete the waters in the sphere gcmc_sphere_sampler.deleteWatersInGCMCSphere() new_ghosts = gcmc_sphere_sampler.getWaterStatusResids(0) # Check that the list of ghosts is correct assert new_ghosts == [70, 71, 3054, 3055, 3056, 3057, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_updateGCMCSphere(self):\n # Get initial gcmc_resids and status\n gcmc_waters = deepcopy(gcmc_sphere_sampler.getWaterStatusResids(1))\n sphere_centre = deepcopy(gcmc_sphere_sampler.sphere_centre)\n N = gcmc_sphere_sampler.N\n\n # Update the GCMC sphere (shouldn't change a...
[ "0.63944376", "0.62567043", "0.59877086", "0.5870835", "0.5841204", "0.5656549", "0.55353993", "0.5513171", "0.5488697", "0.5458763", "0.5458092", "0.5409319", "0.53839445", "0.537687", "0.53426343", "0.5312269", "0.5309804", "0.5300502", "0.5300502", "0.5294281", "0.52817607...
0.81623113
0
Make sure the GCMCSphereSampler.updateGCMCSphere() method works correctly
def test_updateGCMCSphere(self): # Get initial gcmc_resids and status gcmc_waters = deepcopy(gcmc_sphere_sampler.getWaterStatusResids(1)) sphere_centre = deepcopy(gcmc_sphere_sampler.sphere_centre) N = gcmc_sphere_sampler.N # Update the GCMC sphere (shouldn't change as the syste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_GCMCSphereSampler():\n # Make variables global so that they can be used\n global gcmc_sphere_sampler\n global gcmc_sphere_simulation\n\n pdb = PDBFile(utils.get_data_file(os.path.join('tests', 'bpti-ghosts.pdb')))\n ff = ForceField('amber14-all.xml', 'amber14/tip3p.xml')\n system = ff.c...
[ "0.6867336", "0.6694733", "0.6372616", "0.6199202", "0.54769635", "0.537066", "0.5282511", "0.52227336", "0.5180439", "0.5173947", "0.51617426", "0.51477826", "0.5090878", "0.5084552", "0.50375485", "0.50262225", "0.49550423", "0.49523485", "0.4936377", "0.49238035", "0.48899...
0.79535794
0
Make sure the GCMCSphereSampler.move() method works correctly
def test_move(self): # Shouldn't be able to run a move with this sampler self.assertRaises(NotImplementedError, lambda: gcmc_sphere_sampler.move(gcmc_sphere_simulation.context)) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n neq_gcmc_sphere_sampler.reset()\n\n # Just run one move, as they are a bit more expensive\n neq_gcmc_sphere_sampler.move(neq_gcmc_sphere_simulation.context, 1)\n\n # Check some of the variables have been updated as appropriate\n assert neq_gcmc_sphere_sampl...
[ "0.7312604", "0.6786061", "0.66649306", "0.65060794", "0.64089835", "0.62293303", "0.6205869", "0.61197466", "0.58118314", "0.5800113", "0.5773424", "0.5737712", "0.5735148", "0.5719306", "0.57125866", "0.56983864", "0.567811", "0.56488407", "0.56414455", "0.5633706", "0.5608...
0.71798897
1
Make sure the GCMCSphereSampler.insertRandomWater() method works correctly
def test_insertRandomWater(self): # Insert a random water new_positions, wat_id, atom_ids = gcmc_sphere_sampler.insertRandomWater() # Check that the indices returned are integers - may not be type int assert wat_id == int(wat_id) assert all([i == int(i) for i in atom_ids]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_insertRandomWater(self):\n # Insert a random water\n new_positions, wat_id, atom_ids = gcmc_system_sampler.insertRandomWater()\n\n # Check that the indices returned are integers - may not be type int\n assert wat_id == int(wat_id)\n assert all([i == int(i) for i in atom_...
[ "0.72090286", "0.6620027", "0.63753724", "0.63195544", "0.5973471", "0.5952739", "0.5840426", "0.5759416", "0.5701698", "0.5691748", "0.567196", "0.5536785", "0.5514029", "0.5480719", "0.5478959", "0.54229546", "0.53605586", "0.5359001", "0.53506374", "0.53441834", "0.5324880...
0.73840714
0
Make sure the GCMCSphereSampler.deleteRandomWater() method works correctly
def test_deleteRandomWater(self): # Insert a random water delete_water, atom_indices = gcmc_sphere_sampler.deleteRandomWater() # Check that the indices returned are integers assert delete_water == int(delete_water) assert all([i == int(i) for i in atom_indices]) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deleteRandomWater(self):\n # Insert a random water\n delete_water, atom_ids = gcmc_system_sampler.deleteRandomWater()\n\n # Check that the indices returned are integers\n assert delete_water == int(delete_water)\n assert all([i == int(i) for i in atom_ids])\n\n re...
[ "0.76301825", "0.7191139", "0.59051096", "0.57779187", "0.5739509", "0.56568503", "0.5618967", "0.5591656", "0.5591656", "0.5516601", "0.5448119", "0.5411559", "0.5407415", "0.53482056", "0.53217196", "0.5315446", "0.530809", "0.5303515", "0.5301117", "0.5250197", "0.5238719"...
0.78150624
0
Make sure the NonequilibriumGCMCSphereSampler.move() method works correctly
def test_move(self): neq_gcmc_sphere_sampler.reset() # Just run one move, as they are a bit more expensive neq_gcmc_sphere_sampler.move(neq_gcmc_sphere_simulation.context, 1) # Check some of the variables have been updated as appropriate assert neq_gcmc_sphere_sampler.n_moves =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n # Shouldn't be able to run a move with this sampler\n self.assertRaises(NotImplementedError, lambda: gcmc_sphere_sampler.move(gcmc_sphere_simulation.context))\n\n return None", "def test_move(self):\n # Run a handful of GCMC moves\n n_moves = 10\n ...
[ "0.74134445", "0.71293914", "0.69717276", "0.6844426", "0.6774158", "0.65357774", "0.6450368", "0.63212657", "0.61129725", "0.59394455", "0.59110534", "0.58613527", "0.57763714", "0.5770376", "0.5766818", "0.5765549", "0.5754707", "0.5747235", "0.56879604", "0.5626373", "0.55...
0.7558569
0
Make sure the NonequilibriumGCMCSphereSampler.insertionMove() method works correctly
def test_insertionMove(self): # Prep for a move # Read in positions neq_gcmc_sphere_sampler.context = neq_gcmc_sphere_simulation.context state = neq_gcmc_sphere_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True) neq_gcmc_sphere_sampler.positi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n neq_gcmc_sphere_sampler.reset()\n\n # Just run one move, as they are a bit more expensive\n neq_gcmc_sphere_sampler.move(neq_gcmc_sphere_simulation.context, 1)\n\n # Check some of the variables have been updated as appropriate\n assert neq_gcmc_sphere_sampl...
[ "0.7209169", "0.71998745", "0.7198035", "0.69792235", "0.68337613", "0.6774714", "0.6697102", "0.6559923", "0.6445582", "0.6215921", "0.6078141", "0.5641775", "0.5602461", "0.55762756", "0.5568384", "0.5548173", "0.5492333", "0.5485724", "0.5446329", "0.54125756", "0.53864336...
0.7701173
0
Make sure the NonequilibriumGCMCSphereSampler.deletionMove() method works correctly
def test_deletionMove(self): # Prep for a move # Read in positions neq_gcmc_sphere_sampler.context = neq_gcmc_sphere_simulation.context state = neq_gcmc_sphere_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True) neq_gcmc_sphere_sampler.positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deletionMove(self):\n # Prep for a move\n # Read in positions\n neq_gcmc_system_sampler.context = neq_gcmc_system_simulation.context\n state = neq_gcmc_system_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True)\n neq_gcmc_system_sampl...
[ "0.7485762", "0.6438369", "0.6428132", "0.62262905", "0.6145327", "0.6085681", "0.6073769", "0.60079294", "0.60004663", "0.5970122", "0.5940385", "0.5844463", "0.57683086", "0.5733593", "0.57244855", "0.5646963", "0.56085235", "0.5596272", "0.55913806", "0.5586423", "0.558213...
0.7886815
0
Make sure the GCMCSystemSampler.move() method works correctly
def test_move(self): # Shouldn't be able to run a move with this sampler self.assertRaises(NotImplementedError, lambda: gcmc_system_sampler.move(gcmc_system_simulation.context)) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n neq_gcmc_system_sampler.reset()\n\n # Just run one move, as they are a bit more expensive\n neq_gcmc_system_sampler.move(neq_gcmc_system_simulation.context, 1)\n\n # Check some of the variables have been updated as appropriate\n assert neq_gcmc_system_sampl...
[ "0.69886005", "0.6938794", "0.6935821", "0.6869701", "0.67401326", "0.67089957", "0.6217315", "0.6078865", "0.6038649", "0.5992114", "0.5985543", "0.59831053", "0.5977594", "0.5931836", "0.5905786", "0.5886545", "0.5886054", "0.5833608", "0.57884306", "0.5736834", "0.57317823...
0.7292309
0
Make sure the GCMCSystemSampler.insertRandomWater() method works correctly
def test_insertRandomWater(self): # Insert a random water new_positions, wat_id, atom_ids = gcmc_system_sampler.insertRandomWater() # Check that the indices returned are integers - may not be type int assert wat_id == int(wat_id) assert all([i == int(i) for i in atom_ids]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_insertRandomWater(self):\n # Insert a random water\n new_positions, wat_id, atom_ids = gcmc_sphere_sampler.insertRandomWater()\n\n # Check that the indices returned are integers - may not be type int\n assert wat_id == int(wat_id)\n assert all([i == int(i) for i in atom_...
[ "0.6928528", "0.6385021", "0.61273587", "0.60822636", "0.60734993", "0.60668766", "0.57946825", "0.5652783", "0.54904884", "0.5488012", "0.54828304", "0.54828304", "0.5407029", "0.5398256", "0.5383638", "0.5353736", "0.5327705", "0.53053445", "0.52523714", "0.5250405", "0.524...
0.72111976
0
Make sure the GCMCSystemSampler.deleteRandomWater() method works correctly
def test_deleteRandomWater(self): # Insert a random water delete_water, atom_ids = gcmc_system_sampler.deleteRandomWater() # Check that the indices returned are integers assert delete_water == int(delete_water) assert all([i == int(i) for i in atom_ids]) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deleteRandomWater(self):\n # Insert a random water\n delete_water, atom_indices = gcmc_sphere_sampler.deleteRandomWater()\n\n # Check that the indices returned are integers\n assert delete_water == int(delete_water)\n assert all([i == int(i) for i in atom_indices])\n\n ...
[ "0.7379795", "0.6214693", "0.5664468", "0.56013966", "0.5546722", "0.5495053", "0.5435395", "0.53826165", "0.53622735", "0.532345", "0.52940685", "0.52940685", "0.52836555", "0.5280242", "0.5273561", "0.5255017", "0.5244421", "0.5212148", "0.5208511", "0.52065897", "0.5205397...
0.7646268
0
Make sure the StandardGCMCSystemSampler.move() method works correctly
def test_move(self): # Run a handful of GCMC moves n_moves = 10 std_gcmc_system_sampler.move(std_gcmc_system_simulation.context, n_moves) # Check that all of the appropriate variables seem to have been updated # Hard to test individual moves as they are rarely accepted - just ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n # Shouldn't be able to run a move with this sampler\n self.assertRaises(NotImplementedError, lambda: gcmc_system_sampler.move(gcmc_system_simulation.context))\n\n return None", "def test_move(self):\n neq_gcmc_system_sampler.reset()\n\n # Just run one mov...
[ "0.7181574", "0.6826627", "0.6822562", "0.6745499", "0.6640983", "0.65411764", "0.6038776", "0.59790057", "0.5942716", "0.5918189", "0.5876411", "0.5870334", "0.58546937", "0.58221716", "0.572842", "0.5687787", "0.56451154", "0.5627452", "0.55952823", "0.5567614", "0.55563265...
0.6848373
1
Make sure the NonequilibriumGCMCSystemSampler.move() method works correctly
def test_move(self): neq_gcmc_system_sampler.reset() # Just run one move, as they are a bit more expensive neq_gcmc_system_sampler.move(neq_gcmc_system_simulation.context, 1) # Check some of the variables have been updated as appropriate assert neq_gcmc_system_sampler.n_moves =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move(self):\n # Shouldn't be able to run a move with this sampler\n self.assertRaises(NotImplementedError, lambda: gcmc_system_sampler.move(gcmc_system_simulation.context))\n\n return None", "def test_move(self):\n # Run a handful of GCMC moves\n n_moves = 10\n ...
[ "0.769783", "0.74639684", "0.7438356", "0.7360609", "0.73240685", "0.72791535", "0.6381922", "0.6381247", "0.63642156", "0.635932", "0.6350762", "0.6348595", "0.63146937", "0.6295221", "0.62767977", "0.6261591", "0.6196394", "0.61194867", "0.61188483", "0.6117917", "0.6047609...
0.7515609
1
Make sure the NonequilibriumGCMCSystemSampler.insertionMove() method works correctly
def test_insertionMove(self): # Prep for a move # Read in positions neq_gcmc_system_sampler.context = neq_gcmc_system_simulation.context state = neq_gcmc_system_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True) neq_gcmc_system_sampler.positi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_insertionMove(self):\n # Prep for a move\n # Read in positions\n neq_gcmc_sphere_sampler.context = neq_gcmc_sphere_simulation.context\n state = neq_gcmc_sphere_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True)\n neq_gcmc_sphere_samp...
[ "0.77547926", "0.72145873", "0.7090594", "0.70797455", "0.6963121", "0.6911819", "0.6842811", "0.66163623", "0.64768654", "0.63967305", "0.62777495", "0.6137192", "0.5995998", "0.59360576", "0.59151226", "0.5828478", "0.5789905", "0.5759315", "0.5706526", "0.567753", "0.56455...
0.7858803
0
Make sure the NonequilibriumGCMCSystemSampler.deletionMove() method works correctly
def test_deletionMove(self): # Prep for a move # Read in positions neq_gcmc_system_sampler.context = neq_gcmc_system_simulation.context state = neq_gcmc_system_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True) neq_gcmc_system_sampler.positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deletionMove(self):\n # Prep for a move\n # Read in positions\n neq_gcmc_sphere_sampler.context = neq_gcmc_sphere_simulation.context\n state = neq_gcmc_sphere_sampler.context.getState(getPositions=True, enforcePeriodicBox=True, getVelocities=True)\n neq_gcmc_sphere_sampl...
[ "0.7867403", "0.6501173", "0.6406832", "0.63714015", "0.62150633", "0.6205262", "0.61711025", "0.6090827", "0.60874534", "0.6077852", "0.60104895", "0.59488875", "0.5947629", "0.5926822", "0.59081423", "0.590085", "0.58612853", "0.58450735", "0.5831866", "0.5831866", "0.57898...
0.7957777
0
(obj) > (obj) Method that will return connection to the database using given credentials.
def get_connection(self): return dbapi.connect(credentials.SERVER,\ credentials.PORT,\ credentials.USER,\ credentials.PASSWORD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(db, username=None, password=None, **kwargs):\n global _connection_settings, _db_name, _db_username, _db_password, _db\n _connection_settings = dict(_connection_defaults, **kwargs)\n _db_name = db\n _db_username = username\n _db_password = password\n return _get_db(reconnect=True)", ...
[ "0.7528545", "0.7352598", "0.7319592", "0.7257597", "0.7221091", "0.7190557", "0.7125156", "0.7116309", "0.70870197", "0.7086611", "0.7075302", "0.70648813", "0.7061649", "0.7060165", "0.7057439", "0.7055212", "0.7048197", "0.70444536", "0.70107573", "0.69982386", "0.69969594...
0.8073522
0
(obj, list, list, list, boolean) > (str) Building part of the query, according to the value passed with 'query_part' parameter (should be 1 or 2).
def build_query_part(self, input_data, table_fields_types, query_part): result_query = '(' for index in xrange(len(input_data)): if query_part == 1: proper_value = '"' + input_data[index] + '"' if query_part == 2: if "nextval" not in input_data[index]: proper_value = self.escapeinput_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generateQuery(self, query):\n if query == None:\n return [\"1=1\"]\n elif type(query) is not list:\n return [query]\n else:\n return query", "def make_complex_query_set(self):\n\n query = self.request.GET.get(\"q\")\n program_id = self.req...
[ "0.6225745", "0.60901934", "0.60255617", "0.5791044", "0.5705478", "0.56317335", "0.5615809", "0.55866855", "0.5552422", "0.5450757", "0.5444924", "0.54353344", "0.53419", "0.5271756", "0.5258663", "0.5253045", "0.5239043", "0.5230882", "0.52274454", "0.52210087", "0.52185774...
0.70095813
0
(obj, str) > (list(), list()) Extracting table identifiers from the ".txt" mask file. 'Table Definitions' are taken by simple "Copy>Paste" from 'Open Definition' visual interface of table in SAP HANA Studio.
def identify_table_mask(self, maskdata_file_name='daily_update_table-mask.txt', delim=';'): table_fields_names, table_fields_types = list(), list() mask_f = open(META_INFO_DIRECTORY + '/' + maskdata_file_name, "r") # skipping line with descriptions of attributes line = mask_f.readline() # first line wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetDefinitions(filename,obj):\n file=open(filename)\n content=file.read().replace(\"\\t\",\" \")\n file.close\n pat=re.compile(obj +' \\{([\\S\\s]*?)\\}',re.DOTALL)\n finds=pat.findall(content)\n return finds", "def find_table_command(input_file):\n contents = open(input_file, 'r')\n ...
[ "0.6227015", "0.56853586", "0.5597648", "0.5541076", "0.54774153", "0.5453966", "0.53986174", "0.5364839", "0.53526664", "0.5321016", "0.5305525", "0.5287184", "0.5245256", "0.5241831", "0.5231992", "0.5211202", "0.5209902", "0.52098477", "0.51902837", "0.51770276", "0.517508...
0.5998301
1
convert netcdf variable to string for rfm input
def ncvar_to_str(data, variable_name, unit_factor=1., separator=','): return np.array2string(unit_factor*data[variable_name][:], separator=separator, precision=3, max_line_width=80)[1:-1] + '\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.identity(default=self.nc_get_variable(\"\"))", "def to_netcdf(self, outfile):", "def read_netcdf(self,filename):", "def read_nc(input_file_path_str,var_name=None):\r\n\r\n if not exists(dirname(input_file_path_str)):\r\n print('*** ERROR, input file path does...
[ "0.56684077", "0.56515074", "0.5517042", "0.5477448", "0.533655", "0.5274521", "0.5267746", "0.52513975", "0.5239401", "0.5221346", "0.52030563", "0.51221067", "0.5119322", "0.51039076", "0.5095084", "0.509416", "0.5086682", "0.5085247", "0.50754094", "0.506929", "0.5048053",...
0.6453824
0
Handles the view, creating a window with received messages, input field and a send button
def __init__(self, controller): self.controller = controller self.top = tkinter.Tk() self.top.title("Chatter") self.input = tkinter.StringVar() # For the messages to be sent. self.input.set("") """Message box""" messages_frame = tkinter.Frame(self.top) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_messages(self):\r\n self.clear_screen()\r\n user_label = Label(self.root, text=\"Hello \" + self.username,\r\n font=self.title_font, bg=self.bg_color, height=2)\r\n user_label.pack(pady=10, padx=50)\r\n messages_frame = Frame(self.root)\r\n mess...
[ "0.6463644", "0.6435802", "0.6249434", "0.6225735", "0.6175273", "0.61514634", "0.61473054", "0.6112437", "0.6067888", "0.60428005", "0.60217667", "0.6010846", "0.6000327", "0.59954065", "0.59937036", "0.59228635", "0.590236", "0.58884555", "0.5888028", "0.5829711", "0.581294...
0.7003499
0
u"""Align StringList if header is not empty, add header
def align_strings(strings, header=''): spaces = [len(l)-len(l.lstrip()) for l in strings.data if l] min_spaces = min(spaces) if spaces else 0 if min_spaces > 0 or header: for index in range(len(strings.data)): strings.data[index] = header + strings.data[index][min_spaces:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header(List):\n headers = []\n restes = []\n for element in List:\n if isinstance(element, str):\n restes.append('')\n headers.append(element)\n elif isinstance(element, list):\n counter = 0\n restes.pop()\n restes.extend(element)\n ...
[ "0.64122003", "0.6266514", "0.5951054", "0.5781972", "0.5749648", "0.5705214", "0.56616527", "0.5596404", "0.5591171", "0.55200005", "0.5484643", "0.5462037", "0.5460574", "0.54580504", "0.5446216", "0.54273564", "0.5410737", "0.5407855", "0.5390078", "0.53741413", "0.5374005...
0.6849348
0
Try to import and return module, or return None if the module does not exist.
def try_import(module, default=None): try: return importlib.import_module(module) except ImportError: return default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_module(name) -> Optional[ModuleType]:\n\n try:\n return importlib.import_module(name)\n except ModuleNotFoundError:\n return None", "def import_or_none(library):\n try:\n return importlib.import_module(library)\n except ImportError:\n return None", "def _get_m...
[ "0.7837974", "0.75869286", "0.7369042", "0.7268747", "0.7056078", "0.7056078", "0.70377046", "0.70377046", "0.70377046", "0.69279057", "0.68842643", "0.6857886", "0.6832459", "0.6797039", "0.6796271", "0.6792751", "0.6765652", "0.67623574", "0.6736071", "0.6666858", "0.661674...
0.78851616
0
Return the current object. This is useful if you want the real object behind the proxy at a time for performance reasons or because you want to pass the object into a different context.
def _get_current_object(self): loc = object.__getattribute__(self, '_Proxy__local') if not hasattr(loc, '__release_local__'): return loc(*self.__args, **self.__kwargs) try: return getattr(loc, self.__name__) except AttributeError: raise RuntimeError('n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_object(proxy):\n return proxy.__current_object__()", "def __current_object__(self):\n return self.__lookup()", "def _get_current_object(self):\n if not hasattr(self.__local, '__release_local__'):\n return self.__local()\n try:\n return getattr(self.__lo...
[ "0.86627316", "0.7780114", "0.77054226", "0.77054226", "0.7560016", "0.7132897", "0.7088699", "0.7008438", "0.6984951", "0.6984951", "0.6924909", "0.6718924", "0.65716755", "0.6560612", "0.65047556", "0.6426463", "0.6426463", "0.6426463", "0.640996", "0.636042", "0.636042", ...
0.8246899
1
Creates a transform from the leg frame to the foot. params = [[a, alpha, S, theta],[a, alpha, S, theta],...]
def T(params, phi): # handle the base frame, eqn 3.9, p36 t = np.array([ [cos(phi), -sin(phi), 0.0, 0.0], [sin(phi), cos(phi), 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0] ]) for i, p in enumerate(params): t = t.dot(rot(*p)) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def T2(params):\n\t# handle the base frame, eqn 3.9, p36\n\tt = np.array([\n\t\t[1.0, 0.0, 0.0, 0.0],\n\t\t[0.0, 1.0, 0.0, 0.0],\n\t\t[0.0, 0.0, 1.0, 0.0],\n\t\t[0.0, 0.0, 0.0, 1.0]\n\t])\n\tfor i, p in enumerate(params):\n\t\tt = t.dot(rot(*p))\n\treturn t", "def CreateDHHomoTransform(alpha, a, d, theta):\n\n ...
[ "0.62162757", "0.58422446", "0.5733727", "0.5644279", "0.5590058", "0.5450843", "0.5309373", "0.53000003", "0.5293114", "0.52761006", "0.52697295", "0.5269417", "0.525969", "0.5253017", "0.52501714", "0.5247682", "0.5230527", "0.52099335", "0.5163592", "0.5143559", "0.5139012...
0.61880344
1
Creates a transform from the leg frame to the foot. params = [[a, alpha, S, theta],[a, alpha, S, theta],...]
def T2(params): # handle the base frame, eqn 3.9, p36 t = np.array([ [1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0] ]) for i, p in enumerate(params): t = t.dot(rot(*p)) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def T(params, phi):\n\t# handle the base frame, eqn 3.9, p36\n\tt = np.array([\n\t\t[cos(phi), -sin(phi), 0.0, 0.0],\n\t\t[sin(phi), cos(phi), 0.0, 0.0],\n\t\t[0.0, 0.0, 1.0, 0.0],\n\t\t[0.0, 0.0, 0.0, 1.0]\n\t])\n\tfor i, p in enumerate(params):\n\t\tt = t.dot(rot(*p))\n\treturn t", "def CreateDHHomoTransform(a...
[ "0.6187362", "0.5845504", "0.5735868", "0.5645705", "0.5591346", "0.5451531", "0.53119457", "0.52992576", "0.5295918", "0.5275266", "0.5272088", "0.5268932", "0.52600217", "0.5254501", "0.52495295", "0.5248859", "0.52300406", "0.5211535", "0.5166836", "0.5144489", "0.5140848"...
0.6215197
0
Set the tempo of this mob.
def set_tempo(self, tempo): self._tempo = tempo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_time(self, value: float):\n super().set_time(value)\n self.music.set_time(value)", "def tempo(beats, trk=None, bt=480):\n if not trk:\n trk = MidiTrack()\n trk.name = \"Tempo variation\"\n trk.append(MetaMessage(\"set_tempo\",\n tempo=beats[0],\...
[ "0.6575831", "0.6197611", "0.6102213", "0.5778988", "0.57423013", "0.5625058", "0.55944127", "0.557968", "0.5546541", "0.5523865", "0.5509457", "0.54904044", "0.5483288", "0.54639083", "0.5456773", "0.54504484", "0.5445503", "0.54454434", "0.54385287", "0.5428541", "0.5408127...
0.84690374
0
Move towards the player and fire when within range.
def step(self, time_delta, game_data): world, player = game_data vx, vy = self.get_velocity() mob_x, mob_y = self.get_position() player_x, player_y = player.get_position() # only fire within range if abs(player_x - mob_x) < self._fire_range: vx = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n\n # get the location we WOULD go to\n newX = self.xcor() + self.dx\n newY = self.ycor() + self.dy\n while (abs (newX) > self.BOX_RANGE) or (abs(newY) > self.BOX_RANGE):\n # print(\"choosing new direction... \",end=\"\")\n self.chooseNewDirection(...
[ "0.61968595", "0.6170248", "0.6166515", "0.6129309", "0.60832727", "0.60832584", "0.6014044", "0.601114", "0.5981628", "0.5953743", "0.5946923", "0.5935749", "0.59352946", "0.59157395", "0.5890171", "0.58368725", "0.582623", "0.58024716", "0.57987016", "0.57379115", "0.573666...
0.6232066
0
main entry point for histoqc pipelines
def main(argv=None): if argv is None: argv = sys.argv[1:] parser = argparse.ArgumentParser(prog="histoqc", description='Run HistoQC main quality control pipeline for digital pathology images') parser.add_argument('input_pattern', help="input filename pattern (try: *.svs or t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n print_hist_new(histogram_new(get_pledge_list()))", "def run_plot(args):\n # print(\"running chronqc_plot\")\n chronqc_plot.main(args)", "def main(arguments):\n auth = (arguments['username'], arguments['token'])\n data_collector = DataCollector(arguments['repo name'],\n ...
[ "0.64033383", "0.6262794", "0.61313564", "0.60832924", "0.60832614", "0.60386324", "0.5999072", "0.5999072", "0.5931503", "0.59036714", "0.58954185", "0.5868609", "0.58654493", "0.5856093", "0.5855897", "0.58351755", "0.58313406", "0.58169144", "0.5814098", "0.5782732", "0.57...
0.74855036
0
__init__ is always the name of the constructor of a class. A constructor is the method that gets called when we create a new object. The first parameter of any method in Python must be self. self refers to the object that is created by this class. rgb is the other parameter, and will be a RGB tuple.
def __init__(self, rgb): ## The following are this class's attributes self.r = rgb[0] self.g = rgb[1] self.b = rgb[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *rgb):\n self.alpha = 255\n if len(rgb) == 1:\n\t #Accept a string in the hext fromat made by color_rgb func.\n\t if isinstance(rgb[0],str):\n self.rgb = rgb_color(rgb[0])\n\t else:\n self.rgb=rgb[0]\n elif len(rgb) == 3:\n self...
[ "0.8136972", "0.77231884", "0.76384777", "0.7483035", "0.7460879", "0.73115057", "0.72980946", "0.71933264", "0.7148572", "0.7148572", "0.7148572", "0.7131563", "0.7131563", "0.7131563", "0.7131563", "0.7131563", "0.7131563", "0.7131563", "0.7070099", "0.7070099", "0.70283335...
0.8728064
1
Returns the tuple corresponding with this pixel.
def get_tuple(self): return (self.r, self.g, self.b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info_in_tuple(self):\r\n return self.key, self.value, self.get_color(), self.size_tree", "def get_value_tuple(self, index):\n return (self.color_lookup_table_points[0][index],\n self.color_lookup_table_points[1][index],\n self.color_lookup_table_points[2][index...
[ "0.7446234", "0.7247504", "0.721311", "0.7123951", "0.7038608", "0.70002913", "0.69405144", "0.6797578", "0.674756", "0.67272466", "0.67135227", "0.6685013", "0.6671659", "0.6653", "0.6596942", "0.65934783", "0.65755326", "0.65621746", "0.6548689", "0.6532319", "0.6498623", ...
0.7828132
1
Return True if this is a grayscale pixel, and False otherwise.
def is_grayscale(self): return self.r == self.g == self.b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isGrayscale(self, img: ndarray) -> bool:\n if len(np.squeeze(img).shape) == 2:\n return True\n else:\n return False", "def is_grayscale(img):\n return len(img.shape) == GS", "def isGray(self):\n return _libsbml.Unit_isGray(self)", "def is_gray(img: np.ndarra...
[ "0.78892565", "0.77772844", "0.76133263", "0.7463029", "0.7115401", "0.6903107", "0.68816495", "0.6827548", "0.674197", "0.67197865", "0.66625893", "0.64859575", "0.6473076", "0.64718765", "0.6427016", "0.61890054", "0.61247796", "0.6104257", "0.60149425", "0.5972804", "0.576...
0.84398115
1
This method sets the r, g, and b attributes of this pixel.
def set_rgb(self, r, g, b): self.r = r self.g = g self.b = b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRgb ( self, r, g = 0.0, b = 0.0 ):\n self.setRgba( r, g, b )", "def setPixel(self, x, y, r, g, b):\n self.array[x, y, 0] = (r)\n\tself.array[x, y, 1] = (g)\n\tself.array[x, y, 2] = (b)\n #QD & DT 4.2.15\n\n #_tkExec(self.image.put, \"{%s}\"%color_rgb(r,g,b), (x, y))", "def se...
[ "0.7381146", "0.72884506", "0.72397053", "0.68300134", "0.6787732", "0.6683633", "0.6643094", "0.6466936", "0.6457594", "0.6386721", "0.63136405", "0.6310134", "0.63059825", "0.62479043", "0.62479043", "0.61410093", "0.6104015", "0.605565", "0.6053823", "0.605312", "0.6047067...
0.78087
1
Generates the appropriate dictionaries from the provided action list
def _initialize_dicts(action_list): act_to_int = {} int_to_act = {} # Loop through the list and store it in the dictionaries for i, action in enumerate(action_list): act_to_int[action] = i int_to_act[i] = action return act_to_int, int_to_act
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_actions(self) -> list:\n pass", "def action_map(self) -> Dict[str, CLIActionType]:\n return add_dicts({\n \"dump\": self.dump_action,\n \"dump-macrosizes\": self.dump_macrosizes_action,\n \"dump_macrosizes\": self.dump_macrosizes_action,\n \...
[ "0.6746407", "0.66974306", "0.66112036", "0.6559247", "0.65344566", "0.6474273", "0.64630806", "0.63628864", "0.63465184", "0.6333028", "0.62804365", "0.6198757", "0.59783435", "0.5952686", "0.59122527", "0.590847", "0.59036595", "0.59000826", "0.5885315", "0.5858818", "0.584...
0.739009
0
Delete links on the container
def delete_container_links(container): container_uri = container.cdn_uri.replace("http://", "") domain = get_domain() if domain: for record in pyrax.cloud_dns.get_record_iterator(domain): if record.type == "CNAME" and record.data == container_uri: print("Unlinking %s" % r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_link():", "def delete_container(self, container: Container):", "def delete_link(self):\n self.link_layout.links_list.remove_widget(self)\n self.link_layout.links.remove(self.text)\n utils.update_data()\n utils.data[self.link_layout.parent_screen.name]['links'] = self.link...
[ "0.76768744", "0.691312", "0.6862549", "0.6743283", "0.6653135", "0.6498238", "0.6472545", "0.6456422", "0.6323648", "0.6303841", "0.6291867", "0.62405205", "0.6238634", "0.62103117", "0.61937076", "0.5988736", "0.59731394", "0.5970793", "0.594171", "0.59104294", "0.5887923",...
0.7854271
0
Get the last modified datetime for a container
def get_container_last_modified(container): objects = container.get_objects(limit=1) if len(objects): return datetime.datetime.strptime(objects[0].last_modified, _PARSER_FORMAT) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_modified_at(self) -> str:\n return pulumi.get(self, \"last_modified_at\")", "def last_modified_at(self) -> str:\n return pulumi.get(self, \"last_modified_at\")", "def last_modified_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"last_modified_time\")", "def last_mo...
[ "0.7555496", "0.7555496", "0.75193024", "0.7496126", "0.7496126", "0.74697715", "0.7412751", "0.7412751", "0.7412751", "0.7412751", "0.7412751", "0.7412751", "0.7311992", "0.7278188", "0.7254314", "0.7219902", "0.7196855", "0.7105135", "0.7090801", "0.7081383", "0.70422727", ...
0.8489138
0
Generates all a list of all containers matching a certain prefix, except the last "" ones.
def get_outdated_containers(prefix, num_to_keep=2): most_recent = [] for container_name in pyrax.cloudfiles.list_containers(): if container_name.startswith(prefix): container = pyrax.cloudfiles.get_container(container_name) last_modified = get_container_last_modified(container) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_containers_names(client, prefix=DOCK_CONTAINER_NAME_PREFIX):\n\n return [str(container.name) for container in client.containers.list(\"all\") if prefix in container.name]", "def list_containers(self, name_prefix=None):\n container_list = self.client.get_account()[1]\n\n if name_prefix:\n...
[ "0.69304466", "0.64303565", "0.63686144", "0.6298443", "0.61471915", "0.6133167", "0.6027998", "0.591743", "0.5897735", "0.5830035", "0.5825641", "0.5812814", "0.5802283", "0.57742286", "0.57635385", "0.57623243", "0.57075894", "0.5706502", "0.56450987", "0.5637083", "0.56289...
0.6463593
1
Attempts to read the given ExcelFile and returns the data as a tuple (headers, list of dicts) The first row is considered the header row. Parsing stops at the first column with empty header.
def read_xls(filename): wb = load_workbook(filename, read_only=True) if len(wb.sheetnames) > 1: raise ValueError('only single-sheet workbooks supported') ws = wb.active # active sheet headers = None outdata = list() for row in ws.iter_rows(): if not headers: headers ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_xlsx(filename):\n from openpyxl import load_workbook\n\n workbook = load_workbook(filename=filename)\n worksheet = workbook.get_sheet_by_name(workbook.get_sheet_names()[0])\n row_it = worksheet.iter_rows()\n split_row_list = ([cell.value if cell.value is not None else \"\"\n ...
[ "0.651729", "0.64198995", "0.63598114", "0.62849253", "0.6137743", "0.612996", "0.60210395", "0.5933359", "0.59227514", "0.5904994", "0.5890231", "0.5737812", "0.5731709", "0.57270443", "0.57237005", "0.5712983", "0.56776345", "0.5667989", "0.564994", "0.5644384", "0.5620857"...
0.6834978
0
Saves the file from the given file form into /tmp using a temporary name which preserves the suffix, stores the temporary name in the form, and reads the file content. WTF is NOT used for the file handling, since the file upload handling seems broken.
def save_to_tmp(form): file = request.files.get('file') suffix = os.path.splitext(secure_filename(file.filename))[-1] tf = tempfile.NamedTemporaryFile(dir='/tmp', delete=False, suffix=suffix, prefix='lpm_tmp_') filepath = tf.name tf.close() file.save(filepath) form.tmpname.data = os.path.bas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_uploaded_file(f):\n tfile = tempfile.NamedTemporaryFile(delete=False)\n for chunk in f.chunks():\n tfile.write(chunk)\n tfile.close()\n return tfile.name", "def extract_filepath(form):\n return os.path.join('/tmp/', secure_filename(form.tmpname.data))", "def missing_but_potenti...
[ "0.6999891", "0.6876595", "0.6282418", "0.61502916", "0.60941184", "0.6052424", "0.60009044", "0.59599507", "0.5925253", "0.5897284", "0.58814937", "0.5876699", "0.58743423", "0.58587784", "0.5825322", "0.576916", "0.57485294", "0.57369435", "0.57234985", "0.57125956", "0.570...
0.78922766
0
Returns the file path represented by the form
def extract_filepath(form): return os.path.join('/tmp/', secure_filename(form.tmpname.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_upload_path(self):\n location = self.get_storage().location\n return self.cleaned_data['key_name'][len(location):]", "def file_path(self) -> Path:\n return self._input_file", "def path(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"path\")", "def fpath(self):\n ...
[ "0.70559305", "0.69773567", "0.6857498", "0.67373013", "0.6730273", "0.67279446", "0.67258567", "0.6721358", "0.66846657", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747...
0.75473195
0
Load gene and trait data from a file into a dictionary. File assumed to be a CSV containing fields name, mother, father, trait. mother, father must both be blank, or both be valid names in the CSV. trait should be 0 or 1 if trait is known, blank otherwise.
def load_data(filename): data = dict() with open(filename) as f: reader = csv.DictReader(f) for row in reader: name = row["name"] data[name] = { "name": name, "mother": row["mother"] or None, "father": row["father"] or None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(filename):\n data = dict()\n with open(filename) as f:\n reader = csv.DictReader(f)\n for row in reader:\n name = row[\"name\"]\n data[name] = {\n \"name\": name,\n \"mother\": row[\"mother\"],\n \"father\": row[\"...
[ "0.7161335", "0.6256714", "0.6057112", "0.5882449", "0.58573693", "0.58507997", "0.584045", "0.57748455", "0.5722949", "0.56721675", "0.5641511", "0.5613904", "0.5599517", "0.55784625", "0.55653006", "0.55469626", "0.54307306", "0.54268855", "0.54145217", "0.5414053", "0.5411...
0.71564037
1
Add to `probabilities` a new joint probability `p`. Each person should have their "gene" and "trait" distributions updated. Which value for each distribution is updated depends on whether the person is in `have_gene` and `have_trait`, respectively.
def update(probabilities, one_gene, two_genes, have_trait, p): for person in probabilities: # count the genes for the person geneCount = 0 if person in one_gene: geneCount = 1 elif person in two_genes: geneCount = 2 # check the trait hasTrait...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_probabilities(self):\n self.probabilities = self.pheromones**self.EXP_PH * self.mcv**self.EXP_MCV", "def calculate_genotype_probabilities(self):\n for name, member in self.members.items():\n member.genotype_probabilities = self.genotype_probabilities_of(name)", "def add_pres...
[ "0.66382325", "0.59155154", "0.590946", "0.58607185", "0.5817059", "0.5806549", "0.5781411", "0.570775", "0.5676578", "0.56284326", "0.5609379", "0.55766016", "0.5545323", "0.5538337", "0.5505827", "0.5495825", "0.5493841", "0.5479561", "0.5453029", "0.5448534", "0.54455036",...
0.7667227
0