query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
return a filtered signal; low pass filter
def filt_lp(sig: np.ndarray, Ss: int, Cfs: int, Cfs1: None, order=5) -> np.ndarray: nyq = 0.5 * Ss normal_cutoff = Cfs / nyq b, a = butter(order, normal_cutoff, btype='low', analog=False) return lfilter(b, a, sig)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowpass_filter(self, data, reset=False):\n data = np.asarray(data)\n if self._lowpass_sos is not None:\n if self._lowpass_state is None or reset:\n self.lowpass_filter_reset(data)\n data, self._lowpass_state = scipy.signal.sosfilt(\n self._lowpass_sos, data, zi=self._lowpass_sta...
[ "0.77988434", "0.75619775", "0.7557733", "0.75412995", "0.7457959", "0.7273586", "0.72515476", "0.7229122", "0.71059245", "0.7071824", "0.70714056", "0.7000615", "0.68335736", "0.6817223", "0.6754172", "0.67400444", "0.6702155", "0.6678992", "0.6666621", "0.6623568", "0.66213...
0.6293112
44
return a filtered signal; high pass filter
def filt_hp(sig: np.ndarray, Ss: int, Cfs: int, Cfs1: None, order=5) -> np.ndarray: nyq = 0.5 * Ss normal_cutoff = Cfs / nyq b, a = butter(order, normal_cutoff, btype='high', analog=False) return lfilter(b, a, sig)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highpass_filter(self, data, reset=False):\n data = np.asarray(data)\n if self._highpass_sos is not None:\n if self._highpass_state is None or reset:\n self.highpass_filter_reset(data)\n data, self._highpass_state = scipy.signal.sosfilt(\n self._highpass_sos, data, zi=self._highp...
[ "0.7774473", "0.7378576", "0.706243", "0.70044225", "0.67968166", "0.6795389", "0.6783317", "0.6739167", "0.67341006", "0.6733994", "0.66774994", "0.6654014", "0.66108674", "0.6609167", "0.6607635", "0.65914875", "0.65901077", "0.65812695", "0.6576423", "0.6562273", "0.655813...
0.6301917
33
return a filtered signal; band pass filter
def filt_bp(sig: np.ndarray, Ss: int, Cfs0: int, Cfs1: None, order=5) -> np.ndarray: nyq = 0.5 * Ss normal_cutoff1 = Cfs0 / nyq normal_cutoff2 = Cfs1 / nyq b, a = butter(order, (normal_cutoff1, normal_cutoff2), btype='band', analog=False) return lfilte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_fir_filter(passband, fs, order=183, weights=[5.75, 1., 5.75], mask=[0, 1, 0]):\n # return remez(order, passband, mask, weights, Hz=fs), 1.\n return remez(order, passband, mask, Hz=fs), 1.", "def bandpass_filter(data, lowcut, highcut, fs=2000, numtaps=255):\n nyq = fs / 2\n\n # design filter\...
[ "0.7324347", "0.7298562", "0.7221127", "0.72196114", "0.7194418", "0.7182365", "0.7160815", "0.709657", "0.70529634", "0.70239526", "0.6996266", "0.6928782", "0.6902879", "0.68974304", "0.68689305", "0.6687426", "0.6683397", "0.6678169", "0.66576636", "0.6615789", "0.660077",...
0.62631494
47
Get the primitive roots of the modulo
def PrimitiveRoots(self, modulo): modRange = range(1, modulo) required = {x for x in modRange if fractions.gcd(x, modulo)} return [g for g in modRange if required == {pow(g, powers, modulo) for powers in modRange}]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_generator(modulus):\n return sympy.ntheory.primitive_root(modulus)", "def primitive_root(n):\n if n == 2:\n return 1\n phi = euler_phi(n)\n phi_divisors = factorize(phi)\n for g in range(2, n + 1):\n if gcd(g, n) != 1:\n continue\n for d, _ in phi_divisors:...
[ "0.6900234", "0.6570498", "0.6545125", "0.6443999", "0.63940936", "0.6374898", "0.63004357", "0.63003904", "0.6290598", "0.62899435", "0.625735", "0.62297606", "0.6209194", "0.61932445", "0.60664463", "0.5981598", "0.5971845", "0.5878766", "0.58545893", "0.5851274", "0.584104...
0.8176876
0
Send a string securely
def sendStr(self, socket, string, bufferSize=1024): return self.send(socket, string.encode(), bufferSize)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendToClient(plaintext):\n signature = userKeys.signUsingPrivateKey(plaintext)\n encryptedText = userKeys.encrypt(plaintext, contactKey)\n s.send(encryptedText)\n time.sleep(1)\n s.send(signature)", "def sendString(self, data):\n self.transport.write(pack(\"!i\",len(...
[ "0.66090614", "0.6591021", "0.64761496", "0.64339596", "0.6391974", "0.614747", "0.6142503", "0.61386234", "0.6135998", "0.61228913", "0.6088763", "0.6076449", "0.6070305", "0.60699373", "0.60325074", "0.5996709", "0.59754217", "0.58853626", "0.58497566", "0.5830384", "0.5820...
0.6278206
5
Receive a string securely
def recvStr(self, socket, bufferSize=1024): return self.recv(socket, bufferSize).decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_request_string(string, format=FORMAT_PEM):\n bio = BIO.MemoryBuffer(string)\n return load_request_bio(bio, format)", "def make_secure_val(string):\n\n return \"%s|%s\" % (string, hash_str(string))", "def load_request_der_string(string):\n bio = BIO.MemoryBuffer(string)\n return load_req...
[ "0.59533936", "0.5811541", "0.56815565", "0.56761354", "0.5635763", "0.5612197", "0.5547765", "0.5547765", "0.54540926", "0.5437279", "0.5437094", "0.5435814", "0.5407238", "0.5357738", "0.53528774", "0.5325348", "0.53104746", "0.5238935", "0.52323365", "0.5226999", "0.522462...
0.533402
15
Perform a key exchange with the given server to make a shared secret
def ExchangeClient(self, socket, bufferSize=4096): self.SharedPrime = number.bytes_to_long(socket.recv(bufferSize)) socket.send(self.Ack) self.SharedBase = number.bytes_to_long(socket.recv(bufferSize)) socket.send(self.Ack) key = self.RandKey() #client secret com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_server(wrapping_key_public):\n secret = os.urandom(32)\n logging.info(f'secret: {hexlify(secret)}')\n\n ref_path = 'server-secret-for-reference.bin'\n logging.debug(f'creating {ref_path}')\n with open(ref_path, 'wb') as f:\n f.write(secret)\n\n # generate IV\n iv = os.urandom(12)...
[ "0.70041174", "0.6704637", "0.6459529", "0.63826007", "0.6247185", "0.6241411", "0.6192971", "0.6180967", "0.61089927", "0.6052764", "0.6042717", "0.60315335", "0.5924363", "0.585214", "0.5838512", "0.5737452", "0.5730667", "0.56727517", "0.56534064", "0.56533796", "0.5636214...
0.56482506
20
Perform a key exchange with the given client to make a shared secret
def ExchangeServer(self, socket, bufferSize=4096): self.SharedPrime, self.SharedBase = self.RandomPrime() socket.send(number.long_to_bytes(self.SharedPrime)) socket.recv(bufferSize) socket.send(number.long_to_bytes(self.SharedBase)) socket.recv(bufferSize) key = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shared_key(private_key,public_key):\n\treturn private_key.exchange(public_key)", "def do_server(wrapping_key_public):\n secret = os.urandom(32)\n logging.info(f'secret: {hexlify(secret)}')\n\n ref_path = 'server-secret-for-reference.bin'\n logging.debug(f'creating {ref_path}')\n with open(ref_...
[ "0.66158164", "0.644604", "0.63088894", "0.6096652", "0.59875745", "0.59282756", "0.5803291", "0.5783874", "0.57682276", "0.574353", "0.56681067", "0.5610454", "0.56031257", "0.5511368", "0.5487431", "0.5479129", "0.5458488", "0.54581076", "0.5444761", "0.5406141", "0.5405146...
0.54456997
18
Initiate a server unit test in conjuction with the client unit test
def UnitTestServer(self): print('--server--') print('server pid is ' + str(os.getpid())) try: s = socket.socket() s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(('', 25692)) s.listen(1) c, addr = s.accept() #get client s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.c = Client(host=\"localhost\")", "def setUp(self):\n\t\tself.conn = Client([\"127.0.0.1:11211\"], debug = 1)", "def setUp(self):\n self.loop = asyncio.new_event_loop()\n asyncio.set_event_loop(None)\n self.server = KytosServer(TEST_ADDRESS, KytosServerProtoco...
[ "0.7822149", "0.7642992", "0.76374215", "0.7559873", "0.7514837", "0.7514837", "0.74274445", "0.7421756", "0.7407248", "0.7393341", "0.73756444", "0.7344193", "0.7252163", "0.7243478", "0.71754915", "0.7159595", "0.7117442", "0.7117442", "0.7117442", "0.7117442", "0.7103456",...
0.6791403
41
Initiate a client unit test in conjuction with the server unit test
def UnitTestClient(self): print('\n--client') print('client pid is ' + str(os.getpid())) try: s = socket.socket() s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.connect((socket.gethostbyname('localhost'), 25692)) self.ExchangeClient(s) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.c = Client(host=\"localhost\")", "def test_for_client():", "def setUp(self):\n\t\tself.conn = Client([\"127.0.0.1:11211\"], debug = 1)", "def setUp(self):\n self.client_socket = open_client_socket()", "def setUp(self):\n self.client_socket = open_client_socket()...
[ "0.8213718", "0.80244344", "0.80109507", "0.79769665", "0.79769665", "0.7970332", "0.7669021", "0.7669021", "0.7669021", "0.7669021", "0.756248", "0.7551135", "0.73318714", "0.7314016", "0.7276855", "0.7262563", "0.72312695", "0.7216074", "0.7203983", "0.7195504", "0.7164154"...
0.0
-1
Run a unit test to ensure that key exchange communications are working
def UnitTest(): print('--Running key exchange unit test--') server = DiffieHellman() t0 = threading.Thread(target=server.UnitTestServer) t0.start() time.sleep(0.1) logname = 'dhlog' with open(logname, 'w') as stdout: subprocess.call(['python', 'keyExch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n self.private_key = self.get_new_key()\n self.public_key = self.private_key.public_key()\n\n self.pem_private_key = self.private_key.private_bytes(\n serialization.Encoding.PEM,\n serialization.PrivateFormat.PKCS8,\n serialization.NoEncrypti...
[ "0.68959457", "0.6768567", "0.6740749", "0.67402774", "0.6681738", "0.6668606", "0.6642968", "0.6633357", "0.6619077", "0.6554481", "0.6428186", "0.63924134", "0.6349333", "0.63427824", "0.6338166", "0.6320229", "0.63075775", "0.62685555", "0.6263551", "0.62614954", "0.624999...
0.72412264
0
Damages segmentation masks by random transformations.
def damage_masks(labels, shift=True, scale=True, rotate=True, dilate=True): def _damage_masks_np(labels_): return damage_masks_np(labels_, shift, scale, rotate, dilate) damaged_masks = tf.py_func(_damage_masks_np, [labels], tf.int32, name='damage_masks') damaged_masks.set_shape(la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bg_mask(query_imgs, method):\n print(\"Obtaining masks\")\n segmentation_method = get_method(method)\n return [segmentation_method(img) for img in query_imgs]", "def mask_the_images(working_path,set_name):\n\n file_list=glob('/media/talhassid/My Passport/haimTal/test_images_0b8afe447b5f1a2c405f41...
[ "0.6190193", "0.6122746", "0.60014516", "0.5992799", "0.5963751", "0.58870125", "0.5827479", "0.57591707", "0.57511514", "0.5717484", "0.57092875", "0.5707633", "0.57019264", "0.568458", "0.56777894", "0.5674505", "0.56664747", "0.56642354", "0.56143486", "0.560032", "0.55961...
0.5273855
59
Performs the actual mask damaging in numpy.
def damage_masks_np(labels, shift=True, scale=True, rotate=True, dilate=True): unique_labels = np.unique(labels) unique_labels = np.setdiff1d(unique_labels, [0]) # Shuffle to get random depth ordering when combining together. np.random.shuffle(unique_labels) damaged_labels = np.zeros_like(labels) for l in u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_mask(self, array):\n # assert that the array and Mask.data are of the same size\n assert array.shape == self.shape, \"array and mask should be of the same shape\"\n\n array_copy = array.copy()\n\n # Applying mask\n # apply func_true where Mask.data is True\n arra...
[ "0.6378913", "0.6319546", "0.62407255", "0.62120646", "0.6204231", "0.6188625", "0.6123729", "0.6117613", "0.60972047", "0.6078417", "0.60769355", "0.60468847", "0.5975676", "0.59668505", "0.59560007", "0.59537953", "0.59433216", "0.5912248", "0.5910191", "0.59040207", "0.590...
0.0
-1
Performs mask damaging in numpy for a single object.
def _damage_single_object_mask(mask, shift, scale, rotate, dilate): # For now we just do shifting and scaling. Better would be Affine or thin # spline plate transformations. if shift: mask = _shift_mask(mask) if scale: mask = _scale_mask(mask) if rotate: mask = _rotate_mask(mask) if dilate: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_mask(self, array):\n # assert that the array and Mask.data are of the same size\n assert array.shape == self.shape, \"array and mask should be of the same shape\"\n\n array_copy = array.copy()\n\n # Applying mask\n # apply func_true where Mask.data is True\n arra...
[ "0.6581553", "0.645084", "0.64089704", "0.624001", "0.62089777", "0.6206625", "0.6106563", "0.61044997", "0.60834694", "0.6082419", "0.60604167", "0.60547453", "0.6044454", "0.60163283", "0.59976715", "0.59909415", "0.59805685", "0.5972587", "0.58964914", "0.58889", "0.586071...
0.6550946
1
Damages a mask for a single object by randomly shifting it in numpy.
def _shift_mask(mask, max_shift_factor=0.05): nzy, nzx, _ = mask.nonzero() h = nzy.max() - nzy.min() w = nzx.max() - nzx.min() size = np.sqrt(h * w) offset = np.random.uniform(-size * max_shift_factor, size * max_shift_factor, 2) shifted_mask = interpolation.shift(np.squeeze(mas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _damage_single_object_mask(mask, shift, scale, rotate, dilate):\n # For now we just do shifting and scaling. Better would be Affine or thin\n # spline plate transformations.\n if shift:\n mask = _shift_mask(mask)\n if scale:\n mask = _scale_mask(mask)\n if rotate:\n mask = _rotate_mask(mask)\n i...
[ "0.6778533", "0.60825586", "0.60205495", "0.5973601", "0.5953498", "0.5917967", "0.59039605", "0.5888028", "0.58462554", "0.5841398", "0.57965106", "0.5739158", "0.57294834", "0.5720012", "0.56666315", "0.5633807", "0.55948806", "0.55791575", "0.5567478", "0.5564043", "0.5555...
0.5330294
32
Damages a mask for a single object by randomly scaling it in numpy.
def _scale_mask(mask, scale_amount=0.025): nzy, nzx, _ = mask.nonzero() cy = 0.5 * (nzy.max() - nzy.min()) cx = 0.5 * (nzx.max() - nzx.min()) scale_factor = np.random.uniform(1.0 - scale_amount, 1.0 + scale_amount) shift = transform.SimilarityTransform(translation=[-cx, -cy]) inv_shift = transform.Similarit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _damage_single_object_mask(mask, shift, scale, rotate, dilate):\n # For now we just do shifting and scaling. Better would be Affine or thin\n # spline plate transformations.\n if shift:\n mask = _shift_mask(mask)\n if scale:\n mask = _scale_mask(mask)\n if rotate:\n mask = _rotate_mask(mask)\n i...
[ "0.6585455", "0.59778154", "0.5851471", "0.57898265", "0.5720597", "0.5643955", "0.5597096", "0.54800975", "0.5447898", "0.5433099", "0.5421635", "0.5365141", "0.5350452", "0.5305155", "0.53041595", "0.526097", "0.5259611", "0.52520066", "0.523572", "0.5234661", "0.5216299", ...
0.5919484
2
Damages a mask for a single object by randomly rotating it in numpy.
def _rotate_mask(mask, max_rot_degrees=3.0): cy = 0.5 * mask.shape[0] cx = 0.5 * mask.shape[1] rot_degrees = np.random.uniform(-max_rot_degrees, max_rot_degrees) shift = transform.SimilarityTransform(translation=[-cx, -cy]) inv_shift = transform.SimilarityTransform(translation=[cx, cy]) r = transform.Simila...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def randomize_voxel_mask(vol, mask, ref='fg'):\n\n # Initialization\n o_vol = np.copy(vol)\n\n # Finding 'bg' and reference\n bg_ids = np.where(mask == False)\n if ref == 'fg':\n ref_ids = np.where(mask)\n else:\n ref_ids = np.where(mask == False)\n\n # Randomization\n rnd_ids...
[ "0.6264214", "0.59360576", "0.5834285", "0.58224565", "0.5721481", "0.5679718", "0.5654434", "0.55939865", "0.55292684", "0.55275834", "0.5499133", "0.54703903", "0.5460102", "0.543918", "0.5406599", "0.5371623", "0.53477293", "0.5328869", "0.52776635", "0.52681917", "0.52578...
0.5170334
28
Damages a mask for a single object by dilating it in numpy.
def _dilate_mask(mask, dilation_radius=5): disk = morphology.disk(dilation_radius, dtype=np.bool) dilated_mask = morphology.binary_dilation( np.squeeze(mask, axis=2), selem=disk)[..., np.newaxis] return dilated_mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _damage_single_object_mask(mask, shift, scale, rotate, dilate):\n # For now we just do shifting and scaling. Better would be Affine or thin\n # spline plate transformations.\n if shift:\n mask = _shift_mask(mask)\n if scale:\n mask = _scale_mask(mask)\n if rotate:\n mask = _rotate_mask(mask)\n i...
[ "0.7115775", "0.63289875", "0.6086381", "0.5870329", "0.5732645", "0.5727857", "0.56703866", "0.5649035", "0.5612683", "0.55999976", "0.55900395", "0.5562102", "0.55520886", "0.55458033", "0.5525944", "0.5514964", "0.548503", "0.54686165", "0.54550576", "0.54230964", "0.54163...
0.5612863
8
Returns the current quorum configuration, i.e. config[i] May return if p_i is not a participant or BOTTOM during the process of a configuration reset
def get_config(self): if self.allow_reco(): return self.chs_config() else: return self.get_config_j(self.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config():\n \n logger.info('Reading current configuration...')\n dburl = dbconn.DbURL()\n array = gparray.GpArray.initFromCatalog(dburl, utility=True)\n \n master_hostname = array.master.getSegmentHostName()\n master_port = array.master.getSegmentPort()\n \n cmd = pg.ReadPostmast...
[ "0.6242041", "0.6049767", "0.60446256", "0.598099", "0.5942673", "0.5942673", "0.5852599", "0.5801146", "0.57961076", "0.5724765", "0.5715988", "0.5701836", "0.56410754", "0.5633207", "0.56322837", "0.5620723", "0.56143135", "0.5612343", "0.5583728", "0.5523893", "0.5521681",...
0.57858795
9
Returns the current quorum configuration (config[i]) to application Returns config[i] when no reconfiguration occurs or no agreement on proposal. Once participants agree on proposal, returns proposal set U current configuration.
def get_config_app(self): if self.degree(self.id) in [0, 1, 2]: return self.get_config_j(self.id) else: return list(set(self.get_config_j(self.id)) | set(self.get_prp_j(self.id)[1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)", "def configuration(self) -> Optional[pulumi.Input['BrokerConfigurationArgs']]:\n return pulumi.get(self, \"configuration\")", "def configuration(self...
[ "0.6239466", "0.60387367", "0.60387367", "0.5956868", "0.59504783", "0.5895645", "0.58602935", "0.582811", "0.5820163", "0.58134586", "0.5805068", "0.58021927", "0.57909834", "0.5775168", "0.5733354", "0.5731225", "0.573007", "0.57178", "0.5675857", "0.56626356", "0.5660312",...
0.6082164
1
Interface for RecMA to request configuration update Used to replace the configuration by the RecMA module. Proposed set must be nonempty and not the same as current conf.
def estab(self, s): logger.info("Running estab(set) with set:", s) if self.allow_reco() and (set(s) not in [set(), set(self.get_config_j(self.id))]): logger.info("estab() allowed!") self.prp[self.id] = (1, s) self.alll[self.id] = False self.all_seen = set(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conf_update(self):\n pass", "def update_config(self):\n if self.integration is None:\n return\n self.enabled = self.integration.has_option(self.get_config_name())\n self.pedantic = self.integration.configuration.get_bool(\n 'filter.mrproper')", "def fusion_...
[ "0.65515244", "0.63368267", "0.6274681", "0.6227749", "0.60530394", "0.60136694", "0.6009625", "0.5905762", "0.58097386", "0.57259136", "0.57189995", "0.5709922", "0.5694562", "0.5694562", "0.56567484", "0.56441706", "0.5640051", "0.55936855", "0.55668706", "0.55619437", "0.5...
0.0
-1
Interface for Joining mechanism to request a join for p_i.
def participate(self): if self.allow_reco(): self.config[self.id] = self.chs_config()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join ( self ) :\n raise AbstractMethodException( self , \"join\" )", "def join(self):\n pass", "def join(ctx, network, force):\n return join_wrapper(ctx.obj['client'], network, force)", "def join(self):\n if self._join_command is not None:\n return\n\n if self._j...
[ "0.6963116", "0.6169438", "0.5998683", "0.57739687", "0.5754608", "0.5668251", "0.56177", "0.5588436", "0.5514683", "0.5493263", "0.5491207", "0.5382972", "0.5371468", "0.5354688", "0.5339792", "0.5304464", "0.5298357", "0.5283666", "0.5199348", "0.5187125", "0.5181807", "0...
0.0
-1
Returns config whenever there is a single such non value. Returns BOTTOM if no config exists.
def chs_config(self): conf = set() for j in self.get_fd_j(self.id): if self.get_config_j(j) != constants.NOT_PARTICIPANT: conf |= set(self.get_config_j(j)) if conf == set(): return constants.BOTTOM else: return list(conf)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config() -> Optional[Config]:\n return CurrentConfig.get()", "def default(self):\n return self._configs[0] if len(self._configs) else None", "def getConfig(self, committed=False, ignore_last=False):\n # go back from the latest entry, find the most recent config entry\n for idx, ...
[ "0.6573118", "0.6316215", "0.62860805", "0.6104078", "0.6081168", "0.60742784", "0.6067803", "0.605521", "0.6035528", "0.6021096", "0.59994614", "0.5970423", "0.5957983", "0.59468275", "0.59468275", "0.5943898", "0.59314483", "0.5925146", "0.58585817", "0.5848977", "0.5847518...
0.5750651
100
Returns either the value stored in all[k] or if k == i, whether there exists p_l one phase "ahead" of p_i
def my_alll(self, k): all_k = self.get_all_j(k) exists_pl_ahead = False ahead = (self.get_prp_j(self.id)[0] + 1) % 3 for l in self.all_seen: if self.get_prp_j(l)[0] == ahead: exists_pl_ahead = True return all_k or ((k == self.id) and exists_pl_ahead)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_active(self, k):\n return k - self.p", "def fn(x):\n k = 0 \n for i, ch in enumerate(s): \n if mp.get(i, inf) < x: continue \n if k < len(p) and ch == p[k]: k += 1\n return k == len(p)", "def _is_polynomial(self, p, i):\n or...
[ "0.56682724", "0.55324847", "0.54159045", "0.5402462", "0.53369343", "0.52204055", "0.52181983", "0.51593745", "0.5117445", "0.5115613", "0.50642437", "0.5046544", "0.5038634", "0.50367725", "0.50101006", "0.49974707", "0.49965903", "0.49912035", "0.4976445", "0.4962322", "0....
0.7482815
0
Calculates the degree of p_k's most recently received notification Calculated as twice the notification phase plus one whenever all participants are using the same notification (0 otherwise), where each notification is a configuration replacement proposal.
def degree(self, k): one_if_my_all_k = 1 if self.my_alll(k) else 0 return (2 * self.get_prp_j(k)[0]) + one_if_my_all_k
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def langmuir_occ(p, k):\n\n intermediate = k * p\n\n occupancy = intermediate / (intermediate + 1)\n\n return occupancy", "def _calculate_probability(self,k):\n\t\tif abs(k * self.delta_x) > (3 * np.sqrt(self.variance)):\n\t\t\treturn 0.0\n\t\tbinom_coeff = special.binom(self.n,(self.n + k)/2)\n\t\tb_va...
[ "0.575358", "0.5645525", "0.5627544", "0.55538696", "0.5541306", "0.54604745", "0.54539067", "0.5432265", "0.5383388", "0.5368729", "0.5346243", "0.5339594", "0.53276587", "0.53068185", "0.52934635", "0.5250172", "0.5222444", "0.51899505", "0.51531494", "0.51329046", "0.51319...
0.64719737
0
Tests whether p_k and p_k' have degrees that differ by <= 1 Used when considering operations in mod 6
def corr_deg(self, k, k_prime): ok_deg_tups = [{0, 5}, {5, 5}] for x in range(0, 5): ok_deg_tups.append({x, x+1}) ok_deg_tups.append({x, x}) return {self.degree(k), self.degree(k_prime)} in ok_deg_tups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def echo_fun(self, k):\n same_all = self.my_alll(self.id) == self.get_echo_all_j(k)\n ok_deg = ((self.degree(k) - self.degree(self.id)) % 6) in {0, 1}\n return self.echo_no_all(k) and same_all and ok_deg", "def goodDLK_2(d,l,k) :\n if (d == 0) and ((l != 0) or (k != 3)) :\n return ...
[ "0.6549065", "0.6408314", "0.62199163", "0.6166814", "0.6073687", "0.6015139", "0.60098195", "0.5946944", "0.5922223", "0.580886", "0.5793645", "0.5749401", "0.5662234", "0.5647768", "0.5639147", "0.5632892", "0.56150824", "0.5612917", "0.5608243", "0.55855036", "0.5585182", ...
0.6567329
0
Tests whether p_i was acked by all participants for the values it has sent. Considers just the fields that are related to its own participant set and notification.
def echo_no_all(self, k): same_fd_part = set(self.get_fd_part_j(self.id)) == set(self.get_echo_part_j(k)) (phase_i, set_i) = self.get_prp_j(self.id) (phase_k, set_k) = self.get_echo_prp_j(k) same_prp = (phase_i == phase_k) and (set(set_i) == set(set_k)) return same_fd_part and sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ack_required(self):\n v = self[22]\n v = v >> 1\n return (v & 0b1) != 0", "def ack(self):\n return (self.status == self.STATUS_ACK)", "def acknowledged(self):\n ...", "def successful(self):\n return (self.power_ack & self.datarate_ack & self.channelmask_ack) == 1...
[ "0.54846966", "0.542285", "0.533005", "0.5275694", "0.51296085", "0.5083332", "0.50610894", "0.5043839", "0.5016612", "0.5011998", "0.49795997", "0.49607998", "0.4947806", "0.49460548", "0.4926226", "0.49083593", "0.4906408", "0.49044418", "0.48991197", "0.4897232", "0.488377...
0.0
-1
Tests whether p_k was acked by all participants for the values it has sent. Considers the fields that are related to its own participant set and notification as well as all[].
def echo_fun(self, k): same_all = self.my_alll(self.id) == self.get_echo_all_j(k) ok_deg = ((self.degree(k) - self.degree(self.id)) % 6) in {0, 1} return self.echo_no_all(k) and same_all and ok_deg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ack_required(self):\n v = self[22]\n v = v >> 1\n return (v & 0b1) != 0", "def ack(self):\n return (self.status == self.STATUS_ACK)", "def acknowledged(self):\n ...", "def check_saved_acks():\n log('Looking through saved ACKS')\n if (BUFFER):\n for decoded in RECEI...
[ "0.5611435", "0.5374959", "0.5341598", "0.53283286", "0.5248775", "0.5178723", "0.5162214", "0.50907016", "0.50575113", "0.50436157", "0.5031918", "0.5031193", "0.5030639", "0.5014339", "0.5008831", "0.50069094", "0.49977213", "0.49705735", "0.4849885", "0.4849865", "0.484559...
0.4488583
77
Performs the transition between phases of the delicate reconfiguration.
def increment(self, prp): (prp_phase, prp_set) = prp if prp_phase == 1: return ((2, prp_set), False) elif prp_phase == 2: return (constants.DFLT_NTF, False) else: return (self.get_prp_j(self.id), self.get_all_j(self.id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_05_node_down_and_resync_hard(self):\n for cluster in test_rest.cluster.clusters:\n if cluster == 'index':\n continue\n test_rest.db_simulate(cluster, 240)\n port = test_rest.cluster.clusters[cluster][0][0]\n test_rest.step(f'stopping cluste...
[ "0.5382239", "0.5332354", "0.529817", "0.52783895", "0.5275057", "0.52285475", "0.52197593", "0.52029765", "0.51907116", "0.5169656", "0.5154796", "0.50708884", "0.50369895", "0.5027845", "0.5020152", "0.5008651", "0.4988927", "0.4971399", "0.4971297", "0.49467748", "0.494261...
0.0
-1
Tests whether all active participants have noticed that all other participants have finished the current phase.
def all_seen_fun(self): return self.get_all_j(self.id) and \ (set(self.get_fd_part_j(self.id)) <= (self.all_seen | {self.id}))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_players_finish(self):\n return len(self.game_winners) == len(self.players)", "def is_done(self):\n return not any((agent.is_alive() for agent in self.agents))", "def is_done(self):\n return not any(agent.is_alive() for agent in self.agents)", "def is_done(self):\n return n...
[ "0.70197296", "0.6961213", "0.68932307", "0.68932307", "0.6708486", "0.6580946", "0.6557289", "0.647794", "0.647794", "0.647794", "0.647794", "0.647794", "0.647794", "0.6374831", "0.63552946", "0.63506705", "0.6344467", "0.63239634", "0.63140446", "0.6268045", "0.6217618", ...
0.0
-1
Returns maximum phase value of two processors considering mod 3 operations. Assumes that no two processors in FD[i].part have two notifications that p_i stores for which the degree differs by more than one.
def mod_max(self): phs = set() for k in self.get_fd_part_j(self.id): phs.add(self.get_prp_j(k)[0]) if (1 in phs) and (2 not in phs) and (self.get_prp_j(self.id)[0] != max(phs)): self.all_seen = set() return max(phs) else: return self.get_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_ntf(self):\n deg_diffs = set()\n for k in self.get_fd_part_j(self.id):\n deg_diff = (self.degree(k) - self.degree(self.id)) % 6\n deg_diffs.add(deg_diff)\n if not (deg_diffs <= {0, 1}):\n return self.get_prp_j(self.id)\n else:\n max_le...
[ "0.5673758", "0.5658783", "0.55484", "0.5479257", "0.533177", "0.5197469", "0.51458836", "0.50572944", "0.5057134", "0.50482756", "0.50440663", "0.5006366", "0.49880645", "0.49865636", "0.4975815", "0.4964766", "0.49578205", "0.49548864", "0.49516526", "0.49196458", "0.491935...
0.5880462
0
Selects notification with maximal lexicographical value. Returns BOTTOM in the absence of notification that is not phase 0 notification.
def max_ntf(self): deg_diffs = set() for k in self.get_fd_part_j(self.id): deg_diff = (self.degree(k) - self.degree(self.id)) % 6 deg_diffs.add(deg_diff) if not (deg_diffs <= {0, 1}): return self.get_prp_j(self.id) else: max_lex_set = const...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max(self, include_zero=False):\n for key, value in reversed(self.items()):\n if value > 0 or include_zero:\n return key", "def get_highest_priority(self):\n for i in self.query.index.values.tolist():\n if not int(self.query.loc[i,'in_%s'%self.program]):\n ...
[ "0.55475223", "0.552495", "0.5510104", "0.5480517", "0.5471584", "0.5462136", "0.5439084", "0.54091084", "0.5366987", "0.5362412", "0.5342453", "0.53143114", "0.52908576", "0.52789414", "0.5275979", "0.52707195", "0.5249729", "0.52354413", "0.52332634", "0.5227913", "0.522721...
0.5258826
16
The main loop of the Reconfiguration Stability Assurance module
def run(self, testing=False): # block until system is ready while not testing and not self.resolver.system_running(): time.sleep(0.1) while True: # Update some local variables # self.fd[self.id] = self.get_fd_j(self.id) # Algorithm 3.1 in the te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\tconnected = False\n\t# Get the values from the config file\n\tconfig = read_config()\n\t# Do the infinite(ish) internet check loop\n\twhile True:\n\t\tconnected = check_connection(connected, config)\n\t\ttime.sleep(30)", "def work(self):\n self.config_file = self.args.config\n self.i...
[ "0.6277527", "0.62423164", "0.62375265", "0.6079482", "0.60270476", "0.5973181", "0.5917289", "0.5906455", "0.5889537", "0.58889675", "0.58718526", "0.58513665", "0.58500284", "0.5829142", "0.5815654", "0.5806713", "0.58017844", "0.5792019", "0.5780087", "0.5761517", "0.57588...
0.0
-1
Stale info check type 1 Tests that all notifications of configuration proposals are valid.
def stale_info_type_1(self): for k in self.prp.keys(): if (self.get_prp_j(k)[0] == 0) and (self.get_prp_j(k)[1] != constants.BOTTOM): logger.debug("Stale info (type 1) found!") return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_config(self):", "def stale_info_type_2(self):\n config_values = self.config.values()\n bot_exists = constants.BOTTOM in config_values\n empty_exists = [] in config_values\n if bot_exists or empty_exists:\n logger.debug(f\"Stale info (type 2) found! Current config...
[ "0.60339475", "0.59377944", "0.5910291", "0.5813845", "0.56256354", "0.55865383", "0.55583864", "0.55517274", "0.5533488", "0.5477461", "0.54541314", "0.54493076", "0.535062", "0.5346866", "0.53342646", "0.53342646", "0.53342646", "0.53342646", "0.532297", "0.53192294", "0.53...
0.6215256
0
Stale info check type 2 Tests that there are no configuration conflicts or an active reset process
def stale_info_type_2(self): config_values = self.config.values() bot_exists = constants.BOTTOM in config_values empty_exists = [] in config_values if bot_exists or empty_exists: logger.debug(f"Stale info (type 2) found! Current config: {self.config}") return bot_exis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_contradictory_multiple_actions(self):\n self.render_config_template(\n modules=[{\n \"name\": \"system\",\n \"metricsets\": [\"process\"],\n \"period\": \"1s\"\n }],\n processors=[{\n \"include_fields\": {\...
[ "0.62229544", "0.6143", "0.6102025", "0.60690427", "0.6050885", "0.60290176", "0.6003052", "0.59661", "0.5961326", "0.59563583", "0.5942481", "0.5918147", "0.5906738", "0.5895629", "0.58829015", "0.5879181", "0.5837083", "0.5837083", "0.5835069", "0.5821932", "0.582185", "0...
0.62378997
0
Stale info check type 3 Tests that the phase information, including all_seen, are not out of synch
def stale_info_type_3(self): type_3_a = False type_3_b_set = set() prp_sets = [] exists_phase_2 = False for k in self.get_fd_part_j(self.id): if not self.corr_deg(self.id, k): type_3_a = True if self.get_prp_j(k)[0] == ((self.get_prp_j(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_unstaged_changes(self):\n pass", "def check_consistency(self, es):", "def test_full_house_flush_ind(self):", "def insync_and_state_check(self):\n self.step('verifying tables are properly synced on all endpoints')\n is_ok = True\n limit, count = 10, 0\n while count...
[ "0.59557796", "0.58068776", "0.5780649", "0.5647411", "0.56288046", "0.5578073", "0.55761534", "0.55458236", "0.5541266", "0.55296147", "0.5525599", "0.54691684", "0.54571563", "0.5455311", "0.5441073", "0.54253876", "0.542445", "0.53946173", "0.53917575", "0.5380218", "0.537...
0.5904927
1
Stale info check type 4 Tests that there are active participants in the config
def stale_info_type_4(self): if self.get_fd_part_j(self.id) == []: type_4_a = False else: type_4_a = True for k in self.get_fd_part_j(self.id): different_fd = self.get_fd_j(self.id) != self.get_fd_j(k) different_fd_part = self.get_fd_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_meeting_status(self):\n pass", "def test_meeting_registrant_status(self):\n pass", "def test_past_meeting_participants(self):\n pass", "def test_api_livesession_read_attendances_admin(self):\n video = VideoFactory(\n live_state=RUNNING,\n live_info={...
[ "0.61871", "0.61276037", "0.5981777", "0.5936343", "0.59027237", "0.58347964", "0.58249664", "0.57979", "0.5792451", "0.5760414", "0.5683491", "0.567219", "0.5661282", "0.5660331", "0.5652906", "0.56523436", "0.56283253", "0.56200165", "0.56166345", "0.56166345", "0.5611324",...
0.0
-1
Tests if we are in the special state where there are no participants and all FD monitors are stable
def no_participants_and_stable_fd_monitors(self): if len(self.get_fd_j(self.id)) < 1: return False for k in self.get_fd_j(self.id): if (not self.resolver.fd_stable_monitor(k)) or (self.get_config_j(k) != constants.NOT_PARTICIPANT): return False logger.debu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_device_state(self):", "def nanny(self): \n while not self.started and not self.failed:\n eventlet.sleep(.1)\n return not self.failed", "def test_verify_state_of_a_device_when_disconnected_from_the_device():", "def __bool__(self):\n return self.wait(0)", "def p...
[ "0.6425011", "0.63082165", "0.6045461", "0.59334505", "0.59191984", "0.5908985", "0.5904193", "0.5903354", "0.5896522", "0.587225", "0.581643", "0.5764986", "0.5762647", "0.57485974", "0.5692651", "0.5689246", "0.5686668", "0.5686668", "0.5686668", "0.5686668", "0.5686668", ...
0.79300994
0
Called whenever a message is received from another processor.
def receive_msg(self, msg): self.fd[self.id] = self.get_fd_j(self.id) # Update state values j = int(msg["sender"]) data = msg["data"] self.fd[j] = data["fd"] self.fd_part[j] = data["fd_part"] self.config[j] = data["config"] self.prp[j] = data["prp"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_receive(self, msg):\n raise NotImplementedError", "def receive_message(self, message):\r\n return", "def receive(self, message):", "def receive_message(self, message):", "def received_message(self, m):\n self.receiver.handle_message(m)", "def receive(self, msg):\n p...
[ "0.7862769", "0.76799077", "0.76312256", "0.7608615", "0.7607217", "0.7538339", "0.75038445", "0.74965125", "0.746925", "0.7403302", "0.73713607", "0.7350669", "0.73237234", "0.7297885", "0.7295632", "0.7285056", "0.7275669", "0.7240056", "0.7209663", "0.71553165", "0.7145084...
0.0
-1
Called by the API, used to expose data to 3rd party services.
def get_data(self): return { "fd": self.get_fd_j(self.id), "fd_part": self.get_fd_part_j(self.id), "config": self.config, # "config": self.get_config_j(self.id), "prp": self.get_prp_j(self.id), "alll": self.my_alll(self.id) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\r\n pass", "def get_data():\n pass", "def get_data(self):", "def get_data(self):\n pass", "def get_data(self):\n pass", "def get_data():\n pass", "def get_data():\n pass", "def get_data():\n pass", "def _get_data(self):\n raise NotImpl...
[ "0.70393324", "0.70280385", "0.696577", "0.6895153", "0.6895153", "0.6799701", "0.6799701", "0.6799701", "0.67311615", "0.670738", "0.66781694", "0.6561099", "0.655223", "0.6532856", "0.64652133", "0.6398914", "0.6398914", "0.6334646", "0.6334482", "0.62170565", "0.62081915",...
0.0
-1
Generate a set of random primary masses from an IMF
def get_M1(M_low=0.5, M_high=10.0, num_sys=1): C_m = 1.0 / (M_high**(c.alpha+1.0) - M_low**(c.alpha+1.0)) tmp_y = uniform(size=num_sys) return (tmp_y/C_m + M_low**(c.alpha+1.0))**(1.0/(c.alpha+1.0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def randomize(self):\n random_pfm = [[c for c in row] for row in self.pfm]\n random.shuffle(random_pfm)\n m = Motif(pfm=random_pfm)\n m.id = \"random\"\n return m", "def sample_masses(M_min=M_min, M_max=M_max, size=1):\n\n A = 1 / (1/M_min - 1/M_max)\n R = np.random.unifo...
[ "0.65151", "0.6007895", "0.5946582", "0.58961266", "0.58928275", "0.5833074", "0.58166003", "0.56992304", "0.56806356", "0.56651413", "0.5650023", "0.5640961", "0.5618418", "0.5591245", "0.55861664", "0.557171", "0.5536853", "0.55131465", "0.55063003", "0.55022585", "0.549928...
0.0
-1
Generate secondary masses from flat mass ratio
def get_M2(M1, num_sys=1): return M1*uniform(size=num_sys)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_mass(self):\n\n star = self.star\n\n M, K, N = star.mesh_size\n ph = star.phi_coords\n mu = star.mu_coords\n r = star.r_coords\n\n def Q1(j, k):\n sum = 0\n\n for i in range(0, M - 2, 2):\n sum += (1 / 6) * (ph[i + 2] - ph[i]) ...
[ "0.64000714", "0.6238822", "0.61394453", "0.61247844", "0.6120809", "0.6029744", "0.6020185", "0.60080254", "0.5945285", "0.5925701", "0.59193194", "0.5916817", "0.5915651", "0.59039074", "0.5874747", "0.5861079", "0.5851206", "0.5851057", "0.5833349", "0.5821455", "0.5799484...
0.5596177
45
Generate a set of orbital separations from a power law
def get_a(a_low=1.0e1, a_high=4.41e7, num_sys=1, alpha=-1.6, prob='log_flat'): if prob == 'log_flat': C_a = 1.0 / (np.log(a_high) - np.log(a_low)) tmp_y = uniform(size=num_sys) return a_low*np.exp(tmp_y/C_a) elif prob == 'raghavan': mu_P_orb = 5.03 sigma_P_orb = 2.28 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def algebra_generators(self):\n return self.basis().keys().semigroup_generators().map(self.monomial)", "def _orbits(degree, generators):\n\n orbs = []\n sorted_I = list(range(degree))\n I = set(sorted_I)\n while I:\n i = sorted_I[0]\n orb = _orbit(degree, generators, i)\n...
[ "0.5652893", "0.5591018", "0.55886817", "0.5511983", "0.53179085", "0.53030336", "0.5277192", "0.52234703", "0.521836", "0.5189718", "0.5187448", "0.513841", "0.51347405", "0.5111671", "0.5096825", "0.50921446", "0.5089524", "0.50467527", "0.50381434", "0.498961", "0.49811035...
0.0
-1
Return e from an input distribution
def get_e(num_sys=1, prob='thermal'): if prob == 'thermal': return np.sqrt(uniform(size=num_sys)) elif prob == 'flat': return uniform(size=num_sys) elif prob == 'circular': return np.zeros(num_sys) elif prob == 'tokovinin': # From Tokovinin & Kiyaeva (2016), MNRAS 456 r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def e(self):\n if self._e is None:\n # self._e = self.distributions.uniform(0.3,0.33)\n # return self._e\n # max is set by q but also limited by users choice of e_max.\n res_a = 29.9*((self.j[0]/self.k[0])**(2/3))\n q = self.distributions.truncated_norm...
[ "0.7415424", "0.7137588", "0.71217835", "0.695846", "0.6825506", "0.63998413", "0.6388059", "0.6343656", "0.6254818", "0.62431073", "0.6239055", "0.6230489", "0.62157154", "0.62043214", "0.6115948", "0.6113689", "0.6105811", "0.6094007", "0.6073158", "0.60673875", "0.60582536...
0.7340206
1
Random arguments of periapse
def get_omega(num_sys=1): return 2.0*np.pi*uniform(size = num_sys)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_params(self, randomize=True):\n pass", "def get_random_individual():\r\n return [ random.random() for _ in range(PARAMETERS_COUNT) ]", "def __init__(self, p=0.5):\n assert 0. <= p <= 1.\n self.p = p\n self.rng = T.shared_randomstreams.RandomStreams(seed=123456)\n self.params ...
[ "0.6938783", "0.6491806", "0.63690495", "0.63165206", "0.6313736", "0.62580925", "0.6256701", "0.622051", "0.62057483", "0.62039655", "0.62012607", "0.61541957", "0.61290187", "0.61183494", "0.61082566", "0.6094903", "0.60927033", "0.6087658", "0.60800815", "0.60666597", "0.6...
0.0
-1
Random longitudes of the ascending node
def get_Omega(num_sys=1): return 2.0*np.pi*uniform(size = num_sys)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_lat_lon(self):\n delta = round(random.random() * random.randint(1, 4), 4)\n sign = random.randint(1, 100)\n if sign % 2 == 0:\n self.lat += delta\n else:\n self.lat -= delta\n\n delta = round(random.random() * random.randint(1, 4), 4)\n sign =...
[ "0.74656385", "0.6945643", "0.68974334", "0.68718785", "0.68526447", "0.6818553", "0.6602211", "0.64611965", "0.6382285", "0.63493824", "0.63344187", "0.6205524", "0.6155454", "0.6045223", "0.6034526", "0.6026114", "0.60254955", "0.60047567", "0.5951849", "0.5941057", "0.5939...
0.0
-1
Wrapper to generate num_sys number of random binaries
def create_binaries(num_sys=1, ecc_prob='thermal', a_prob='log_flat'): M1 = get_M1(num_sys=num_sys) M2 = get_M2(M1, num_sys=num_sys) a = get_a(num_sys=num_sys, prob=a_prob) e = get_e(num_sys=num_sys, prob=ecc_prob) M = get_M(num_sys=num_sys) omega = get_omega(num_sys=num_sys) Omega = get_Om...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate() -> int:\n return randint(0, 1000000000)", "def generate_random_num():\n return (long(hexlify(urandom(7)), 16) >> 3) * 2**(-53)", "def generate_raiz():\n\treturn os.urandom(12)", "def _gen_random_number() -> float:\n return uniform(0, 1000)", "def _generate_raw_environments(self,...
[ "0.66994655", "0.6487863", "0.61182594", "0.60619056", "0.6048561", "0.60208446", "0.6018677", "0.5972783", "0.5968178", "0.5900481", "0.5897057", "0.5803381", "0.57801616", "0.5762383", "0.5755088", "0.5753558", "0.57464737", "0.5703544", "0.5691936", "0.5663027", "0.5659972...
0.5641367
22
Orbital period (days) to separation (Rsun)
def P_to_a(M1, M2, P): mu = c.GGG * (M1 + M2) * c.Msun_to_g n = 2.0*np.pi / P / c.day_to_sec return np.power(mu/(n*n), 1.0/3.0) / c.Rsun_to_cm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _period( self ):\r\n\treturn 2 * pi * sqrt( self.orbital_elements[0]**3 / self.mu_central_body )\r\n\t# http://en.wikipedia.org/wiki/Orbital_period#Calculation\r", "def orbitalPeriod_fromRad(r, muPlanet = 3.986e14):\n\tt = 2*np.pi*np.sqrt(r**3/muPlanet)\n\treturn t", "def period(self) -> int:", "def do_d...
[ "0.669264", "0.6487234", "0.6137466", "0.59712", "0.5787186", "0.5787186", "0.5583346", "0.55811644", "0.55696404", "0.5547855", "0.5490516", "0.54747593", "0.54678684", "0.54668385", "0.54651695", "0.5447805", "0.54459494", "0.54388714", "0.54260975", "0.53886", "0.5387826",...
0.0
-1
Orbital separation (Rsun) to period (days)
def a_to_P(M1, M2, a): mu = c.GGG * (M1 + M2) * c.Msun_to_g n = np.sqrt(mu/(a**3 * c.Rsun_to_cm**3)) return 2.0*np.pi / n / c.day_to_sec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _period( self ):\r\n\treturn 2 * pi * sqrt( self.orbital_elements[0]**3 / self.mu_central_body )\r\n\t# http://en.wikipedia.org/wiki/Orbital_period#Calculation\r", "def orbitalPeriod_fromRad(r, muPlanet = 3.986e14):\n\tt = 2*np.pi*np.sqrt(r**3/muPlanet)\n\treturn t", "def phase_to_day(phase):\n if phase...
[ "0.6482488", "0.6414512", "0.62869877", "0.62869877", "0.6130169", "0.59887373", "0.5953878", "0.58666456", "0.5859269", "0.5816153", "0.57685345", "0.5627325", "0.5604342", "0.55974203", "0.55968726", "0.5568787", "0.554821", "0.55030775", "0.54587173", "0.5448637", "0.54360...
0.0
-1
Function to get the true anomaly
def get_f(M, e): # Get eccentric anomaly def func_E(x,M,e): return M - x + e*np.sin(x) E = newton(func_E, 0.5, args=(M,e)) # Get true anomaly from eccentric anomaly f = np.arccos((np.cos(E)-e)/(1.0-e*np.cos(E))) if np.sin(E) < 0: f = 2.0*np.pi - f return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anomaly(self):\n return self._anomaly(result_count=1, failure_amount=1)", "def anomaly():\n\n #Load anomaly dataset\n anomaly_data = LoadDataset(\"dataset/kaggle_anomalies/\",0)\n anomaly_data, anomaly_label, val, val_label = anomaly_data.load_data()\n for i in range (len(anomaly_label)):\n ...
[ "0.81399435", "0.642333", "0.6417571", "0.63595444", "0.6152872", "0.61317694", "0.61164016", "0.6031858", "0.6018328", "0.59970033", "0.59798664", "0.59798664", "0.59798664", "0.5977451", "0.59740037", "0.59740037", "0.59740037", "0.5964329", "0.59347373", "0.591814", "0.589...
0.0
-1
Function to get the projected physical separation
def get_proj_sep(f, e, sep, Omega, omega, inc): sep_x = sep*(np.cos(Omega)*np.cos(omega+f) - np.sin(Omega)*np.sin(omega+f)*np.cos(inc)) sep_y = sep*(np.sin(Omega)*np.cos(omega+f) + np.cos(Omega)*np.sin(omega+f)*np.cos(inc)) proj_sep = np.sqrt(sep_x**2 + sep_y**2) return proj_sep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def separation_radius(self, z_cm):\n # Calculate the separation given an array of redshift values\n # if z_cm is None:\n # z_cm = utils.log_zgrid([0.1, 3.5], 0.01)\n\n dr_cm = WMAP9.kpc_comoving_per_arcmin(z_cm).to(u.Mpc/u.arcsec)\n\n # density\n # dz_thresh = 0.01 # ...
[ "0.58315927", "0.58251774", "0.55857515", "0.5570805", "0.55141634", "0.55076575", "0.5486175", "0.5476776", "0.54566306", "0.5429258", "0.5419415", "0.537922", "0.5353704", "0.5334152", "0.5314451", "0.531292", "0.5310104", "0.52699727", "0.5269345", "0.52328557", "0.5232355...
0.55784225
3
Return the tangential peculiar velocity
def get_delta_v_tot(f, e, a, P): coeff = (2.0*np.pi/P) * a / np.sqrt(1.0 - e*e) delta_v_tot = coeff * (1.0 + 2.0*e*np.cos(f) + e*e) / 1.0e5 return delta_v_tot
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_velocity(self):\n return self.momentum/self.mass", "def getVelocity(self):\n\t\tif len(self.prevPositions) < 2:\n\t\t\tself.velocity = 0\n\t\telse:\n\t\t\ttime = self.position[2] - self.prevPositions[len(self.prevPositions)-1][2]\n\t\t\txdist = self.position[0][0] - self.prevPositions[len(self.pre...
[ "0.720252", "0.718206", "0.7076089", "0.67346025", "0.6688718", "0.6685318", "0.6683201", "0.6683015", "0.66693825", "0.66693825", "0.66656214", "0.6619844", "0.66111654", "0.6599508", "0.6594819", "0.656926", "0.6568828", "0.6567502", "0.65587795", "0.65563166", "0.6552568",...
0.0
-1
Return the tangential peculiar velocity
def get_delta_v_trans(f, e, a, P, Omega, omega, inc): # r_dot = a * e * np.sin(f) / np.sqrt(1.0 - e*e) * (2.0*np.pi/P) # r_f_dot = a / np.sqrt(1.0 - e*e) * (1.0 + e*np.cos(f)) * (2.0*np.pi/P) # delta_vel_1 = r_dot * (np.cos(Omega)*np.cos(omega+f) - np.sin(Omega)*np.sin(omega+f)*np.cos(inc)) # delta_vel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_velocity(self):\n return self.momentum/self.mass", "def getVelocity(self):\n\t\tif len(self.prevPositions) < 2:\n\t\t\tself.velocity = 0\n\t\telse:\n\t\t\ttime = self.position[2] - self.prevPositions[len(self.prevPositions)-1][2]\n\t\t\txdist = self.position[0][0] - self.prevPositions[len(self.pre...
[ "0.7203267", "0.71829313", "0.70765245", "0.6734887", "0.6685064", "0.668375", "0.6683103", "0.66702276", "0.66702276", "0.66659766", "0.6620383", "0.6611471", "0.65995187", "0.65948755", "0.65696913", "0.65692496", "0.6567785", "0.6559351", "0.6556902", "0.65530384", "0.6522...
0.6689094
4
From the random orbits, calculate the projected separation, velocity
def calc_theta_delta_v_trans(M1, M2, a, e, M, Omega, omega, inc): # Calculate f's num_sys = len(M1) f = np.zeros(num_sys) for i in np.arange(num_sys): f[i] = get_f(M[i], e[i]) # Calculate separations - in Rsun sep = a * (1.0 - e*e) / (1.0 + e*np.cos(f)) proj_sep = get_proj_sep(f, e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orbit_posvel(Ms,eccs,semimajors,mreds,obspos=None):\n\n Es = Efn(Ms,eccs) #eccentric anomalies by interpolation\n\n rs = semimajors*(1-eccs*np.cos(Es))\n nus = 2 * np.arctan2(np.sqrt(1+eccs)*np.sin(Es/2),np.sqrt(1-eccs)*np.cos(Es/2))\n\n xs = semimajors*(np.cos(Es) - eccs) #AU\n ys = sem...
[ "0.63251454", "0.6273948", "0.6188891", "0.6090473", "0.5994018", "0.59354585", "0.58900326", "0.585876", "0.5821824", "0.5773603", "0.5721551", "0.5704402", "0.56722057", "0.56588554", "0.5617459", "0.5591772", "0.55805904", "0.556481", "0.55638385", "0.5555641", "0.5554868"...
0.0
-1
From the random orbits, calculate the projected separation, velocity
def calc_theta_delta_v_trans_MOND(M1, M2, a, e, M, Omega, omega, inc): # Acceleration constant for MOND a0 = 1.2e-8 # From Scarpa et al. (2017), MOND acts at separations larger than 7000 AU a_limit = 7000.0 * c.AU_to_cm # Calculate f's num_sys = len(M1) f = np.zeros(num_sys) proj_sep ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orbit_posvel(Ms,eccs,semimajors,mreds,obspos=None):\n\n Es = Efn(Ms,eccs) #eccentric anomalies by interpolation\n\n rs = semimajors*(1-eccs*np.cos(Es))\n nus = 2 * np.arctan2(np.sqrt(1+eccs)*np.sin(Es/2),np.sqrt(1-eccs)*np.cos(Es/2))\n\n xs = semimajors*(np.cos(Es) - eccs) #AU\n ys = sem...
[ "0.6325394", "0.6273604", "0.61889213", "0.60910815", "0.5992941", "0.5935161", "0.5889572", "0.5858033", "0.5822188", "0.57730037", "0.5721572", "0.57053345", "0.567247", "0.5658431", "0.56169254", "0.5591375", "0.5579938", "0.5565701", "0.55635047", "0.5555609", "0.55549604...
0.0
-1
This function calculates the probability of a random star having the observed proper motion
def get_P_binary(proj_sep, delta_v_trans, num_sys=100000, method='kde', kde_method='sklearn'): # Catalog check global binary_set if binary_set is None: generate_binary_set(num_sys=num_sys) if method is 'kde': # Use a Gaussian KDE global binary_kde #if binary_kde is Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_probability(self):\n return 0", "def p(self) -> Probability:\n ...", "def prob1(n):\n#raise NotImplementedError(\"Problem 1 Incomplete\")\n if n == 0 :\n raise ValueError(\"Sampling 0 points is not defined.\")\n total = 0\n for i in xrange(n) :\n if np.random....
[ "0.6616909", "0.66122586", "0.65956324", "0.65656006", "0.6558705", "0.6527563", "0.65138316", "0.6502501", "0.63788253", "0.6353283", "0.6345645", "0.6345645", "0.6343374", "0.6284382", "0.62379724", "0.62123704", "0.61686015", "0.61510676", "0.61377114", "0.6118212", "0.610...
0.0
-1
This function calculates the probability of a random star having the observed proper motion
def get_P_binary_v_tot(proj_sep, delta_v_tot, num_sys=100000): # Catalog check global binary_set if binary_set is None: generate_binary_set(num_sys=num_sys) # Use a Gaussian KDE global binary_v_tot_kde # We work in log space for the set of binaries if binary_v_tot_kde is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_probability(self):\n return 0", "def p(self) -> Probability:\n ...", "def prob1(n):\n#raise NotImplementedError(\"Problem 1 Incomplete\")\n if n == 0 :\n raise ValueError(\"Sampling 0 points is not defined.\")\n total = 0\n for i in xrange(n) :\n if np.random....
[ "0.6616407", "0.6611605", "0.6594753", "0.6565147", "0.6557539", "0.65286505", "0.65132105", "0.6502074", "0.6378543", "0.63531625", "0.6344999", "0.6344999", "0.6343321", "0.62833744", "0.62366265", "0.6212156", "0.61679083", "0.61501026", "0.613744", "0.61175925", "0.610784...
0.0
-1
Create set of binaries to be saved to P_binary.binary_set
def generate_binary_set(num_sys=100000, ecc_prob='thermal', a_prob='log_flat', method='kepler'): global binary_set if method != 'kepler' and method != 'MOND': print("You must provide a valid method.") return # Create random binaries M1, M2, a, e, M, Omega, omega, inc = create_binaries...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createBinObjects(n):\n bins = []\n for i in range(n):\n \tbins.append(Bin())\n return bins", "def get_binaries(kdb,entry):\n xml = objectify.fromstring(entry.dump_xml())\n binaries = list(xml.xpath('./Binary'))\n for binary in binaries:\n yield (binary.Key.text, Binary(kdb,binary)...
[ "0.5964837", "0.59422576", "0.5907919", "0.58536303", "0.5810957", "0.55953133", "0.5575792", "0.5559989", "0.5528495", "0.54272175", "0.54035234", "0.5372073", "0.5370181", "0.5360584", "0.5342469", "0.5317253", "0.53051674", "0.52968377", "0.5291435", "0.5269143", "0.525454...
0.6768494
0
This function calculates the binary prior
def get_prior_binary(ra, dec, mu_ra, mu_dec, t, sigma_pos=None, sigma_mu=None): if sigma_pos is None: sigma_pos = P_random.get_sigma_pos(ra, dec, catalog=t) if sigma_mu is None: sigma_mu = P_random.get_sigma_mu(mu_ra, mu_dec, catalog=t) C2_prior = sigma_pos * sigma_mu * len(t) * c.f_bin return C2_pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bias_prior(self):", "def prior(old_params,params):\n \n for s in range(len(params)):\n if params[s] < 0.0 or params[s] > 2:\n return 0\n return 1", "def lnprior(params):\n a, b, f = params\n if -10.0 < b < 0. and 0. < a < 10 and 0. < f:\n return 0.0\n\n return -np...
[ "0.7155866", "0.699966", "0.6571168", "0.6567543", "0.64442766", "0.63115424", "0.6297148", "0.6282599", "0.6273565", "0.6272402", "0.62659776", "0.6243217", "0.62369555", "0.6232393", "0.6206088", "0.61796415", "0.61197674", "0.6055244", "0.6032322", "0.60282356", "0.6008326...
0.6521243
4
Create a set of random binaries and plot the distribution of resulting theta vs pm
def create_plot_binary(dist=100.0, num_sys=100, bins=25): global binary_set if binary_set is None or len(binary_set) != num_sys: generate_binary_set(num_sys=num_sys, dist=dist) fig, ax1 = plt.subplots(1,1, figsize=(6,4)) # Plot limits xmin, xmax = 0.0, 5000.0 ymin, ymax = 0.0, 3.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_rand(txyxidata, b,X, outfile):\r\n\t\r\n\tme = \"LE_Plot.plot_rand: \"\r\n\tif os.path.isfile(outfile): return me+\"skip\"\r\n\tt0 = time.time()\r\n\tshowplot = False\r\n\t\r\n\tt, x, eta, xi = txyxidata\r\n\tdel txyxidata\r\n\ttmax = np.ceil(t.max())\r\n\t\r\n\t## Plot walk\r\n\tfs = 25\r\n\twinsize = in...
[ "0.6268543", "0.614437", "0.5935378", "0.59198856", "0.59051406", "0.58652925", "0.5832034", "0.58278227", "0.57644266", "0.5739203", "0.57001245", "0.56712866", "0.5613258", "0.56017554", "0.5589682", "0.5588418", "0.5587215", "0.5586687", "0.55653733", "0.55634075", "0.5549...
0.5565269
19
The main clustering algorithm "Adaptive Density Level Set Clustering"
def cluster(name, epsilon: float, delta: float, tau: float, tree_structure='automatic', threads=1, sequential_search_threshold=2000, return_list=False, epsilon_multiple=None, output_name=None): global dataListGlobal, index_inverse_global if output_name is None: output_name = get_filename(na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self):\n self.cluseter_agglomerative(n_clusters=20, linkage='average', iterate=5)\n self.sub_clustering(n_clusters=3, index_cluster=[79], linkage='complete')\n self.merge_clusters([[0,9,53],[1,83],[46,35,67],[88,23],[6,68]])\n self.merge_clusters([[6,33,52],[17,14]])\n se...
[ "0.71741533", "0.67322356", "0.6666687", "0.65774506", "0.65705204", "0.65535855", "0.65231776", "0.65206176", "0.65019965", "0.64918864", "0.6490709", "0.64769727", "0.64763695", "0.6370144", "0.63568753", "0.6326915", "0.63129586", "0.6295431", "0.62900186", "0.6275923", "0...
0.0
-1
Test parsing a NatNet 3.0 packet containing an EchoRequest message.
def test_parse_echorequest_packet_v3(): data = open('test_data/echorequest_packet_v3.bin', 'rb').read() echo_request = deserialize(data, Version(3), strict=True) # type: EchoRequestMessage assert echo_request.timestamp == 278554190
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nmap_icmp_echo_request(self):\n assert_equal(self.test_nmap.ICMP_ECHO_REQUEST, 8)", "def test_serialize_echorequest_message():\n expected = open('test_data/echorequest_packet_v3.bin', 'rb').read()\n actual = serialize(EchoRequestMessage(278554190))\n\n assert actual == expected", "def ...
[ "0.6922761", "0.645755", "0.62202394", "0.61036783", "0.6077745", "0.5845379", "0.561444", "0.56112283", "0.5592843", "0.5554618", "0.55424106", "0.5531693", "0.55176955", "0.5470128", "0.5331703", "0.52536505", "0.5216656", "0.52039826", "0.5197637", "0.5129498", "0.5113845"...
0.78382856
0
Test serializing an EchoRequest message.
def test_serialize_echorequest_message(): expected = open('test_data/echorequest_packet_v3.bin', 'rb').read() actual = serialize(EchoRequestMessage(278554190)) assert actual == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_echorequest_packet_v3():\n data = open('test_data/echorequest_packet_v3.bin', 'rb').read()\n echo_request = deserialize(data, Version(3), strict=True) # type: EchoRequestMessage\n\n assert echo_request.timestamp == 278554190", "def test_to_from_bytes(self):\n self.assertIsInstance...
[ "0.6572642", "0.61764574", "0.6086326", "0.59407955", "0.5922413", "0.58965194", "0.58927226", "0.5885049", "0.5877283", "0.5793095", "0.5780958", "0.57690734", "0.5724307", "0.5715814", "0.571562", "0.56420356", "0.5629515", "0.5627429", "0.56192356", "0.56028426", "0.559966...
0.802424
0
Read the `file_name` and return a list of words.
def get_word_bank(file_name: str = "word_bank.txt") -> list[str]: txt_file = Path(__file__).parent / file_name return [x.strip() for x in txt_file.read_text().splitlines() if x.strip()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words_in_file(file_name):\n\n\tlines = get_file_contents(file_name)\n\tall_words = []\n\tfor line in lines:\n\t\t# remove lines that don't have words on them\n\t\tif len(line) < 2:\n\t\t\tcontinue\n\t\tline = line.rstrip() # removes \\n at the end of each line\n\t\twords = line.split()\n\t\tfor word in wor...
[ "0.8380143", "0.8295852", "0.82919544", "0.8151556", "0.80914605", "0.80806166", "0.79787743", "0.7968935", "0.7963683", "0.79565525", "0.7956438", "0.79367113", "0.79367113", "0.7934003", "0.7849445", "0.7846242", "0.7816437", "0.7779671", "0.77628523", "0.7730976", "0.77243...
0.7516058
34
Returns the library context used in this discovery context.
def get_library_context(cls) -> tlib.LibraryContext: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context(self):\n LOGGER.debug('Getting context: %s', self._context)\n return self._context", "def context(self):\n return self._context", "def context(self):\n return self._context", "def context(self):\n return self._context", "def context(self):\n return self...
[ "0.667756", "0.66378725", "0.66378725", "0.66378725", "0.66378725", "0.66378725", "0.66378725", "0.66378725", "0.663065", "0.66174483", "0.6544556", "0.649594", "0.6494292", "0.6387364", "0.63614374", "0.63529253", "0.6344479", "0.63225037", "0.63176763", "0.6317549", "0.6312...
0.77775526
0
Given an item path, yields all valid meta file paths that could provide direct metadata for that item. This also verifies that all of the resulting meta file paths exist.
def meta_files_from_item(cls, rel_item_path: pl.Path) -> tt.PathGen: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_from_meta_file(cls, rel_meta_path: pl.Path) -> tt.PathMetadataPairGen:\n pass", "def items_from_meta_file(cls, rel_meta_path: pl.Path) -> tt.PathMetadataPairGen:\n rel_meta_path, abs_meta_path = library_context.co_norm(rel_sub_path=rel_meta_path)\n\n # Check that the provid...
[ "0.66138536", "0.6287318", "0.5991842", "0.59201646", "0.55912", "0.55242085", "0.53850317", "0.536932", "0.535586", "0.5347209", "0.53227246", "0.5274453", "0.5271265", "0.5266176", "0.51852953", "0.5179801", "0.51075685", "0.5093312", "0.50908816", "0.5088963", "0.50860953"...
0.7029848
0
Given a meta file path, yields all item paths that this meta file provides metadata for, along with the metadata itself.
def items_from_meta_file(cls, rel_meta_path: pl.Path) -> tt.PathMetadataPairGen: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta_files_from_item(cls, rel_item_path: pl.Path) -> tt.PathGen:\n pass", "def items_from_meta_file(cls, rel_meta_path: pl.Path) -> tt.PathMetadataPairGen:\n rel_meta_path, abs_meta_path = library_context.co_norm(rel_sub_path=rel_meta_path)\n\n # Check that the provided path exis...
[ "0.6940595", "0.69089586", "0.6876326", "0.64572424", "0.628037", "0.62579995", "0.5958289", "0.5942649", "0.59193397", "0.59042585", "0.587694", "0.5822334", "0.57854456", "0.5695793", "0.56426466", "0.5638825", "0.5620414", "0.56117773", "0.55844843", "0.55390435", "0.55067...
0.71756345
0
Given a meta file path, yields all item paths that this meta file provides metadata for, along with the metadata itself.
def items_from_meta_file(cls, rel_meta_path: pl.Path) -> tt.PathMetadataPairGen: rel_meta_path, abs_meta_path = library_context.co_norm(rel_sub_path=rel_meta_path) # Check that the provided path exists and is a file. if not abs_meta_path.is_file(): msg = f'Meta file ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_from_meta_file(cls, rel_meta_path: pl.Path) -> tt.PathMetadataPairGen:\n pass", "def meta_files_from_item(cls, rel_item_path: pl.Path) -> tt.PathGen:\n pass", "def _walk_dir_meta(self):\n for key, child in sorted(self._children.items()):\n if isinstance(child, PackageE...
[ "0.7175146", "0.69405776", "0.6876897", "0.64581895", "0.6280624", "0.6258256", "0.5957642", "0.5943421", "0.5919406", "0.59043944", "0.5877299", "0.5823322", "0.5785377", "0.5695088", "0.5643666", "0.563889", "0.56202036", "0.5613605", "0.55839753", "0.5538756", "0.5506507",...
0.69089144
2
Set figure dimensions to sit nicely in our document.
def set_size(width_pt=430.00462, fraction=1, subplots=(1, 1), golden_ratio=1): # Width of figure (in pts) fig_width_pt = width_pt * fraction # Convert from pt to inches inches_per_pt = 1 / 72.27 # Golden ratio to set aesthetic figure height # golden_ratio = (5**.5 - 1) / 2 # Figure width i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_figure_size(self):\n lims, _ = self.set_lims()\n size_fac = 50\n paperSizeFac = 0.65\n one_dec = 1.6\n xdecs = np.log10(lims(1)) - np.log10(lims(0))\n one_dec = one_dec * 4 / xdecs\n ydecs = np.log10(lims[3]) - np.log10(lims[2])\n paper_width = xdecs ...
[ "0.7354754", "0.68874747", "0.6691664", "0.6680031", "0.66291857", "0.65430367", "0.65289485", "0.64953256", "0.6470769", "0.6351633", "0.63221294", "0.63212305", "0.6305874", "0.6265708", "0.6263046", "0.6263046", "0.6263046", "0.62619877", "0.6215848", "0.62117124", "0.6204...
0.6455241
9
Given an (n x 2) matrix of (x, y) ordered pairs, return an (n x n x 2) matrix M of differences so that m_{j,k} = x_j x_k.
def build_difs_matrix(xs): n = len(xs) difs = np.zeros((n, n, 2)) for row_id in range(n): ident = -np.eye(n) ident[:, row_id] += 1 difs[row_id, :, 0] = ident @ xs[:, 0] difs[row_id, :, 1] = ident @ xs[:, 1] return difs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def det_matrix_2x2(m: list):\n return m[0][0]*m[1][1] - m[0][1]*m[1][0]", "def delta_matrix(x, y=None):\n # 1 x N x D (1 x N if we view the last axis as a whole)\n if type(y) == type(None):\n y = x\n x = np.expand_dims(x, axis=0)\n y = np.expand_dims(y, axis=0)\n return np.moveaxis(x, 0,...
[ "0.6474755", "0.5953065", "0.5938427", "0.5882346", "0.5844783", "0.5815114", "0.57700604", "0.568207", "0.56775004", "0.562826", "0.55804396", "0.5579718", "0.55030394", "0.5438494", "0.5408733", "0.5406271", "0.5398787", "0.5398416", "0.53746647", "0.5368937", "0.53512144",...
0.0
-1
Compute the righthand side for the 1st order
def rhs1(t, state): # Get the number of prey n = (len(state) // 2) - 1 # Extract the prey positions xs = state[2:].reshape(n, 2) # Extract the predator position z = state[:2] # Compute the differences between the prey # positions and the predator positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orig(side):\n return (side + 1) % 3 # ccw(side)", "def left (x):\n\n return Sinary(side(x.v,1))", "def right (x):\n\n return Sinary(side(x.v,0))", "def _right(self, index):\r\n return 2*index + 2", "def _right(self, col, row):\n ones = 0\n twos = 0\n for st...
[ "0.6480988", "0.62802595", "0.623735", "0.6105407", "0.6098619", "0.6089276", "0.6055689", "0.60474217", "0.60154814", "0.59407306", "0.59407306", "0.5914894", "0.590506", "0.5880765", "0.5880765", "0.5871038", "0.5866244", "0.58380574", "0.58325565", "0.58253336", "0.5812927...
0.0
-1
Wrapper for scipy.integrate.solve_ivp that uses tqdm to monitor progress.
def solve_ivp_tqdm(fun, t_span, y0, t_eval, **kwargs): sol = None n = len(t_eval) - 1 for i in tqdm(range(n)): t0 = t_eval[i] tf = t_eval[i + 1] s = solve_ivp(fun, [t0, tf], y0, t_eval=[t0, tf], **kwargs) y0 = s.y[:, 1] if sol is None: sol = s else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tqdm(*args, **kwargs):\n kwargs_ = dict(file=sys.stdout, disable=C.DISPLAY.PROGRESS.DISABLE, leave=False)\n kwargs_.update(kwargs)\n clear_tqdm()\n return tq.tqdm(*args, **kwargs_)", "def __call__(self, pv, sp, dt, freeze_ff=False): \n error = sp - pv\n if not freeze_ff:\n ...
[ "0.57856476", "0.54917467", "0.54638255", "0.5340637", "0.53261566", "0.5145216", "0.51342434", "0.5121947", "0.51104546", "0.5110409", "0.50878906", "0.5081126", "0.503787", "0.50289875", "0.49790072", "0.49576634", "0.49356022", "0.49148926", "0.49119833", "0.49048683", "0....
0.67726123
0
Bake the simulation for figure 2 from the paper.
def bake_regimes_figure(): d = {'n': 400, # 400, 'a': 1, 'b': 0.2, 'p': 3, 'cs': np.asarray([0.15, 0.4, 0.8, 1.5, 2.5]), 'times': np.asarray([[0, 45, 55, 60, 70, 80, 100], [0, 0.35, 0.85, 2.35, 4.85, 9.85, 21.05], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulationTwoDrugsDelayedTreatment():\n\n # TODO", "def make_simulation(self):\n pass", "def Main():\n numberOfPopulation = 350\n numberOfDays = 60\n \n simulation = Simulation(Covid19(), numberOfPopulation, numberOfDays, \"Covid 19 Simulation\")\n simulation.run() \n simulat...
[ "0.65148926", "0.60968244", "0.60415083", "0.59246224", "0.5909946", "0.5894872", "0.5844042", "0.5806909", "0.5765315", "0.57645464", "0.57575774", "0.5751835", "0.574717", "0.5740862", "0.57390875", "0.5732647", "0.57138056", "0.5709134", "0.56926733", "0.568895", "0.567669...
0.52665377
93
Return (left, right) and (bottom, top) tuples specifying a square viewport of sidelength `width` centered at `center`.
def compute_xy_lims(center, width): x, y = center w2 = width / 2 return (x - w2, x + w2), (y - w2, y + w2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(width, height):\n return width/2, height/2", "def get_bottom_center(left, right):\n x = (right.x - left.x) / 2 + left.x\n y = right.y - (right.y - left.y) / 5\n return (x, y)", "def center2corner(center):\n x, y, w, h = center[0], center[1], center[2], center[3]\n x1 = x - w * ...
[ "0.69217473", "0.6217429", "0.6214814", "0.613843", "0.6086448", "0.6063258", "0.6029447", "0.59973025", "0.59623396", "0.59502745", "0.59427935", "0.5881541", "0.587597", "0.5813926", "0.5798873", "0.57948077", "0.57931226", "0.5784657", "0.57794344", "0.57760435", "0.575416...
0.62433493
1
Set the viewport to be a square of sidelength `width` centered at the mean of the data.
def set_ax_lims(ax, xs, ys, width=2.5): center = (xs.mean(), ys.mean()) xlim, ylim = compute_xy_lims(center, width) ax.set_xlim(xlim) ax.set_ylim(ylim)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def set_width(self, width):\n...
[ "0.5904734", "0.5904734", "0.5904734", "0.5904734", "0.5904734", "0.5904734", "0.5904734", "0.5904734", "0.5904734", "0.5904734", "0.5904734", "0.5809414", "0.5734108", "0.5702411", "0.569464", "0.568543", "0.56622624", "0.5616756", "0.56004506", "0.5594036", "0.5594036", "...
0.0
-1
Replicate figure 2 from the paper.
def make_regimes_figure(): d = pickle.load(open('regimes.pickle', 'rb')) fig, ax_matrix = plt.subplots(*d['times'].shape, figsize=set_size(fraction=1, subplots=d['times'].shape)) for row_id, (axes, c, ts) in enumerate(zip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fig_2():\n epoch = 3\n N = 60000\n Nr = N\n K = 32\n n_iter = 256\n Nstar = 16\n data = 'dr10'\n factor = 100.\n features = ['psf_mag', 'model_colors', 'psf_minus_model']\n filters = ['r', 'ug gr ri iz', 'ugriz']\n message = 'pm_mc_pmm_r_all_all'\n model = 'xdmodel_%s_%d_%d_...
[ "0.5918637", "0.59148043", "0.5729256", "0.5667046", "0.5649839", "0.5555471", "0.5472683", "0.5443591", "0.5438068", "0.54345113", "0.5421252", "0.53784335", "0.5355207", "0.5343826", "0.5295455", "0.52814543", "0.5265556", "0.52616036", "0.5235621", "0.51987725", "0.5197005...
0.0
-1
prevedeni obrazku na cernobily
def greyScale(img, shape): s, v = shape greyPicture = [sum(img[i]) / 3 for i in range(v * s)] return greyPicture
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mezclar_bolsa(self):", "def cliquer_sur_unité(self):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def podziel(self):\n def fraktal(dlugosc, alpha, poziom):\n \"\"\"Metoda wyznaczajaca fr...
[ "0.6707366", "0.6552483", "0.6486341", "0.6486341", "0.6486341", "0.6486341", "0.6486341", "0.6212716", "0.5865186", "0.5821931", "0.5794412", "0.57473534", "0.5747329", "0.5704396", "0.56910485", "0.56881607", "0.56881607", "0.56881607", "0.56881607", "0.56881607", "0.568816...
0.0
-1
anisotropic filtering of image
def anisotropie(img, shape, lambdaValue=0.1, sigma=0.015): h, w = shape newPicture = copy.copy(img) for row in range(1, h - 1): for column in range(1, w - 1): north = float(img[(row - 1) * w + column]) south = float(img[(row + 1) * w + column]) west = float(img[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_filter(self, image):\n pass", "def custom_filter(image: Image) -> Image:\n image = image.filter(ImageFilter.Kernel(\n size=(3, 3), kernel=(1, 0, 1, 0, 0, 0, 1, 0, 1)))\n return image", "def filter_image(img):\n return cv2.bilateralFilter(img, 9, 50, 50)", "def filtering(self)...
[ "0.7440313", "0.7173908", "0.70498675", "0.6904407", "0.6758465", "0.67095786", "0.6634642", "0.6616985", "0.6608021", "0.6580589", "0.65700567", "0.6567188", "0.65615916", "0.6527729", "0.65277004", "0.6503931", "0.64302045", "0.64226204", "0.6419179", "0.6396645", "0.638951...
0.6093233
39
Updates the metric with given true and predicted value for a timestep.
def update(self, y_true, y_pred): self.y_true.append(y_true) self.y_pred.append(y_pred)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, y_true: list[Number], y_pred: list[Number]) -> ForecastingMetric:", "def _update(self, time_step, **train_kwargs):\n # training is implied here\n self.set_t_cutoff(self.cutoff_t + time_step, **train_kwargs)", "def update(self, y_pred: torch.Tensor, y_true: torch.Tensor) -> None:\...
[ "0.6576584", "0.62704575", "0.6262165", "0.6231757", "0.60995567", "0.6043346", "0.6043346", "0.5948913", "0.57387596", "0.57233065", "0.57221586", "0.57048523", "0.56996983", "0.5699047", "0.5646774", "0.56256723", "0.5622597", "0.5620955", "0.5553786", "0.55417526", "0.5487...
0.59305936
8
Gets the current value of the score.
def get(self): score = self._evaluate(self.y_true, self.y_pred) return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_score(self):\n return self.score", "def get_score(self):\n return self.score", "def get_score(self):\n return self.score", "def getScore(self):\r\n return self._score", "def get_score(self):\n return self._score", "def get_score(self):\n return self._scor...
[ "0.8346142", "0.8346142", "0.8346142", "0.82685524", "0.82329327", "0.82329327", "0.82329327", "0.81996274", "0.8153556", "0.8084667", "0.80073917", "0.7920184", "0.7873557", "0.7837606", "0.77810675", "0.7692049", "0.76469946", "0.751065", "0.7477388", "0.74663246", "0.74570...
0.6870809
97
Abstract method to be filled with the sklearn metric.
def _evaluate(self, y_true, y_pred): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n self.metric = 'AVGDIST'", "def compute_metrics(self):\n pass", "def _get_eval_metric(self):\n raise NotImplementedError", "def __init__(self):\n super().__init__()\n self.metric = 'AUC'", "def test_get_derived_metric(self)...
[ "0.6940169", "0.6921432", "0.6865521", "0.683773", "0.6775468", "0.6678773", "0.6529701", "0.6487454", "0.6459841", "0.6435887", "0.6404384", "0.63758117", "0.6339544", "0.6301063", "0.6298025", "0.6288517", "0.62738615", "0.62386024", "0.62353283", "0.62189716", "0.6189819",...
0.0
-1
Handle login requests On successfull login a session with a length of an hour should be generated. On failure an error should be thrown.
def login(): hasher = PasswordHasher() payload = request.json username = payload['user'] password = payload['pass'] DBSessionMaker = sessionmaker(bind=engine) db_session = DBSessionMaker() try: user = db_session.query(Users).get(username) hasher.verify(user.password, passw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logged_in(handler):\n\n def check_login(self, *args, **kwargs):\n jwtToken = self.request.headers.get('Authorization', None)\n\n if jwtToken:\n # validate token\n try:\n userToken = jwt.decode(\n jwtToken,\n defaultConf...
[ "0.62985647", "0.6271258", "0.6153987", "0.61011446", "0.61011446", "0.6089704", "0.607207", "0.60559976", "0.60424393", "0.6018455", "0.6008699", "0.5993032", "0.5970212", "0.5953699", "0.59374076", "0.5935772", "0.59291905", "0.59214896", "0.5899712", "0.589537", "0.5883899...
0.58135813
25
Handle logout requests Delete user's session entry in the sessions table Also, delete user's cookie whether session entry delete is successful or not Return 200 OK on success Otherwise, return 500 INTERNAL SERVER ERROR
def logout(): DBSessionMaker = sessionmaker(bind=engine) db_session = DBSessionMaker() # Find and delete user's session entry in the session table try: cookie_sess_id = request.cookies.get('session') db_session.query(Sessions).filter(Sessions.id==cookie_sess_id).delete() db_sess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout():\n session.clear()\n return json_response(status=200, response_data={\"success\": True})", "def logout():\n body = request.json\n user_id = body.get('user_id')\n user = User.get(User.id == user_id).username\n clear_token(user)\n return HTTPResponse(status=200, body={\"message\":...
[ "0.7407927", "0.7350498", "0.7283106", "0.7283106", "0.7241016", "0.7215676", "0.72012705", "0.7179627", "0.7175114", "0.7168609", "0.7154243", "0.71284455", "0.7119963", "0.71039796", "0.70737725", "0.7069549", "0.7069501", "0.70591354", "0.70546526", "0.7053894", "0.7050064...
0.81909466
0
Fills result_buffer with l, r bounds of intervals in w > low_threshold which exceed high_threshold somewhere
def find_intervals_above_threshold(w, high_threshold, low_threshold, result_buffer, dynamic_low_threshold_coeff=0): in_candidate_interval = False current_interval_passed_test = False current_interval = 0 result_buffer_size = len(result_buffer) last_index_in_w = len(w) - 1 current_candidate_inter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regrid(old_grid):\n bins = np.floor((np.log10(old_grid) - l_min) / dl).astype(int)\n w = (bins >= 0) & (bins < nbins)\n\n return bins, w", "def Bounds_to_short_filter(chargeBounds,dischargeBounds):\n \n global time_treshold \n \n ## first Filter filters all the windows which are below a ...
[ "0.553738", "0.54760826", "0.5427398", "0.53159803", "0.5290415", "0.5239659", "0.5216173", "0.51883864", "0.51512986", "0.51274943", "0.5100661", "0.5094", "0.5070553", "0.5060594", "0.50378984", "0.50272125", "0.49709576", "0.49683148", "0.4963083", "0.4962075", "0.49619874...
0.73507464
0
Finds argmax, area and center of gravity of hits in w indicated by (l, r) bounds in raw_hits. raw_hits should be a numpy array of (left, right) bounds (inclusive) Other arguments are numpy arrays which will be filled with results. centers, argmaxes are returned in samples right of hit start you probably want to convert...
def compute_hit_properties(w, raw_hits, argmaxes, areas, centers): for hit_i in range(len(raw_hits)): current_max = -999.9 current_argmax = -1 current_area = 0.0 current_center = 0.0 for i, x in enumerate(w[raw_hits[hit_i, 0]:raw_hits[hit_i, 1]+1]): if x > current...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getTopCenterIndices(self, resolution, rectangular):\n # get x, y indices to get away from the ring basis.\n # indices starts with (0, 0) in the middle, with (r2, p1) -> (1, 0), etc. (x is on the pos 1 ray)\n\n numAxialLevels = 2 * resolution\n xi, yi = self.indices()\n if r...
[ "0.54468155", "0.5245982", "0.52018434", "0.51407737", "0.5027572", "0.501179", "0.49909672", "0.49505368", "0.49250877", "0.49115202", "0.49069312", "0.4905353", "0.48982129", "0.48870504", "0.4865395", "0.48550183", "0.4845263", "0.47969246", "0.4787651", "0.4767172", "0.47...
0.73296267
0
Compute basic pulse properties quickly
def compute_pulse_properties(w, initial_baseline_samples): # First compute baseline baseline = 0.0 initial_baseline_samples = min(initial_baseline_samples, len(w)) for x in w[:initial_baseline_samples]: baseline += x baseline /= initial_baseline_samples # Now compute mean, noise, and m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, power, T0_ps, center_wavelength_nm,\n time_window_ps = 10., frep_MHz = 100., NPTS = 2**10, \n GDD = 0, TOD = 0, chirp2 = 0, chirp3 = 0,\n power_is_avg = False):\n\n Pulse.__init__(self, frep_MHz = frep_MHz, n = NPTS)\n # make sure we ...
[ "0.6358498", "0.6317641", "0.63023865", "0.60456705", "0.60405445", "0.59185964", "0.5912954", "0.58964646", "0.5826671", "0.5813686", "0.58130246", "0.5761169", "0.5713485", "0.56207675", "0.56019944", "0.55966306", "0.5565917", "0.55059624", "0.55000675", "0.5494248", "0.54...
0.60221887
5
Prepares the data for creating ML models
def prepare_data(camera, image_nums): from gen_d_params import gen_d_params # Fetch the data of interest set by "camera" and "image_nums" imgs = [camera + x for x in image_nums] d_params = gen_d_params(imgs) # Add azimuth feature for pixel location d_params["err_ang"] = np.rad2deg(np.arcta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepare_data(self):\n #TODO hardcoded values need to change\n print_info(\"Preprocessing the train data...\")\n self._place_dataset(os.path.join(self._hparams[\"temp-data\"], \"train\"),\n self.TRAIN_OUT_PATH)\n\n print_info(\"Preprocessing the test data.....
[ "0.80092263", "0.74358416", "0.7237138", "0.7234688", "0.71888596", "0.715646", "0.7066007", "0.7044061", "0.7012535", "0.69576716", "0.69042885", "0.6898071", "0.6874291", "0.67918086", "0.6788373", "0.6775429", "0.67715067", "0.67438567", "0.6699872", "0.6649036", "0.662834...
0.0
-1
Checks if _any_ robot enters the provided regions
def get_validation_status(self, world) -> ValidationStatus: for region in self.regions: for robot in world.friendly_team.team_robots: if tbots.contains( region, tbots.createPoint(robot.current_state.global_position) ): return Va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkRegions(self, iPlayer, regionList, bVassal=False):\n\t\tfor regionID in regionList:\n\t\t\tif not utils.checkRegionControl(iPlayer, regionID, bVassal):\n\t\t\t\treturn False\n\t\treturn True", "def is_in_state(location, state_regions):\n flag=0\n for each in state_regions:\n if is_in_region...
[ "0.6682395", "0.6617277", "0.655005", "0.65364325", "0.6430662", "0.6267606", "0.61465126", "0.61261976", "0.6090589", "0.6046472", "0.6023994", "0.6016984", "0.59815913", "0.59123266", "0.5840832", "0.58313024", "0.5781557", "0.57534957", "0.5749572", "0.57270414", "0.569021...
0.0
-1
(override) shows regions to enter
def get_validation_geometry(self, world) -> ValidationGeometry: return create_validation_geometry(self.regions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_regions(view=None):\r\n # Get current active view\r\n if view is None:\r\n view = sublime.active_window().active_view()\r\n # Unable to set regions when no view available\r\n if view is None:\r\n return\r\n\r\n # Do no set regions if view is empty or still loading\r\n if ...
[ "0.65240884", "0.6408818", "0.633112", "0.6262963", "0.60573566", "0.6022681", "0.5926789", "0.59011424", "0.5846541", "0.58321047", "0.58177316", "0.58080935", "0.579175", "0.57498974", "0.574381", "0.57271105", "0.57197857", "0.5711749", "0.5662972", "0.5655112", "0.5649187...
0.0
-1
Construct a basic RNN cell. It is configured to be passed to a multi rnn cell wrapper.
def build_rnn_cell(type, num_units, dropout): cell = tf.nn.rnn_cell.BasicRNNCell(num_units) if dropout: result = tf.nn.rnn_cell.DropoutWrapper(cell, output_keep_prob=1-dropout) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rnn_cell(num_units,\n num_layers,\n num_residual_layers,\n dropout,\n mode,\n num_gpus,\n base_gpu=0,\n single_cell_fn=None,\n all_layer_outputs=False):...
[ "0.71335816", "0.6953759", "0.6925032", "0.6800048", "0.6565086", "0.65646267", "0.637898", "0.6358356", "0.6312413", "0.62985456", "0.629002", "0.6288718", "0.62280524", "0.61890537", "0.6145752", "0.612748", "0.6081028", "0.60306144", "0.6012887", "0.5991209", "0.59855443",...
0.6650443
4
Construct a basic RNN cell. It is configured to be passed to a multi rnn cell wrapper.
def build_lstm_cell(num_units, dropout): cell = tf.nn.rnn_cell.LSTMCell(num_units) if dropout: result = tf.nn.rnn_cell.DropoutWrapper(cell, output_keep_prob=1-dropout) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rnn_cell(num_units,\n num_layers,\n num_residual_layers,\n dropout,\n mode,\n num_gpus,\n base_gpu=0,\n single_cell_fn=None,\n all_layer_outputs=False):...
[ "0.7134765", "0.69544786", "0.6926675", "0.68001246", "0.6651791", "0.6566028", "0.6565687", "0.638008", "0.63594615", "0.63141453", "0.6299174", "0.62913984", "0.6288368", "0.6231029", "0.61889553", "0.61449057", "0.612983", "0.60820633", "0.60315627", "0.6013897", "0.599206...
0.0
-1
Construct a GRU RNN cell. It is configured to be passed to a multi rnn cell wrapper.
def build_gru_cell(num_units, dropout): cell = tf.nn.rnn_cell.GRUCell(num_units) if dropout: result = tf.nn.rnn_cell.DropoutWrapper(cell, output_keep_prob=1-dropout) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_gru_cell(self, num_units):\n return gru_cell.LayerNormGRUCell(\n num_units,\n w_initializer=self.uniform_initializer,\n u_initializer=random_orthonormal_initializer,\n b_initializer=tf.constant_initializer(0.0))", "def build_rnn_cell(type, num_units, dropout):\n ...
[ "0.75219285", "0.67751324", "0.65611047", "0.652693", "0.65234923", "0.6497355", "0.6401402", "0.6371681", "0.6347477", "0.6342275", "0.62993085", "0.6285365", "0.6272967", "0.6165039", "0.61427605", "0.6132339", "0.610192", "0.6040023", "0.59487605", "0.58486575", "0.5812393...
0.75191617
1
Multi RNN cell wraps a sequence of cells into one cell
def build_multi_rnn(cells): return tf.nn.rnn_cell.MultiRNNCell(cells)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_rnn_cells(self, is_list=False):\n\n stacked_rnn = []\n for _ in range(self.num_layers):\n single_cell = self._rnn_single_cell()\n stacked_rnn.append(single_cell)\n\n if is_list:\n return stacked_rnn\n else:\n return tf.nn.rnn_cell....
[ "0.7117752", "0.70600027", "0.674815", "0.65157115", "0.6431374", "0.63540703", "0.6354059", "0.62947875", "0.6241957", "0.6232274", "0.61524653", "0.6138036", "0.6061001", "0.6054821", "0.6045019", "0.5993263", "0.59205985", "0.5865216", "0.5863549", "0.58027077", "0.5800259...
0.76230234
0
resize input in order to produce sampled depth map
def scale_camera(cam, scale=1): new_cam = np.copy(cam) # focal: new_cam[1][0][0] = cam[1][0][0] * scale new_cam[1][1][1] = cam[1][1][1] * scale # principle point: new_cam[1][0][2] = cam[1][0][2] * scale new_cam[1][1][2] = cam[1][1][2] * scale return new_cam
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resized_map(self, new_size):\n\n new_map = cv2.resize(self.map.copy(), new_size)\n cur_count = np.sum(new_map)\n\n # Avoid dividing by zero\n if cur_count == 0:\n return new_map\n\n scale = self.count / cur_count\n new_map *= scale\n return new_map", ...
[ "0.6337556", "0.58340174", "0.58162516", "0.5748601", "0.5645124", "0.558781", "0.55794656", "0.5574537", "0.5515735", "0.5503842", "0.5475208", "0.54662806", "0.546386", "0.54406154", "0.5417694", "0.5378523", "0.5363706", "0.5360747", "0.53576624", "0.5348146", "0.5339047",...
0.0
-1
resize input in order to produce sampled depth map
def scale_mvs_camera(cams, scale=1): for view in range(FLAGS.view_num): cams[view] = scale_camera(cams[view], scale=scale) return cams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resized_map(self, new_size):\n\n new_map = cv2.resize(self.map.copy(), new_size)\n cur_count = np.sum(new_map)\n\n # Avoid dividing by zero\n if cur_count == 0:\n return new_map\n\n scale = self.count / cur_count\n new_map *= scale\n return new_map", ...
[ "0.6338632", "0.5834115", "0.5815747", "0.5748118", "0.5644575", "0.5589045", "0.5579177", "0.55736023", "0.55167085", "0.5504079", "0.5475519", "0.5465852", "0.5462426", "0.54406005", "0.5418562", "0.5378243", "0.53638965", "0.5361241", "0.53567934", "0.53504694", "0.5339551...
0.0
-1
resize image using cv2
def scale_image(image, scale=1, interpolation='linear'): if interpolation == 'linear': return cv2.resize(image, None, fx=scale, fy=scale, interpolation=cv2.INTER_LINEAR) if interpolation == 'nearest': return cv2.resize(image, None, fx=scale, fy=scale, interpolation=cv2.INTER_NEAREST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(image):\r\n return cv2.resize(image, (200, 66), interpolation=cv2.INTER_AREA)", "def resize_image(img, width, height):\n\n return cv2.resize(img, (width, height))", "def resize_image(image_path):\n img = cv2.imread(image_path);\n img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB);\n img = cv2...
[ "0.8261548", "0.8075126", "0.8029768", "0.8016128", "0.7924036", "0.7875393", "0.78491545", "0.7844469", "0.7772517", "0.77287513", "0.77221835", "0.7603124", "0.7569391", "0.75212836", "0.7410956", "0.73702043", "0.73482066", "0.73242635", "0.73195106", "0.7284048", "0.72769...
0.0
-1
resize input to fit into the memory
def scale_mvs_input(images, cams, depth_image=None, scale=1): for view in range(FLAGS.view_num): images[view] = scale_image(images[view], scale=scale) cams[view] = scale_camera(cams[view], scale=scale) if depth_image is None: return images, cams else: depth_image = scale_ima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(self):\n pass", "def _resize(self, new_capacity):\n temp_array = self.make_array(new_capacity)\n for i in range(self.n):\n temp_array[i] = self.original_array[i]\n self.original_array = temp_array\n self.capacity = new_capacity", "def resize(self, old, n...
[ "0.6756476", "0.6747655", "0.6701643", "0.6621688", "0.6541919", "0.6481869", "0.64757544", "0.63817364", "0.6371053", "0.63494724", "0.63349277", "0.631679", "0.6284716", "0.62780786", "0.62718976", "0.6259087", "0.62462807", "0.61517614", "0.6054047", "0.5986684", "0.598603...
0.0
-1
resize images and cameras to fit the network (can be divided by base image size)
def crop_mvs_input(images, cams, depth_image=None): # crop images and cameras for view in range(FLAGS.view_num): h, w = images[view].shape[0:2] new_h = h new_w = w if new_h > FLAGS.height: new_h = FLAGS.height else: new_h = int(math.ceil(h / FLAGS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_real_images(self, images):\n block_idx = (self.growth_idx + 1) // 2\n height, width = self.params[\"generator_projection_dims\"][0:2]\n resized_image = tf.image.resize(\n images=images,\n size=[\n height * (2 ** block_idx), width * (2 ** block_id...
[ "0.66563886", "0.66166437", "0.6392838", "0.6369865", "0.63596517", "0.63324946", "0.6206985", "0.6188757", "0.6171561", "0.6120761", "0.60885406", "0.60879236", "0.6077981", "0.607681", "0.6075122", "0.607204", "0.6069862", "0.6055661", "0.6013288", "0.6003485", "0.6003485",...
0.0
-1
mask outofrange pixel to zero
def mask_depth_image(depth_image, min_depth, max_depth): # print ('mask min max', min_depth, max_depth) ret, depth_image = cv2.threshold(depth_image, min_depth, 100000, cv2.THRESH_TOZERO) ret, depth_image = cv2.threshold(depth_image, max_depth, 100000, cv2.THRESH_TOZERO_INV) depth_image = np.expand_dims...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Mask(self) -> int:", "def mask(self):", "def applymask(self,mask):\n self.spec[mask==0]=np.nan", "def pixel2mask(image: np.ndarray, low: float, high: float) -> np.ndarray:\n mask = image > low\n labels = smeasure.label(mask, background=0)\n for region in smeasure.regionprops(label_image=l...
[ "0.7277648", "0.70975006", "0.6916187", "0.67861253", "0.6672735", "0.6455906", "0.6452693", "0.6435973", "0.63348085", "0.63294333", "0.6324877", "0.63084173", "0.6267788", "0.6267649", "0.6242802", "0.62425005", "0.6238908", "0.6234164", "0.6233499", "0.61704344", "0.616048...
0.0
-1
read camera txt file
def load_cam(file, interval_scale=1, max_d = None): cam = np.zeros((2, 4, 4)) words = file.read().split() # read extrinsic for i in range(0, 4): for j in range(0, 4): extrinsic_index = 4 * i + j + 1 cam[0][i][j] = words[extrinsic_index] # read intrinsic for i in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cam_read(filename):\n f = open(filename,'rb')\n check = np.fromfile(f,dtype=np.float32,count=1)[0]\n assert check == TAG_FLOAT, ' cam_read:: Wrong tag in flow file (should be: {0}, is: {1}). Big-endian machine? '.format(TAG_FLOAT,check)\n M = np.fromfile(f,dtype='float64',count=9).reshape((3,3))\n ...
[ "0.6273761", "0.61905116", "0.6149404", "0.6120383", "0.60943437", "0.5985097", "0.59676677", "0.59638536", "0.5951896", "0.5951896", "0.5945563", "0.5891649", "0.5891006", "0.5866269", "0.58474845", "0.58314574", "0.5801502", "0.5800049", "0.5794519", "0.5760646", "0.5747874...
0.52473044
96