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
A helper for backends to let them redirect to a generic "order was cancelled" URL of their choosing.
def get_cancel_url(self): return reverse('checkout_payment')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _order_not_found():\n pecan.abort(404, u._('Order not found.'))", "def do_cancel(order):\r\n self.gox.cancel(order.oid)", "def _order_cancel(self, bo):\n log.info(\"bo_blotter: order_cancel bracket order bo#%s\" % bo.ticket) \n cancelled = bo.cancel()\n return(canc...
[ "0.63242435", "0.6176782", "0.6108915", "0.6008895", "0.5965189", "0.59537345", "0.5943401", "0.5943401", "0.5923187", "0.58964926", "0.58032817", "0.58032817", "0.5802958", "0.58013177", "0.5782521", "0.5767809", "0.57137996", "0.5702149", "0.5667031", "0.56372297", "0.55683...
0.68018407
0
Set initial location of the central controller.
def main(): location = gen_Location("0.856901647439813,14.08447265625") add_location(location)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulator_window_center(self, value: str) -> None:\n self.set_capability(SIMULATOR_WINDOW_CENTER, value)", "def _configure_main(self, client):\n width = self._get_main_width()\n height = self.screen_rect.height\n left = self.screen_rect.x\n top = self.screen_rect.y\n\n ...
[ "0.5979996", "0.5911836", "0.5897334", "0.5872533", "0.5869994", "0.5820433", "0.58033293", "0.57864046", "0.57571167", "0.5735946", "0.57304484", "0.5696587", "0.56753886", "0.56547064", "0.5641599", "0.5622692", "0.5616644", "0.56052744", "0.56052464", "0.5605135", "0.56011...
0.0
-1
Extrapolate the next value for `values`, based on the last `n` samples.
def extrapolate_with_worst_case(values: List[float], n: int = 5) -> float: n = min(len(values), n) return values[-1] + max(v_next - v_prev for v_prev, v_next in zip(values[-n:], values[-n+1:]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _append_value(self, v_values, next_value, v_idx=None, n_vals=1):\n for _ in range(n_vals):\n if v_idx:\n try:\n v_i = next(v_idx)\n except StopIteration:\n # Repeating commas are null-statements and can be ignored\n ...
[ "0.5853784", "0.5652507", "0.5483655", "0.54175586", "0.53613377", "0.5355311", "0.5346964", "0.52661806", "0.52464515", "0.5240065", "0.5202819", "0.5179259", "0.51771766", "0.5159131", "0.51569784", "0.51434296", "0.5133736", "0.51274586", "0.51172006", "0.5096899", "0.5076...
0.735803
0
Save the model at "checkpoint_interval" and its multiple
def save_model(opt, epoch, iteration, len_dataset, G_AB, G_BA): if opt.multi_gpu == True: if opt.save_mode == 'epoch': if (epoch % opt.save_by_epoch == 0) and (iteration % len_dataset == 0): if opt.save_name_mode: torch.save(G_AB.modul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_checkpoint(self, model_path=None):\n # TODO: include new params based on ConfigEnum\n if not os.path.isdir(path_checkpoints_dir):\n os.mkdir(path_checkpoints_dir)\n if model_path is None:\n model_path = os.path.join(path_checkpoints_dir, f\"{self.experiment_id}.p...
[ "0.7401582", "0.71482164", "0.70594513", "0.70572174", "0.7051137", "0.6978655", "0.69547313", "0.69219506", "0.68931407", "0.6889052", "0.68744576", "0.67990834", "0.677864", "0.67624456", "0.6761798", "0.6743924", "0.6712295", "0.66999596", "0.6690734", "0.6688848", "0.6674...
0.0
-1
Make alternating progression from 0..len(mask) and apply mask
def bin_to_progression(cnum): cnum = '{:b}'.format(cnum) lbits = len(cnum) cnum = tuple(bool(int(b)) for b in cnum) res = [-x if x % 2 == 0 else x for x in xrange(lbits)] for x in reversed(range(lbits)): if not cnum[x]: del res[x] return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_mask(data, mask):\n if len(mask) != 4:\n raise ValueError(\"mask must contain 4 bytes\")\n\n return bytes(b ^ m for b, m in zip(data, itertools.cycle(mask)))", "def dilate(mask, forbidden):\n new_mask = np.copy(mask)\n # Shift right\n new_mask[:, 1:] |= mask[:, :-1]\n # Shift l...
[ "0.68521", "0.6847219", "0.67219555", "0.6714275", "0.6687717", "0.6558609", "0.65374684", "0.6342248", "0.62859005", "0.6244902", "0.6208443", "0.6195653", "0.6113903", "0.6106946", "0.60793924", "0.60774386", "0.60697985", "0.60546464", "0.60513604", "0.6038645", "0.6037974...
0.0
-1
Generate a waveform at a given pitch
def oscillator(pitch): phi = 0.0 frequency = (2.0 ** ((pitch - 69.0) / 12.0)) * 440.0 delta = 2.0 * math.pi * frequency / 44100.0 while True: yield math.sin(phi) + math.sin(2.0 * phi) phi += delta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pitch_gen(freq: float, duration: float, signal: np.array, sample_freq: int, alpha=0.99, ref_length=50):\n total_sample_number = int(sample_freq * duration)\n desire_signal_length = int(sample_freq / freq)\n # pad or cur signal\n if len(signal) >= desire_signal_length:\n input_signal = signal...
[ "0.68925357", "0.6726234", "0.66145486", "0.6221028", "0.6093583", "0.6090684", "0.607366", "0.6036504", "0.6002003", "0.6001324", "0.59268504", "0.58418846", "0.58402395", "0.5825315", "0.5818039", "0.58005536", "0.5795154", "0.5773108", "0.57607305", "0.57472736", "0.572024...
0.62913406
3
Attenuate the input signal by a given gain factor
def amplifier(gain, iterable): return (gain * sample for sample in iterable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gain(self, value: int):\n self._gain = value", "def _augment_gain(audio, low=0.25, high=1.25):\n gain = low + torch.rand(1) * (high - low)\n return audio * gain", "def _augment_gain(audio, low=0.5, high=1.5):\n g = low + np.random.random_sample(1) * (high - low)\n return audio * g", "d...
[ "0.66207147", "0.65744394", "0.65512675", "0.64316994", "0.621831", "0.6208555", "0.6176225", "0.61242586", "0.60282975", "0.5953353", "0.5933839", "0.5906124", "0.5894021", "0.5892993", "0.58928", "0.589171", "0.5890473", "0.588739", "0.5873238", "0.5856382", "0.58518577", ...
0.54098356
51
Converts chord symbols to a list of MIDI notes.
def chord_generator(iterable): return (CHORDS[chord_symbol] for chord_symbol in iterable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def midiToNotes(notes):\n names = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']\n chord = []\n \n for note in notes:\n name = names[note%12]\n octave = int((note-12)/12)\n chord.append(name + str(octave))\n \n return chord", "def do_notes(self, sym):...
[ "0.7616489", "0.7372916", "0.6316395", "0.61998713", "0.61932015", "0.6102809", "0.6100707", "0.60786456", "0.5910005", "0.59029245", "0.58734196", "0.58396786", "0.580742", "0.5697692", "0.56194425", "0.5570026", "0.5569478", "0.556555", "0.55168945", "0.5492388", "0.5487699...
0.5514109
19
Converts a list of MIDI notes to (length, notes) tuples in a jazzy pattern.
def comp_pattern_generator(iterable): for chord in iterable: yield (600, chord)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def midiToNotes(notes):\n names = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']\n chord = []\n \n for note in notes:\n name = names[note%12]\n octave = int((note-12)/12)\n chord.append(name + str(octave))\n \n return chord", "def get_notes(n_notes=3)...
[ "0.72751355", "0.6409998", "0.6386394", "0.63532275", "0.6276241", "0.6104568", "0.6063792", "0.6033236", "0.5902657", "0.5802162", "0.5789134", "0.5754933", "0.5710029", "0.5709479", "0.5675543", "0.5661066", "0.56405497", "0.5631645", "0.56205016", "0.5610599", "0.56057876"...
0.0
-1
Converts a (length, notes) tuple into a (start time, list of voices) tuple
def voice_generator(iterable): t = 0 for length, pitches in iterable: voices = [Voice(pitch, length) for pitch in pitches] yield (t, voices) t += length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notes2trk(notes):\n\n trk = MidiTrack()\n\n for i, note in enumerate(notes):\n if note[0] == 's': # Message for a silence\n trk.append(Message(\"note_on\", note=0, velocity=0, time=0))\n trk.append(Message(\"note_off\", note=0, velocity=0, time=note[1]))\n continu...
[ "0.5827614", "0.58031875", "0.5766902", "0.5739528", "0.564799", "0.55279285", "0.5484863", "0.5467367", "0.545753", "0.5285937", "0.52673745", "0.52369463", "0.5207202", "0.5189461", "0.5179867", "0.5171127", "0.5165314", "0.5151694", "0.51371425", "0.5110185", "0.5105895", ...
0.53834355
9
Renders samples from voices and maintains a voice pool
def voice_combiner(iterable): t = 0.0 stopping = False voice_pool = [] voice_time, voice_list = next(iterable) while True: # add new voices to the pool while t >= voice_time: voice_pool.extend(voice_list) try: voice_time, voice_list = next(it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_samplers(self):\n raise NotImplementedError(\" The draw_samplers() method has not been implemented \")", "def vad_collector(sample_rate, frame_duration_ms,\n padding_duration_ms, vad, frames):\n num_padding_frames = int(padding_duration_ms / frame_duration_ms)\n # We use a ...
[ "0.6162303", "0.5727719", "0.55910593", "0.5577907", "0.5498214", "0.5483886", "0.54681635", "0.5461217", "0.54054", "0.5372851", "0.53714526", "0.5359456", "0.5333311", "0.5311192", "0.5289894", "0.52676386", "0.5251842", "0.52288085", "0.52242666", "0.5217163", "0.5215833",...
0.57762194
1
Converts floating point audio signals to 16 bit integers
def quantizer(iterable): return (int(32767.0 * sample) for sample in iterable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _float_to_16_bit_sample(value):\n sample = int(32767.0 * value)\n byte0 = sample & 255\n byte1 = (sample >> 8) & 255\n return byte0, byte1", "def float_to_int_16(x):\n return np.float16(x).view(np.int16)", "def bit_to_short(bits: str) -> float:\n ints = int(bits, 2)\n r...
[ "0.741024", "0.70081574", "0.64652306", "0.64043653", "0.6338653", "0.6219103", "0.6193878", "0.61736125", "0.6150416", "0.60350937", "0.5967454", "0.59377503", "0.58848333", "0.58737385", "0.58616364", "0.5821956", "0.5818692", "0.5739716", "0.57278293", "0.57149684", "0.570...
0.0
-1
return the maximum value achievable in 'capacity' weight using 'items' when repeated items are allowed
def knapval_rep(capacity, items): # def knapv(w): # subprobs = [(knapv(w-item.weight) + item.value) # for item in items if item.weight <= w] # return reduce(max, subprobs, 0) # # return knapv(capacity) result = 0 if len(items) == 0: result = 0 elif ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knapsack(items, capacity):\n if len(items) == 0 or capacity <= 0:\n return 0\n \n name, weight, value = items[0]\n val_without = knapsack(items[1:], capacity)\n\n if weight > capacity:\n return val_without\n val_with = value + knapsack(items[1:], capacity - weight)\n\n return...
[ "0.80529207", "0.7795684", "0.7373593", "0.73671526", "0.7362459", "0.73233944", "0.7159021", "0.71527445", "0.704665", "0.69259", "0.6890195", "0.68810976", "0.6865774", "0.68263716", "0.67208666", "0.665759", "0.6596336", "0.6569543", "0.6552361", "0.650723", "0.6473436", ...
0.7531622
2
return the maximum value achievable in 'capacity' weight using 'items' when repeated items are allowed
def knapval_norep_rec(capacity, items): # # choose to use item.weight and get item.value + optimal from what's left # options = list( # item.value + knapval_norep(capacity-item.weight, lits(i for i in items if i is not item)) # for item in items if item.weight <= capacity) # if len(optio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knapsack(items, capacity):\n if len(items) == 0 or capacity <= 0:\n return 0\n \n name, weight, value = items[0]\n val_without = knapsack(items[1:], capacity)\n\n if weight > capacity:\n return val_without\n val_with = value + knapsack(items[1:], capacity - weight)\n\n return...
[ "0.8053362", "0.7796187", "0.7531503", "0.7373693", "0.7362247", "0.7323349", "0.7159887", "0.71528", "0.7046194", "0.6925851", "0.6890471", "0.6880475", "0.6865383", "0.68267167", "0.67212474", "0.66574955", "0.65967155", "0.65697443", "0.65523726", "0.65078604", "0.64739335...
0.7367629
4
return the maximum value achievable in 'capacity' weight using 'items' when repeated items are allowed
def knapval_norep(W, wt): # choose to use item.weight and get item.value + optimal from what's left # last_item = items[-1] # other_items = items[:-1] # options = list( # knpaval_norep(capacity, other_items)) # if last_item.weight <= capacity: # options.append(last_item.value + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knapsack(items, capacity):\n if len(items) == 0 or capacity <= 0:\n return 0\n \n name, weight, value = items[0]\n val_without = knapsack(items[1:], capacity)\n\n if weight > capacity:\n return val_without\n val_with = value + knapsack(items[1:], capacity - weight)\n\n return...
[ "0.80534375", "0.7795931", "0.75310713", "0.737376", "0.7366686", "0.7362282", "0.732389", "0.7152785", "0.7045815", "0.69256973", "0.68899876", "0.68808466", "0.68654317", "0.68268967", "0.6720455", "0.66579473", "0.65970707", "0.6569917", "0.65530336", "0.65083057", "0.6473...
0.71592444
7
Get a collection or raise a NoObject exception.
def get_collection(coll_id=None, transform_id=None, relation_type=None): return collections.get_collection(coll_id=coll_id, transform_id=transform_id, relation_type=relation_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_collection(collection_id):\n print('collection_checker.get_collection()')\n collection = collection_dao.get_collection(collection_id)\n if collection is None:\n abort(404, 'Collection does not exist')\n else:\n collection = collection_dao.get_collection(collection_id)\n pri...
[ "0.69242334", "0.68296415", "0.67922777", "0.66790384", "0.66327196", "0.6520115", "0.6349354", "0.6292217", "0.6282009", "0.62539697", "0.6183507", "0.6162687", "0.60547894", "0.6030391", "0.6023147", "0.6020786", "0.6013222", "0.5970177", "0.5962228", "0.5952375", "0.593433...
0.6146809
12
Returns a function which standardizes a value to zero mean and unit variance.
def generateStandardizationFunction(self, col, mean, nf): def f(value): if value is None: value = 0. return float((value - mean) / nf) return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standardize(x, mean=None, std=None): \n \n mean = mean if mean is not None else x.mean(axis=0)\n std = std if std is not None else x.std(axis=0) \n \n return (x - mean) / std, mean, std", "def standardize(data):\r\n mean = data.mean(axis=0)\r\n std = data.std(axis=0)\r\n return (data...
[ "0.7531515", "0.7436087", "0.7393924", "0.7227247", "0.7196341", "0.7187475", "0.7001668", "0.6994719", "0.69453627", "0.69395155", "0.6934991", "0.68891823", "0.6886294", "0.6884869", "0.68243986", "0.6824206", "0.6813376", "0.6759209", "0.6759209", "0.6711206", "0.66860104"...
0.71010065
6
Returns a set of SparseVectorDimensions which are each assigned a transformation function appropriate for standardizing the respective dimension.
def generateStandardizedColumns(self, data_set, columns): cstat = data_set.colStats() stdDevs = np.sqrt(cstat.variance()) means = cstat.mean() normalizingFactors = map(lambda x: x if x != 0.0 else 1.0, stdDevs) result = [] for col, mean, nf in zip(columns, means, normaliz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_scale_features_standardize(self):\n data = array([[0.564, 20.661], [-18.512, 41.168], [-0.009, 20.440]])\n cdata = CData(data)\n\n # correct answer computed in Mathematica\n # TODO: can we compute the right answer in Python?\n answer = array([[0.60355, -0.568043], [-1.15...
[ "0.58996356", "0.5885209", "0.562922", "0.5424146", "0.5354879", "0.5301714", "0.52051574", "0.5184689", "0.51839614", "0.51808983", "0.5156929", "0.5156137", "0.5154081", "0.51329243", "0.5126789", "0.50431347", "0.49799955", "0.4977521", "0.4954653", "0.4950907", "0.4950194...
0.60437644
0
Returns a function which standardizes a row's data and returns a potentially labeled `Row`.
def generateMlRow(self, successFunct=None, columns=None, labelColName="label", featureColName="features", standardizeCols=True): if columns is None: columns = self.sparseDataSet.columns if standardizeCols: standardized_columns = self.standardize(columns) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fake_clean_row(row):\n\treturn row", "def _format_table(row):\n row = pd.to_numeric(row, errors=\"ignore\")\n #try:\n # row = eval(row)\n #except (TypeError, ValueError, SyntaxError, NameError):\n # #print(\"Could not evaluate {}\".format(row))\n # pass\n ...
[ "0.6164406", "0.6127066", "0.6019099", "0.6005075", "0.5726464", "0.5528043", "0.5512648", "0.5436464", "0.53070384", "0.52938306", "0.5247783", "0.5208071", "0.5205887", "0.5141943", "0.50920874", "0.50907654", "0.5074286", "0.5066809", "0.5063445", "0.5063213", "0.5057529",...
0.51083314
14
Returns a DataFrame where the rows have been transformed according to the dataset transformation.
def generateMlDataSet(self, successFunct=None, columns=None, labelColName="label", featureColName="features", standardizeCols=True): generate_ml_row = self.generateMlRow(successFunct, columns, labelColName=labelColName, featureColName=featur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_transform(self) -> DataFrame:\n\n self.fit()\n return self.transform()", "def transform(self, dataframe: DataFrame) -> DataFrame:", "def get_transformed_data(self, df):\n temp_df = pd.DataFrame(self.fa.transform(df))\n return temp_df", "def transform(self, data: pd.DataFra...
[ "0.7627935", "0.7551968", "0.73451376", "0.7242807", "0.72086525", "0.68814796", "0.6862239", "0.6858905", "0.6770108", "0.675803", "0.6718472", "0.66019315", "0.660158", "0.6600896", "0.65621793", "0.65621793", "0.65621793", "0.65608925", "0.64859825", "0.6464547", "0.644794...
0.0
-1
Redirect to OpenID Connect provider.
async def oidc_start(request: aiohttp.web.Request) -> aiohttp.web.Response: try: oidc = request.app["oidc_client"].begin("oidc") except Exception as e: # This can be caused if config is improperly configured, and # oidcrp is unable to fetch oidc configuration from the given URL r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openid_redirect(request):\n request.session['next'] = _get_next(request)\n request.session['openid_provider'] = request.GET.get('openid_provider')\n request.session['socialregistration_connect_object'] = get_object(request.GET)\n\n client = OpenID(\n request,\n 'http%s://%s%s' % (\n ...
[ "0.8395367", "0.67317396", "0.6725063", "0.6613689", "0.6543737", "0.6418836", "0.63803566", "0.6359176", "0.633025", "0.627315", "0.6260299", "0.6230966", "0.62175244", "0.6199159", "0.61552745", "0.61548233", "0.61204106", "0.6104589", "0.6092281", "0.60429436", "0.60429436...
0.58814025
32
Finalize OIDC login and create a new session with the data from the OIDC provicer.
async def oidc_end(request: aiohttp.web.Request) -> aiohttp.web.Response: # Response from AAI must have the query params `state` and `code` if "state" in request.query and "code" in request.query: request.app["Log"].debug("AAI response contained the correct params.") params = {"state": request.q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def oidc_start(request: aiohttp.web.Request) -> aiohttp.web.Response:\n try:\n oidc = request.app[\"oidc_client\"].begin(\"oidc\")\n except Exception as e:\n # This can be caused if config is improperly configured, and\n # oidcrp is unable to fetch oidc configuration from the given...
[ "0.60672337", "0.59889543", "0.5987495", "0.589744", "0.5842709", "0.5828801", "0.5826942", "0.57812965", "0.57745713", "0.570731", "0.5674367", "0.5672693", "0.5672693", "0.56480044", "0.5619016", "0.56117016", "0.55854535", "0.55616057", "0.55613655", "0.55609727", "0.55518...
0.6306145
0
Create new session cookie for the user.
async def handle_login( request: aiohttp.web.Request, ) -> typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse]: response: typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse] response = aiohttp.web.Response(status=302, reason="Redirection to login") # Add a cookie for navigating if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createCookie(self, sessionid, realmPath=None):\n cookie = Cookie.SimpleCookie()\n cookie[\"session\"] = sessionid\n if realmPath:\n cookie[\"session\"][\"Path\"] = realmPath\n return str(cookie)", "def set_user_cookie_id():\n #new fresh user\n if not request.cooki...
[ "0.72525936", "0.7124941", "0.7083443", "0.7062573", "0.69455165", "0.6611357", "0.65830433", "0.65830433", "0.6502849", "0.648782", "0.6434921", "0.6416773", "0.637933", "0.6350128", "0.6345116", "0.63331276", "0.6314953", "0.62808114", "0.6279916", "0.6206115", "0.61690265"...
0.0
-1
Display login page and initiate federated keystone authentication.
async def sso_query_begin( request: typing.Union[aiohttp.web.Request, None] ) -> typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse]: # Return the form based login page if the service isn't trusted response: typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse] if request and setd["oidc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login():\n return render_template('auth/login.html')", "def login():\n return render_template('auth/login.html')", "def login():", "def login():", "def login():\n login_page = Login()\n login_page.login_main_page()", "def login(self):\n\n self.__login_if_required()", "def login(s...
[ "0.68994683", "0.68994683", "0.68386334", "0.68386334", "0.68231094", "0.6799125", "0.67573166", "0.67412186", "0.6670987", "0.66576177", "0.66256535", "0.659779", "0.6574785", "0.6571977", "0.65605384", "0.65423954", "0.6526172", "0.6500901", "0.64738524", "0.64659566", "0.6...
0.0
-1
Initiate a federated Keystone authentication with OIDC.
async def sso_query_begin_oidc( request: typing.Union[aiohttp.web.Request, None] ) -> typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse]: response: typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse] if request and setd["oidc_enabled"]: session = await aiohttp_session.get_session...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_keystone_client(self, username, password, tenant_id, auth_url):\n\n __logger__.debug(\"Init Keystone Client\")\n self.keystone_client = KeystoneClient(username=username, password=password, tenant_id=tenant_id,\n auth_url=auth_url)", "def setUp(...
[ "0.641375", "0.6165142", "0.61065006", "0.608807", "0.60520416", "0.5751912", "0.57354933", "0.5702204", "0.5676696", "0.5632091", "0.56215346", "0.5571263", "0.55176306", "0.5507107", "0.54945993", "0.5489177", "0.5451096", "0.5450595", "0.54504687", "0.54402965", "0.5404991...
0.0
-1
Handle the login procedure with classic POST.
async def credentials_login_end( request: aiohttp.web.Request, ) -> typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse]: log = request.app["Log"] client = request.app["api_client"] log.info("Got login request with username, password") form = await request.post() try: username ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_post():\n\treturn \"LOGIN\"", "def post(self):\n args = login_parser.parse_args()\n if request.form:\n username = request.form['username']\n password = request.form['password']\n else:\n username = args['username'] # form['username']\n pa...
[ "0.8056917", "0.7878615", "0.78097796", "0.76373166", "0.76373166", "0.7398554", "0.7387662", "0.7373524", "0.7298845", "0.7247156", "0.7236259", "0.7218368", "0.7187571", "0.71775395", "0.7155747", "0.7127159", "0.7089878", "0.70238686", "0.7013341", "0.70069367", "0.7006773...
0.0
-1
Handle the login procedure return from SSO or user from POST.
async def sso_query_end( request: aiohttp.web.Request, ) -> typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse]: formdata = await request.post() # Declare the unscoped token unscoped = test_token(formdata, request) return await login_with_token(request, unscoped)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_post():\n logger.debug(\"entering function login_post\")\n response = check_user_credentials(request.json)\n logger.debug(\"exiting function login_post\")\n return jsonify(response)", "def post(self):\n args = login_parser.parse_args()\n if request.form:\n username ...
[ "0.7276632", "0.7169859", "0.7103338", "0.70456195", "0.6930159", "0.68893594", "0.688071", "0.68596727", "0.68079287", "0.68037826", "0.6794347", "0.67866087", "0.6769371", "0.67304015", "0.67024994", "0.6697399", "0.668939", "0.668939", "0.66856444", "0.6664718", "0.6663869...
0.0
-1
Log in a session with token.
async def login_with_token( request: aiohttp.web.Request, token: str, ) -> typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse]: # Establish connection and begin user session response: typing.Union[aiohttp.web.Response, aiohttp.web.FileResponse] response = aiohttp.web.Response( statu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self):\n r = self._login_token()", "def login():\n token = request.form.get('idtoken')\n if verify_token(token):\n session['logged_in'] = True\n return '', 204\n else:\n return '', 401", "def _login_token(self):\n data = {\n 'cmd': 'login',\n ...
[ "0.7596102", "0.72045684", "0.7020027", "0.70106757", "0.70056885", "0.69228905", "0.69088507", "0.68233377", "0.6813642", "0.6765508", "0.67347586", "0.6731763", "0.6728156", "0.67254066", "0.67147374", "0.66933644", "0.66545373", "0.66474944", "0.66474944", "0.6645271", "0....
0.63838345
47
Lock down to a specific project.
async def handle_project_lock(request: aiohttp.web.Request) -> aiohttp.web.Response: log = request.app["Log"] log.info("Call for locking down the project.") session = await aiohttp_session.get_session(request) project = request.match_info["project"] # Ditch all projects that aren't the one specif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def StopProject (paser):\n\tModKeyProjectProtection = Project.status()\t\t#Status del proyecto\n\n\tif ModKeyProjectProtection == False:\n\t\trepositorio.stopChanges()", "def f_unlock(self):\n self._locked = False", "def unlock(project, env_spec_name):\n failed = _check_problems(project)\n if fail...
[ "0.6348069", "0.6022437", "0.6013928", "0.59228545", "0.5799038", "0.5796983", "0.5793839", "0.57587075", "0.5754687", "0.5732977", "0.56677544", "0.5666943", "0.5657372", "0.56248546", "0.56235677", "0.5605617", "0.5602566", "0.5585458", "0.55657995", "0.55327934", "0.552069...
0.70834726
0
Properly kill the session for the user.
async def handle_logout(request: aiohttp.web.Request) -> aiohttp.web.Response: log = request.app["Log"] client = request.app["api_client"] if not setd["set_session_devmode"]: try: session = await aiohttp_session.get_session(request) log.info(f"Killing session {session.identit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_session(user):\n\n # Destroy cookie\n user.cookie = None\n user.cookie_expiration = datetime.now()\n\n # Commit\n db.session.add(user)\n db.session.commit()", "def kill(self):\n self.rpc.call(MsfRpcMethod.SessionMeterpreterSessionKill, [self.sid])", "def do_logout():\n del ...
[ "0.80263066", "0.77319854", "0.7595093", "0.7439574", "0.733163", "0.72445107", "0.720937", "0.7187225", "0.7032344", "0.7017926", "0.69207746", "0.6849991", "0.6842349", "0.68047076", "0.6778811", "0.6765883", "0.6765883", "0.6765883", "0.67380124", "0.67192554", "0.6714616"...
0.0
-1
Parse projects from userinfo.
def _get_projects_from_userinfo( userinfo: typing.Dict[str, typing.Any], ) -> typing.List[typing.Any] | None: if "sdConnectProjects" in userinfo: # Remove the possibly existing "project_" prefix projects = [ p.removeprefix("project_") for p in userinfo["sdConnectProjects"].split(" ")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_project(src_url: str) -> tuple:\n # TODO: improve the splitting with regex .. this way it misses some projects\n gh_user, gh_project = src_url.rsplit('/', 2)[-2:]\n\n return gh_user, gh_project", "def get_user_projects(username):\n\n tx = cypher_transaction()\n query = \"\...
[ "0.638", "0.6257913", "0.6091854", "0.5990585", "0.5930123", "0.5728555", "0.5728555", "0.570004", "0.5605483", "0.5585763", "0.55782217", "0.5531046", "0.5516802", "0.5503669", "0.5475661", "0.5474088", "0.5468539", "0.5466969", "0.53591806", "0.53487664", "0.53265506", "0...
0.77144426
0
Transform the IO data into the requested format and projection if necessary.
def transform_data(self, outformat=None, epsg=None): out_data = geopandas.GeoDataFrame.copy(self.data) if epsg and str(self.get_epsg()) != epsg: out_data[out_data.geometry.name] = \ self.data.geometry.to_crs(epsg=epsg) out_data.crs = fiona.crs.from_epsg(epsg) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_converter(self, **kwds):\n if (self.reformat == 'zarr'):\n # output zarr file\n self.HDF5_to_zarr(**kwds)\n elif (self.reformat == 'HDF5'):\n # output rechunked HDF5 file\n self.HDF5_to_HDF5(**kwds)\n # elif (reformat == 'JPL'):\n # ...
[ "0.5569975", "0.5505671", "0.5388421", "0.5375472", "0.5293689", "0.52527857", "0.5248115", "0.51841456", "0.517878", "0.51682824", "0.5125906", "0.50980085", "0.50823504", "0.5060049", "0.50447756", "0.49652284", "0.49562937", "0.4953078", "0.49232402", "0.49127552", "0.4909...
0.5966752
0
Create a FeatureIO object
def __init__(self, features=None, **kwargs): super(FeatureIO, self).__init__(**kwargs) self.features = features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, features=None):\n self.features = features", "def construct(data_dir, fname, X=None, normalize=False, _type='sparse'):\n if _type == 'sparse':\n return SparseFeatures(data_dir, fname, X, normalize)\n elif _type == 'dense':\n return DenseFeatures(data_dir, fname, X, n...
[ "0.649636", "0.63637304", "0.6343216", "0.63154984", "0.6243798", "0.62359333", "0.62053484", "0.6069705", "0.6026877", "0.6018775", "0.6010477", "0.59540987", "0.5934894", "0.59044176", "0.5893953", "0.58894765", "0.58461726", "0.583732", "0.58244425", "0.58146846", "0.58110...
0.7322272
0
Parse the FeatureIO.features and return as a GeoDataFrame or GeoJSON
def read(self, format=None, epsg=None): if not format: format = self.default_output if self.data is None and self.features: if type(self.features) == str: self.features = json.loads(self.features) features = self.features if 'type' in feat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFeatures(gdf):\n import json\n return [json.loads(gdf.to_json())['features'][0]['geometry']]", "def getFeatures(gdf):\n import json\n return [json.loads(gdf.to_json())['features'][0]['geometry']]", "def getFeatures(gdf):\n import json\n return [json.loads(gdf.to_json())['features'][0][...
[ "0.7279601", "0.7279601", "0.7279601", "0.72584164", "0.720255", "0.71832156", "0.7088852", "0.66288954", "0.6549225", "0.64755887", "0.6387266", "0.6373814", "0.63635164", "0.6338724", "0.6322752", "0.63146687", "0.6307491", "0.6301861", "0.62509245", "0.62180096", "0.621699...
0.71520513
6
Reset the IO data to None
def delete(self): self.data = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_data(self):\n self.data = None", "def reset(self):\n self.temp_data.clear()", "def reset_output(self):\r\n self.output.seek(0)\r\n self.output.truncate(0)", "def clear(self):\n self._out = None", "def reset_io(self) -> None:\n\n self.serial.write(b\"z!\")...
[ "0.7848442", "0.7181984", "0.69473", "0.6905416", "0.6878329", "0.68388647", "0.68236834", "0.6814159", "0.68113273", "0.6800893", "0.6769905", "0.6764747", "0.67208916", "0.6711561", "0.66598177", "0.66127276", "0.6574715", "0.65620214", "0.6531298", "0.6508345", "0.64923096...
0.0
-1
Read vector data from a file (JSON, Shapefile, etc)
def read(self, format=None, epsg=None): if not format: format = self.default_output if self.ext not in formats.VECTOR: raise UnsupportedFormatException( "Only the following vector formats are supported: {}".format( ','.join(formats.VECTOR) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_vector_file(fname):\n return np.genfromtxt(fname)", "def read_value(file_obj, version, vectors):\n type_key, data = common.read_generic_typed_data(file_obj)\n\n return loads_value(type_key, data, version, vectors)", "def load_pretrained_vectors(vectors):\n with open(vectors) as f:\n ...
[ "0.7258415", "0.6939972", "0.68744355", "0.6670833", "0.6651395", "0.6568607", "0.6519597", "0.6446601", "0.64014494", "0.63939184", "0.6376528", "0.6256297", "0.6248714", "0.6245435", "0.6237502", "0.6200828", "0.6200563", "0.6152685", "0.6100003", "0.60942775", "0.6087425",...
0.6674612
3
Write data (assumed geopandas) to geojson or shapefile
def write(self, filename=None, as_type='json'): if not filename: filename = self.uri self.create_output_dir(filename) if as_type == 'json': with open(filename, 'w') as outfile: outfile.write(self.transform_data(outformat=formats.JSON)) elif as_type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_geojson(vec:gpd.GeoDataFrame, dest):\n\t\tdest = str(dest)\n\n\t\t# WGS 84\n\t\t#vec = vec.to_crs({'init': 'epsg:4326'})\n\n\t\tif os.path.isfile(dest):\n\t\t\tos.remove(dest)\n\t\t\t\n\t\tvec.to_file(dest, driver='GeoJSON', encoding='utf-8')", "def save_to_geojson(self, topology_map, filename):", "d...
[ "0.7644244", "0.7486198", "0.7072212", "0.69965905", "0.66923374", "0.6669104", "0.6602326", "0.6577784", "0.65675855", "0.6484299", "0.63121295", "0.6291043", "0.62831575", "0.6254037", "0.6212789", "0.6133664", "0.61290187", "0.60963386", "0.6094165", "0.6067398", "0.602487...
0.5382228
90
Apply filters to the dataset
def filter_data(self): self.data = filter_pandas(self.data, self.filters)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_filters(self, filters):\n self._data = self.model.objects.filter(**filters)", "def filter(self, filters):", "def filter_data(self, data):\n for f in self.filters:\n data = getattr(self, f)(data)\n return data", "def filter_data(data,filters):\n final_filter = pd.S...
[ "0.76852214", "0.7679097", "0.75132066", "0.7299479", "0.7155812", "0.7077142", "0.6961737", "0.6916808", "0.68126285", "0.67535377", "0.6718354", "0.66857404", "0.6545745", "0.6495445", "0.6494822", "0.6489582", "0.6474239", "0.645313", "0.645255", "0.6376576", "0.6371919", ...
0.7998662
0
Read data from a raster dataset
def read(self, as_numpy_array=False, as_single_band=True, old_nodata=None, new_nodata=None, epsg=None): if self.ext not in formats.RASTER: raise UnsupportedFormatException( "Only the following raster formats are supported: {}".format( ','.join(formats...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_raster (self, filename):\n raster = gdal.Open (filename)\n band = raster.GetRasterBand(1)\n x = band.ReadAsArray () \n nodata_val = band.GetNoDataValue () # get the missing data flag\n x [x == nodata_val] = np.nan # set missing data properly\n re...
[ "0.69494873", "0.69347304", "0.68553156", "0.6753696", "0.65782833", "0.65512747", "0.65204966", "0.6435528", "0.64259845", "0.6375671", "0.6340665", "0.6337834", "0.6337424", "0.61567295", "0.61204016", "0.6108158", "0.61068714", "0.6098699", "0.6089202", "0.60586715", "0.60...
0.54776746
94
Create an IO object containing a GaiaProcess to run
def __init__(self, process=None, parent=None, **kwargs): super(ProcessIO, self).__init__(**kwargs) self.process = process self.parent = parent self.default_output = process.default_output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_process() -> Process:\n return multiprocessing.Process()", "async def open_process(\r\n cls, args: \"Union[str, List[str]]\", env_additions: Dict[str, str] = {}\r\n ) -> \"AsyncIterator[Expect]\":\r\n printer_channels: (\r\n \"Tuple[MemorySendChannel[bytes], MemoryReceiveCh...
[ "0.63116145", "0.57088315", "0.56168306", "0.55841285", "0.5541996", "0.5525313", "0.5505391", "0.5478076", "0.5466999", "0.5392637", "0.53815526", "0.53630763", "0.533476", "0.5331508", "0.53179747", "0.5307854", "0.5251125", "0.5241876", "0.5231719", "0.52115893", "0.520870...
0.60687447
1
Return the EPSG code of the dataset
def get_epsg(self): if hasattr(self.process, 'output') and self.process.output.data \ is not None: return self.process.output.get_epsg() else: return self.process.inputs[0].get_epsg()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _epsg(self):\n info = self._info['coordinateSystem']['wkt'].rsplit('\"EPSG\",', 1)[-1]\n return int(re.findall(r\"\\d+\", info)[0])", "def Get_epsg(g, extension = 'tiff'):\n try:\n if extension == 'tiff':\n # Get info of the dataset that is used for transforming\n ...
[ "0.6720755", "0.61444277", "0.61156243", "0.6113944", "0.6069787", "0.58153844", "0.5619182", "0.55280834", "0.5330134", "0.5246141", "0.52392507", "0.5231817", "0.5206324", "0.52020574", "0.5200296", "0.5191889", "0.5170663", "0.5132812", "0.5132812", "0.50836676", "0.505531...
0.0
-1
Return the process output dataset
def read(self, epsg=None): if self.data is None: self.process.compute() self.data = self.process.output.data out_data = self.data if epsg and self.get_epsg() != epsg: out_data = reproject(self.data, epsg) return out_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputs(self):\n return {\"path_to_dtb_evaluation_result\": File_IO(\n self.node.outputs[0])}", "def get_output_data(self, name='0'):\n if self.dirty:\n self.run()\n\n return self._output_data.get(name)", "def output_data(self):\n with open(self.output_...
[ "0.64601994", "0.63788813", "0.63788176", "0.63515645", "0.6285533", "0.6242062", "0.6201643", "0.61590755", "0.6152272", "0.61005825", "0.60810196", "0.60395235", "0.60348016", "0.60348016", "0.60348016", "0.60348016", "0.60348016", "0.60348016", "0.6032868", "0.6019135", "0...
0.0
-1
Instantiate a PostgisIO object for querying a PostGIS table
def __init__(self, table, **kwargs): super(PostgisIO, self).__init__(**kwargs) self.table = table self.host = kwargs.get('host') or gaia.config['gaia_postgis']['host'] self.dbname = kwargs.get( 'dbname') or gaia.config['gaia_postgis']['dbname'] self.user = kwargs.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createPostgisConnection(dbFormat, dbHost, dbName, dbSchema, dbUser, dbPWD):\r\n\r\n pg = ogr.GetDriverByName(dbFormat)\r\n if pg is None:\r\n raise RuntimeError('{0} driver not available'.format(dbFormat))\r\n conn = pg.Open(\"PG:dbname='{0}' user='{1}' password='{2}'\".format(dbName, dbUser, d...
[ "0.6855516", "0.67369133", "0.6698161", "0.64499944", "0.62568384", "0.6199102", "0.603529", "0.60263604", "0.5996107", "0.590071", "0.5864445", "0.58015627", "0.56797826", "0.5659731", "0.56208915", "0.55889374", "0.55734766", "0.5566591", "0.5559148", "0.55440044", "0.54781...
0.68292403
1
Create and return a SQLAlchemy engine object
def get_engine(self, connection_string): if connection_string not in sqlengines: sqlengines[connection_string] = create_engine( self.get_connection_string()) return sqlengines[connection_string]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_engine(self):\n connection_string = f'postgresql://{self.user}:{self.password}@{self.host}/{self.database_name}'\n return create_engine(connection_string)", "def get_engine(db_params: Dict[str, str]) -> sa.engine:\r\n db_uri = get_uri(db_params)\r\n return sa.create_engine(db_uri)"...
[ "0.81582", "0.8151789", "0.8096098", "0.8074667", "0.78949046", "0.7888775", "0.78016627", "0.7694161", "0.7633024", "0.7619185", "0.75568897", "0.7526892", "0.75230956", "0.75139517", "0.751324", "0.7408494", "0.7328666", "0.73017824", "0.7291083", "0.7289729", "0.7289729", ...
0.0
-1
Make sure that all PostgisIO columns exist in the actual table
def verify(self): for col in self.columns: if col not in self.table_obj.columns.keys(): raise Exception('{} column not found in {}'.format( col, self.table_obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(self):\n for col in self._columns:\n if col not in self._table_obj.columns.keys():\n raise GaiaException('{} column not found in {}'.format(\n col, self._table_obj))", "def test_missing_column(self):\n df = pd.DataFrame({\"notlat\": [1, 2, 3],...
[ "0.6435384", "0.57924956", "0.5753893", "0.57230234", "0.56842715", "0.5627222", "0.5578372", "0.55553114", "0.5551072", "0.5520966", "0.55202276", "0.55151975", "0.54960734", "0.54696405", "0.54570687", "0.5438926", "0.5419409", "0.5386217", "0.53728265", "0.53636533", "0.53...
0.6008417
1
Get connection string based on host, dbname, username, password
def get_connection_string(self): auth = '' if self.user: auth = self.user if self.password: auth = auth + ':' + self.password if auth: auth += '@' conn_string = 'postgresql://{auth}{host}/{dbname}'.format( auth=auth, host=self.host,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connection_string(self):\n auth = ''\n if self._user:\n auth = self._user\n if self._password:\n auth = auth + ':' + self._password\n if auth:\n auth += '@'\n conn_string = 'postgresql://{auth}{host}/{dbname}'.format(\n auth=aut...
[ "0.7930437", "0.7801941", "0.76585364", "0.7592892", "0.75295997", "0.7524706", "0.74851537", "0.73222303", "0.72575486", "0.7244134", "0.72296304", "0.7219336", "0.7214253", "0.71637756", "0.70156115", "0.6987775", "0.69751585", "0.6895092", "0.6813161", "0.68097425", "0.680...
0.7869148
1
Get the EPSG code of the data
def get_epsg(self): return self.epsg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _epsg(self):\n info = self._info['coordinateSystem']['wkt'].rsplit('\"EPSG\",', 1)[-1]\n return int(re.findall(r\"\\d+\", info)[0])", "def Get_epsg(g, extension = 'tiff'):\n try:\n if extension == 'tiff':\n # Get info of the dataset that is used for transforming\n ...
[ "0.7254906", "0.64514357", "0.6360719", "0.6358505", "0.6047866", "0.5811747", "0.57437235", "0.5492534", "0.54540646", "0.54467815", "0.5446062", "0.538035", "0.53101516", "0.5284902", "0.526871", "0.52095604", "0.520738", "0.51227933", "0.5107158", "0.5104999", "0.5089013",...
0.0
-1
Use SQLALchemy reflection to gather data on the table, including the geometry column, geometry type, and EPSG code, and assign to the PostgisIO object's attributes.
def get_table_info(self): epsg = None meta = MetaData() table_obj = Table(self.table, meta, autoload=True, autoload_with=self.engine) if not self.columns: self.columns = table_obj.columns.keys() geo_cols = [(col.name, col.type) for col in tab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_table_info(self):\n epsg = None\n meta = MetaData()\n table_obj = Table(self._table, meta,\n autoload=True, autoload_with=self._engine)\n if not self._columns:\n self._columns = table_obj.columns.keys()\n geo_cols = [(col.name, col.type...
[ "0.70732105", "0.68428886", "0.6452087", "0.624894", "0.61648315", "0.61188686", "0.61173916", "0.60497487", "0.5862017", "0.5860301", "0.5783066", "0.5763595", "0.5719233", "0.5694905", "0.5623751", "0.5593062", "0.55429846", "0.55166006", "0.5488583", "0.54816383", "0.54250...
0.71974653
0
Get the geometry type of the data
def get_geometry_type(self): return self.geometry_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_geometry_type(self):\n return self._geometry_type", "def geometry_type(self) -> ir.StringValue:\n return ops.GeoGeometryType(self).to_expr()", "def geom_type(self): # -> str:\n ...", "def geometry_type(number):\n try:\n return GDAL_GEOMETRY_TYPES[number]\n ...
[ "0.8112586", "0.7843717", "0.7644851", "0.76259863", "0.7605449", "0.7579384", "0.68932897", "0.6887345", "0.66878814", "0.6671334", "0.6600797", "0.6596621", "0.6585204", "0.6499065", "0.6425121", "0.641309", "0.6407867", "0.6349588", "0.6349588", "0.6349588", "0.6292295", ...
0.8192831
0
Formulate a query string and parameter list based on the table name, columns, and filter
def get_query(self): columns = ','.join(['"{}"'.format(x) for x in self.columns]) query = 'SELECT {} FROM "{}"'.format(columns, self.table) filter_params = [] if self.filters: filter_sql, filter_params = filter_postgis(self.filters) query += ' WHERE {}'.format(fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_query(self):\n columns = ','.join(['\"{}\"'.format(x) for x in self._columns])\n query = 'SELECT {} FROM \"{}\"'.format(columns, self._table)\n filter_params = []\n if self._filters:\n filter_sql, filter_params = filter_postgis(self._filters)\n query += ' W...
[ "0.6481889", "0.6394177", "0.6319321", "0.62386817", "0.6229315", "0.6171959", "0.6170874", "0.6115932", "0.61042583", "0.6103268", "0.61031204", "0.6026723", "0.6023874", "0.6014606", "0.6011875", "0.6009841", "0.5997763", "0.59938264", "0.5971514", "0.597093", "0.5968318", ...
0.6632733
0
Load the table data into a GeoDataFrame, and return as a GeoDataFrame or GeoJSON object
def read(self, format=None, epsg=None): if self.data is None: query, params = self.get_query() self.data = df_from_postgis(self.engine, query, params, self.geom_column, self.epsg) return self.transform_data(outformat=format, epsg=epsg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geojson2postgis(self, filepath, table_name, geo_type):\n map_data = gpd.GeoDataFrame.from_file(filepath)\n # Maybe you want to change link address\n link = \"postgresql://{0}:{1}@{3}:5432/{2}\".format(self.username, self.password, self.dbname, self.host)\n engine = create_engine(lin...
[ "0.65196556", "0.6514663", "0.6500165", "0.6484223", "0.6471508", "0.63549626", "0.6187911", "0.61573", "0.60074055", "0.59858817", "0.5967683", "0.5962735", "0.5955036", "0.5944749", "0.5936001", "0.591422", "0.59009284", "0.5860339", "0.58540696", "0.5840662", "0.582958", ...
0.5821095
21
Run a PostGIS query and return results as a GeoDataFrame
def df_from_postgis(engine, query, params, geocolumn, epsg): data = geopandas.GeoDataFrame.from_postgis( query, engine, geom_col=geocolumn, crs={'init': 'epsg:{}'.format(epsg)}, params=params) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queryToPDTable(postgreSql_selectQuery):\n\n import os\n import psycopg2\n import pandas as pd\n\n #basic query function to the database using environmental variables for\n #the user name and password\n conn=psycopg2.connect(host=\"postgis1\",\n dbname=\"sdad\",\n ...
[ "0.68622106", "0.6783693", "0.6631549", "0.65065295", "0.64609385", "0.6398335", "0.63537514", "0.63044345", "0.629543", "0.6189722", "0.6184706", "0.61680967", "0.6097106", "0.6089787", "0.60863835", "0.60695153", "0.60299134", "0.6028463", "0.6016495", "0.5989992", "0.59744...
0.83570623
0
Reproject a dataset to the specified EPSG code
def reproject(dataset, epsg): dataclass = dataset.__class__.__name__ # Run appropriate reprojection method if dataclass == 'GeoDataFrame': repro = geopandas.GeoDataFrame.copy(dataclass) repro[repro.geometry.name] = repro.geometry.to_crs(epsg=epsg) repro.crs = fiona.crs.from_epsg(epsg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reproject_dataset_example(dataset, dataset_example, method=1):\n # open dataset that must be transformed\n try:\n if (os.path.splitext(dataset)[-1] == '.tif' or os.path.splitext(dataset)[-1] == '.TIF'):\n g = gdal.Open(dataset)\n else:\n g = dataset\n except:\n ...
[ "0.6619954", "0.62397677", "0.61324847", "0.60862654", "0.60619205", "0.6057335", "0.6052431", "0.60024583", "0.5995381", "0.5954171", "0.590265", "0.58267164", "0.58260304", "0.57626706", "0.5728477", "0.56918794", "0.5690801", "0.5552014", "0.55259335", "0.5460811", "0.5403...
0.7723594
0
Convert raster output to numpy array output
def raster_to_numpy_array(raster_data, as_single_band=True, old_nodata=None, new_nodata=None): bands = as_single_band + (1 - as_single_band) * raster_data.RasterCount nrow = raster_data.RasterYSize ncol = raster_data.RasterXSize dims = (bands, nrow, ncol) out_data_array = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raster_to_array(input_raster):\n\n raster = gdal.Open(input_raster)\n band = raster.GetRasterBand(1)\n converted_array = band.ReadAsArray()\n\n return converted_array", "def convert_raster_to_array(input_raster_path, raster=None, band=1):\n # print \"input raster path\", input_raster_path\n ...
[ "0.7566383", "0.7091297", "0.6795634", "0.67187595", "0.65891033", "0.6584043", "0.6519365", "0.64970326", "0.6492841", "0.64761984", "0.64678997", "0.6418959", "0.64067036", "0.6209067", "0.6150287", "0.6082056", "0.6037599", "0.6036444", "0.59958696", "0.59908175", "0.59660...
0.60263014
18
Get appropriate DataFrame column name and readable axis label.
def _axis_labels(self, data_name: str) -> Tuple[str, str]: # Single activity attributes (column name must be present in summary dataframe) if data_name == 'distance': if self.config.distance_unit == 'km': return 'distance_2d_km', 'Distance (km)' elif self.config....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_label ( self ):\n if self._label is not None:\n return self._label\n return 'Column %d' % (self.index + 1)", "def _label(self, column):\n # XXX\n return column", "def _get_column_name(df, name='agg'):\n while name in df.columns:\n name += '_'\n retur...
[ "0.6837961", "0.66392434", "0.6530014", "0.6514728", "0.6507803", "0.6419064", "0.636666", "0.63305116", "0.62810653", "0.62264484", "0.62251216", "0.62186813", "0.62026006", "0.61959815", "0.61305", "0.6121797", "0.6063063", "0.6025661", "0.60128766", "0.60128766", "0.596436...
0.62674105
9
Generate the main scatter plot figure.
def main_scatter_fig(self, x: str, y: str) -> go.Figure: x_col, x_label = self._axis_labels(x) y_col, y_label = self._axis_labels(y) fig = px.scatter( self.summary, x=x_col, y=y_col, labels={ x_col: x_label, y_col: y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_scatterplot(self) -> Component:\n logger.debug('Generating main scatterplot.')\n\n x_dropdown = dcc.Dropdown('overview_main_scatterplot_x_dropdown', options=[\n {'label': 'Distance', 'value': 'distance'},\n {'label': 'Average speed', 'value': 'mean_speed'},\n ...
[ "0.7791738", "0.74087775", "0.72489434", "0.71679926", "0.69586086", "0.6956765", "0.69084084", "0.6881678", "0.68715435", "0.67730665", "0.67312944", "0.67114747", "0.66551024", "0.6645001", "0.6621074", "0.6581735", "0.6570473", "0.6557734", "0.6556813", "0.65257436", "0.65...
0.6566985
17
A configurable scatterplot of all activities.
def main_scatterplot(self) -> Component: logger.debug('Generating main scatterplot.') x_dropdown = dcc.Dropdown('overview_main_scatterplot_x_dropdown', options=[ {'label': 'Distance', 'value': 'distance'}, {'label': 'Average speed', 'value': 'mean_speed'}, {'label': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_scatter(self):\n plt.scatter(self.a1[:, 0], self.a1[:, 1], c=\"red\", alpha=0.5, s=10)\n plt.scatter(self.a2[:, 0], self.a2[:, 1], c=\"blue\", alpha=0.5, s=10)\n plt.scatter(0, 0, marker=\"D\", c=\"black\", alpha=0.8)\n plt.scatter(2, 2, marker=\"D\", c=\"black\", alpha=0.8)\n ...
[ "0.67238843", "0.6708577", "0.66642416", "0.6630281", "0.630712", "0.63052666", "0.6298917", "0.6278833", "0.6265205", "0.6168853", "0.6166783", "0.6123382", "0.61222416", "0.6115842", "0.6083699", "0.60783607", "0.607288", "0.6068224", "0.6062484", "0.6058355", "0.6018583", ...
0.7072408
0
Generate the chart figure for the main time plot.
def main_time_fig(self, freq: str, y: str) -> go.Figure: if freq == 'weekly': df = self.activity_manager.metadata_weekly_time_series() date_label = 'Week of' elif freq == 'monthly': df = self.activity_manager.metadata_monthly_time_series() date_label = 'Mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_time_chart(self) -> Component:\n logger.debug('Generating time graph.')\n df = self.activity_manager.metadata_weekly_time_series(activity_type='run')\n\n freq_dropdown = dcc.Dropdown('overview_main_time_chart_freq_dropdown', options=[\n {'label': 'Weekly', 'value': 'weekly'...
[ "0.7703338", "0.68641454", "0.6779474", "0.6707098", "0.65798086", "0.65385634", "0.65024126", "0.6488374", "0.6484134", "0.64522904", "0.6446261", "0.6431686", "0.63733166", "0.63720703", "0.6272359", "0.62661344", "0.6259788", "0.6258643", "0.62565494", "0.62492335", "0.623...
0.7200148
1
A line chart plotting some selected value over time.
def main_time_chart(self) -> Component: logger.debug('Generating time graph.') df = self.activity_manager.metadata_weekly_time_series(activity_type='run') freq_dropdown = dcc.Dropdown('overview_main_time_chart_freq_dropdown', options=[ {'label': 'Weekly', 'value': 'weekly'}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_line(self):\n marks = self._get_marks(False)\n marks['Val'] = self.data['Value']\n fig = plt.figure(figsize=(4,2), dpi=200)\n fig.patch.set_facecolor('#ececec')\n ax = fig.add_subplot(111)\n ax.plot(self.data['Value'], alpha=0.8, lw=1.2, color=\"green\", label='V...
[ "0.6986507", "0.66361314", "0.65602136", "0.65592897", "0.65517896", "0.65218306", "0.6515136", "0.6431805", "0.6410622", "0.6358669", "0.6323132", "0.6321626", "0.62683046", "0.6235126", "0.6228971", "0.6213806", "0.62032735", "0.61976856", "0.6170221", "0.61547273", "0.6136...
0.0
-1
Generate all graphs based on the contents of config.overview_graphs (which is in turn generated based on the contents of test_overview_graphs.json). See docs/graphs.rst for help on how test_overview_graphs.json is interpreted.
def custom_graphs(self) -> List[Component]: graphs = [] # TODO: Figure this out for i, go_data in enumerate(self.config.overview_graphs): groupby = go_data.pop('groupby', None) agg = go_data.pop('agg', None) if groupby and agg: data = getattr(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_statistics_plots(graph_name, graph_steps):\n df_final_situation = pd.DataFrame(columns=[\"type\", \"value\"])\n df_step = pd.DataFrame(columns=[\"type\", \"step\", \"value\"])\n df_exposed = pd.DataFrame(columns=[\"step\", \"type\", \"value\"])\n\n st.markdown(\"\")\n\n for i in range(g...
[ "0.57757014", "0.571238", "0.56258476", "0.5602885", "0.55782235", "0.5502178", "0.5366498", "0.53558487", "0.53391075", "0.5319257", "0.5311666", "0.52981985", "0.5294715", "0.5271559", "0.525541", "0.5254248", "0.5241613", "0.5230479", "0.522659", "0.52127856", "0.52093905"...
0.62306833
0
Extracts square patches of patch_dim by patch_dim from the data. Returns a patch_dim^2 by numpatches matrix.
def extract_patches(data,patch_dim): m = data.shape[0] im_x = data.shape[1] im_y = data.shape[2] assert im_x%float(patch_dim)==0 and im_y%float(patch_dim)==0, \ "patch_size must divide x and y dimensions of image" numpatchs = m*(im_x/patch_dim)*(im_y/patch_dim) patch_size = patch_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patches_sampling(self, image, patch_size, stride):\n h, w = image.shape[2:4]\n patches = []\n for i in range(0, h - patch_size + 1, stride):\n for j in range(0, w - patch_size + 1, stride):\n patches.append(image[:, :, i:i + patch_size, j:j + patch_size])\n ...
[ "0.6891319", "0.6779682", "0.66917896", "0.6450875", "0.64256436", "0.6412834", "0.6366795", "0.63452667", "0.6342837", "0.6332445", "0.63294715", "0.6287567", "0.62787473", "0.6240202", "0.6159606", "0.6138685", "0.606784", "0.60129994", "0.597121", "0.5943119", "0.59225255"...
0.7664922
0
Subtract DC component (mean) from each patch, and contrast normalize (divide by std dev).
def normalize(data): p_means = np.mean(data,axis=0) p_vars = np.var(data,axis=0) # subtract dc component data = data-p_means # contrast normalize data = data/np.sqrt(p_vars+10) # plus 10 to account for small variances return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normalize_patches(patches):\n patches = array_ops.concat(patches, 0)\n mean, variance = nn.moments(patches, [1, 2, 3], keep_dims=True)\n patches = (patches - mean) / math_ops.sqrt(variance)\n return array_ops.reshape(patches, [array_ops.shape(patches)[0], -1])", "def color_normalize(x, mean, std):\n ...
[ "0.6298055", "0.5891793", "0.58737147", "0.58737147", "0.5847109", "0.5814175", "0.57039946", "0.5647964", "0.5528056", "0.5524043", "0.55056757", "0.5503953", "0.54944885", "0.5488362", "0.54770255", "0.5466837", "0.5453476", "0.54484415", "0.53919643", "0.53899807", "0.5378...
0.68733734
0
Makes ZCA whitening matrix (U(V+epsilonI)^(1/2)U^T), where U is the matrix of orthogonal eigenvectors and V the corresponding eigenvalues from eigenvalue decomposition of the covariance matrix for the data.
def whiten(data): from numpy.linalg import eig eps = 0.01 # covariance matrix Sigma = np.cov(data) # eigenvalue decomposition V,U = eig(Sigma) W = U.dot(np.diag((V+eps)**(-0.5)).dot(U.transpose())) return W
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zca_whitening_matrix(X):\n # Covariance matrix [column-wise variables]: Sigma = (X-mu)' * (X-mu) / N\n sigma = np.cov(X, rowvar=True) # [M x M]\n # Singular Value Decomposition. X = U * np.diag(S) * V\n U,S,V = np.linalg.svd(sigma)\n # U: [M x M] eigenvectors of sigma.\n # S: [M x 1] ...
[ "0.76188344", "0.69833094", "0.69694257", "0.668602", "0.6582816", "0.6568755", "0.65559185", "0.6485466", "0.64088285", "0.63796425", "0.58479804", "0.58176255", "0.57855535", "0.5762374", "0.5539313", "0.5447399", "0.54079866", "0.5402104", "0.5383259", "0.53804785", "0.536...
0.7267214
1
Extracts patches from data and whitens the patches. Returns whitened patches and whitening matrix.
def process(data,patch_dim,W=None): # pull patches from image patches = extract_patches(data,patch_dim) # remove dc component and contrast normalize patches = normalize(patches) if W is None: # build whitening matrix W = whiten(patches) # apply whitening patches = W.dot(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_patches(data, idxs=None, patch_size=3, min_val=0, ctx_radius=(3,5,7), economy_patch=True, mean=False):\n # catch errors and setup the initialize values of required variables\n if idxs is None:\n idxs = np.where(data > min_val)\n if patch_size % 2 != 1 and patch_size > 0:\n raise ...
[ "0.6271824", "0.6121198", "0.5840078", "0.56840724", "0.5544035", "0.5534577", "0.55345744", "0.5533361", "0.55265146", "0.5479646", "0.5470446", "0.5416568", "0.5400108", "0.53770685", "0.5371271", "0.532619", "0.531805", "0.5317908", "0.5315576", "0.5302089", "0.5280466", ...
0.7724127
0
Convert rgb image to grayscale
def rgb2gray(rgb): r, g, b = rgb[...,0], rgb[...,1], rgb[...,2] gray = 0.2989 * r + 0.5870 * g + 0.1140 * b return gray
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb2gray(img):\r\n return 0.2989 * img[..., 0] + 0.587 * img[..., 1] + 0.114 * img[..., 2]", "def rgb2grayscale(image):\r\n\r\n assert image.ndim == 3 and image.shape[2] == 3\r\n\r\n gray_image = np.dot(image, [0.2989, 0.5870, 0.1140]).astype(np.uint8)\r\n\r\n return gray_image", "def convert_t...
[ "0.824732", "0.81395787", "0.811807", "0.8095474", "0.7850972", "0.77897877", "0.77344203", "0.7730983", "0.7730983", "0.7730983", "0.7730983", "0.769052", "0.7676294", "0.76603323", "0.7658235", "0.76398575", "0.76376325", "0.76082414", "0.7554931", "0.7517657", "0.7511747",...
0.70695215
65
Saves images and corresponding whitened patches in a format that makes sense for the images class.
def save_data(data,patches,labels,name,patch_dim,size=None): patchPerIm = (data.shape[1]*data.shape[2])/(patch_dim**2) if size is None: size = labels.shape[0] img_f = open('data/images_'+name,'w') patches_f = open('data/patches_'+name,'w') label_f = open('data/labels_'+name,'w') patc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_patches(self):\n filename = tkFileDialog.asksaveasfilename(initialdir = self.cwd, title = \"Save patches\", filetypes = ((\"inp file\",\"*.inp\"),(\"all files\",\"*.*\")))\n if filename:\n patches = self.myGlycosylator.export_patches(self.linked_glycans)\n with open(f...
[ "0.7023205", "0.67222565", "0.65105355", "0.64340895", "0.63914835", "0.6342699", "0.6314629", "0.61798173", "0.6148035", "0.61195004", "0.60702795", "0.6026399", "0.6015969", "0.6014457", "0.600203", "0.5998917", "0.59706134", "0.5965257", "0.5957205", "0.59544414", "0.59414...
0.69192946
1
Save whitening matrix. (Probably don't need this funtion)
def save_whiten_mat(W): w_id = open('data/W.bin','w') W.tofile(w_id) w_id.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename):\n hebbian_weights = open(filename, \"w\")\n for i in xrange(self.hidden):\n hebbian_weights.write(\"\\t\".join(self.vis_layer[i].get_weights()) + '\\n')\n for i in xrange(self.layers):\n for j in xrange(self.hidden):\n hebbian_weig...
[ "0.6092257", "0.60249054", "0.58878946", "0.5833244", "0.5784645", "0.5762371", "0.575296", "0.56992406", "0.5612847", "0.5594328", "0.5574145", "0.5554583", "0.5548206", "0.5548206", "0.55330473", "0.5496872", "0.5472161", "0.54410243", "0.54121757", "0.5404685", "0.53983784...
0.76458836
0
Specific to CIFAR dataset Loads data from file, returns color, grayscale images and labels.
def load_cifar_images(filename): from load_cifar import load_file from load_cifar import label_dict data,labels = load_file(filename) # two classes to keep class0 = label_dict['airplane'] class1 = label_dict['bird'] # remove all but two classes keep = np.logical_or(labels==class0,labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_CIFAR_batch(filename):\r\n with open(filename, 'rb') as f:\r\n datadict = pickle.load(f, encoding='latin1')\r\n X = datadict['data']\r\n Y = datadict['labels']\r\n X = X.reshape(10000, 3, 32, 32).transpose(0,2,3,1).astype(\"float\")\r\n Y = np.array(Y)\r\n return X, Y", "def load_CIFA...
[ "0.73128104", "0.7272266", "0.7227609", "0.7224899", "0.7196789", "0.71712595", "0.71459734", "0.7134772", "0.7129105", "0.7112924", "0.70436376", "0.6898891", "0.6793835", "0.67866397", "0.6777393", "0.6743453", "0.67378056", "0.67167586", "0.6703161", "0.66613394", "0.66538...
0.8135456
0
Block the given request if necessary.
def filter_yt(info: interceptor.Request): url = info.request_url if (url.host() == 'www.youtube.com' and url.path() == '/get_video_info' and '&adformat=' in url.query()): info.block()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Block(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')", "def block_one(self):", "def block(self):\n pass", "def check_for_lock_request(self):\n while T...
[ "0.6859457", "0.66493475", "0.66157824", "0.64418024", "0.6186081", "0.61827296", "0.6047875", "0.60476345", "0.6017209", "0.59764713", "0.59704554", "0.5955465", "0.5930965", "0.58846414", "0.584605", "0.584605", "0.584605", "0.5845607", "0.58448905", "0.58070934", "0.578768...
0.0
-1
Processes a line of data
def dependency_parse(nlp, article): if type(article) == str: parsed = nlp(article) return [[{"sender": {k[1:]: dep[0].__dict__[k] for k in dep[0].__dict__ if not k.startswith("_parent")}, "edge": dep[1], "receiver": {k[1:]: dep[2].__dict__[k] for k in dep[2].__dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_line(self, line, data):\n return data", "def parse_line(self, line):\n success = self.parser.handle_line(line)\n if success:\n self.data.update()\n else:\n self.bot.log(\"didn't handle line: '{}'\".format(line))", "def process_line(self, line):\n ...
[ "0.83830035", "0.7128161", "0.7065565", "0.68617666", "0.67690486", "0.6642529", "0.66226065", "0.66152495", "0.65900004", "0.6549268", "0.6546678", "0.6521599", "0.6446941", "0.64292336", "0.64112836", "0.6405173", "0.63816816", "0.6381636", "0.6326672", "0.63175094", "0.629...
0.0
-1
The step repeated in the main function. It processes a single line and writes the result to the final file
def process_line(nlp, line, parsed_file): m = json.loads(line) if "highlights" in m: if m['sentences'] != '' and m['sentences'] != [] and m['sentences'] != [''] and m['highlights'] != '': m["highlights_ud"] = dependency_parse(nlp, m['highlights']) m["sentences_ud"] = dependency_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __processOutputLine(self, line):\n if (\n line.startswith(\"--- \") or\n line.startswith(\"+++ \")\n ):\n self.__processFileLine(line)\n \n self.__output.append(line)", "def add_to_output(line: str) -> None:\n with open(OUTPUT, \"a+\") as proble...
[ "0.67841345", "0.6634219", "0.6592885", "0.6466333", "0.63316095", "0.6178653", "0.61690086", "0.6127863", "0.60613734", "0.5948732", "0.5920585", "0.5872873", "0.58408296", "0.5816387", "0.5814094", "0.5742575", "0.57180977", "0.5688523", "0.56645995", "0.5642619", "0.562859...
0.5227363
69
Main function to process the input file with the nlp pipeline.
def main(nlp, file_path, final_file_path, from_line=0, to_line=None): with open(final_file_path, "w") as parsed_file: with open(file_path) as cnn_dm: line = cnn_dm.readline().strip() article_idx = 0 while article_idx < from_line: line = cnn_dm.readline().s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main ():\n\n\tfio = fileIo('input.txt')\n text = fio.getInput()\n\n\tp = re.compile(r'#?\\d[\\s\\.]?[\\s]?')\n\tout = filter(None, p.split(text))\n\ti = 0\n\tlistOfLists = []\n\t\n\n\tfor s in out:\n\t\ti += 1\n\t\ttext = nltk.word_tokenize(s)\n\t\tpos = nltk.pos_tag(text)\n\t\tpattern = \"NP: {<DT>?<JJ...
[ "0.6942143", "0.65095925", "0.6476295", "0.64673996", "0.62523973", "0.625186", "0.6231466", "0.6204096", "0.61911345", "0.61845344", "0.61776495", "0.6155281", "0.6135536", "0.6135536", "0.6135536", "0.6103798", "0.6096503", "0.60951585", "0.60811174", "0.60290784", "0.60128...
0.6569378
1
Reads a file and counts the words frequency and total word count
def file_read(filename): fin=open(filename) count=0 d=dict() for line in fin: line=line.replace("-"," ") word=line.split() for item in word: item=item.strip(string.punctuation + string.whitespace) item=item.lower() d[item]=d.get(item,0)+1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_words(filename):", "def word_count_2(filename):\n\n with open(filename) as file_:\n # read file and lowercase all words\n words = file_.read().lower()\n # use translate to remove punc\n words = words.translate(None, string.punctuation)\n # call counter to count on ...
[ "0.82008404", "0.7888448", "0.7832937", "0.77919406", "0.7706766", "0.76518214", "0.76488185", "0.7634585", "0.76182836", "0.7587663", "0.75641406", "0.75639457", "0.7504516", "0.74861825", "0.7480002", "0.74630535", "0.74255395", "0.74054885", "0.7391366", "0.7357203", "0.73...
0.6632512
64
Prints the histogram dictionary
def print_dict(d): list1=list() for key,value in d.items(): list1.append((value,key)) list1.sort(reverse=True) for word,value in list1[:20]: print(word, value, sep='\t')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_hist(h):\n for k in h:\n print(k, h[k])", "def do_hist(self, args):\n print(self._hist)", "def show_histo(dict, orient=\"horiz\", label=\"counts\", title=\"title\"):\n plt.clf()\n plt.cla()\n if orient==\"horiz\":\n bar_fun = plt.barh \n bar...
[ "0.79336995", "0.7364849", "0.7264949", "0.7221877", "0.6844306", "0.67762184", "0.67736197", "0.670204", "0.6640156", "0.658255", "0.6464321", "0.6459065", "0.6452475", "0.6445913", "0.6416502", "0.6416502", "0.6401292", "0.6320839", "0.6299228", "0.62942815", "0.6251127", ...
0.0
-1
Calculate the closest cruising altitude to the given altitude.
def closest_cruising_altitude(altitude): return 1000 * ((altitude + 500) // 1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def altitude(self):\n if self.__altitude:\n return sum(self.__altitude) / len(self.__altitude)\n else:\n return -9999", "def altitude(self):\r\n pressure = self.pressure # in Si units for hPascal\r\n return 44330 * (1.0 - math.pow(pressure / self.sea_level_pressu...
[ "0.68563944", "0.6599064", "0.6381891", "0.6333543", "0.6299421", "0.6299421", "0.62524825", "0.61202556", "0.609955", "0.60223883", "0.5997195", "0.595264", "0.5929024", "0.59270704", "0.58204633", "0.5791743", "0.5770483", "0.5733085", "0.5660749", "0.5638563", "0.5614531",...
0.8231129
0
Determine whether an altitude may be a cruising altitude.
def is_cruising(altitude, cruise_altitude=None): if cruise_altitude is None: cruise_altitude = closest_cruising_altitude(altitude) return abs(altitude - cruise_altitude) <= 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_elevation(self):\n return not self._is_depth", "def altitude(self):\n if self.__altitude:\n return sum(self.__altitude) / len(self.__altitude)\n else:\n return -9999", "def is_slope(self):\n\t\tif self.high_elevation != self.low_elevation:\n\t\t\treturn True\n\...
[ "0.62690014", "0.60328066", "0.58956814", "0.58533365", "0.57905114", "0.5768535", "0.57448244", "0.5742459", "0.56997365", "0.56776786", "0.56776786", "0.5669931", "0.566654", "0.56537473", "0.5641513", "0.56306905", "0.5626469", "0.56141675", "0.55750054", "0.5573237", "0.5...
0.713465
0
Determine whether an altitude range may be at a cruising altitude.
def in_cruise_level_range(altitudes, cruise_altitude): return is_cruising(altitudes, cruise_altitude).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cruising(altitude, cruise_altitude=None):\n if cruise_altitude is None:\n cruise_altitude = closest_cruising_altitude(altitude)\n return abs(altitude - cruise_altitude) <= 200", "def check_altitude_at(self, altim, coords, altitude_bounds):\n altitude = altim.mesh.point_altitude(coords)...
[ "0.71779066", "0.61347663", "0.6049398", "0.59661514", "0.59199977", "0.58426267", "0.5821014", "0.57130736", "0.5702021", "0.5696651", "0.56564146", "0.56514233", "0.564707", "0.56175345", "0.560205", "0.5593734", "0.5585223", "0.5575167", "0.5550343", "0.5514078", "0.549265...
0.58846647
5
Find pairs of start/finish indicies of consecutive altitudes with the same value. I.e. where an aircraft was in level flight.
def find_level_sections(alts): # Get the indicies of positions at the starts and end of levels level_indicies = [] if len(alts) > 2: prev_alt = alts[0] alt = alts[1] # If the first two altitudea are the same, mark as is_level is_level = (prev_alt == alt) if is_level...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection_distances(self, altitude, start_distance, finish_distance):\n distances = []\n alt_index, alt_ratio = calculate_value_reference(self.distances,\n start_distance)\n start_alt = calculate_value(self.altitudes, alt_index, al...
[ "0.61895657", "0.57591677", "0.5693731", "0.55963063", "0.5349171", "0.5304589", "0.52295", "0.51885813", "0.51586705", "0.51529676", "0.5115243", "0.51014274", "0.5073773", "0.5066128", "0.5040757", "0.50405693", "0.5022069", "0.5019296", "0.50123805", "0.50085217", "0.49733...
0.61840254
1
Find pairs of start/finish indicies of altitudes where an aircraft was cruising.
def find_cruise_sections(altitudes): indicies = find_level_sections(altitudes) if indicies: prev_altitude = altitudes[indicies[0]] cruise_altitude = closest_cruising_altitude(prev_altitude) was_cruising = is_cruising(prev_altitude, cruise_altitude) prev_altitude = cruise_altitud...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection_distances(self, altitude, start_distance, finish_distance):\n distances = []\n alt_index, alt_ratio = calculate_value_reference(self.distances,\n start_distance)\n start_alt = calculate_value(self.altitudes, alt_index, al...
[ "0.6280308", "0.59270215", "0.58374995", "0.5785568", "0.5549861", "0.54942876", "0.5423105", "0.539191", "0.5391667", "0.5305186", "0.5304457", "0.5252072", "0.5251932", "0.5228445", "0.5205544", "0.51648146", "0.5155315", "0.51186764", "0.5109229", "0.5094685", "0.5079075",...
0.59695065
1
Create a numpy boolean array with all positions inbetween the starts and finishes of cruising sections marked as True.
def find_cruise_positions(num_altitudes, cruise_indicies): cruise_positions = np.zeros(num_altitudes, dtype=bool) if cruise_indicies: for index in range(0, len(cruise_indicies), 2): start = cruise_indicies[index] + 1 stop = cruise_indicies[index + 1] if start < stop:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enumerate_bool(bool_array, nstart=0):\n ind = bool_2_indices(bool_array)\n ns = np.full(bool_array.size, nstart, dtype=int)\n for n, lims in enumerate(ind):\n ns[lims[0]:lims[-1]] = nstart + n + 1\n return ns", "def masktoregions(in_mask):\n regions = []\n for i in [0,1]: # do the th...
[ "0.6591012", "0.64183784", "0.6045036", "0.5852564", "0.5838651", "0.5837393", "0.5796877", "0.5683957", "0.56573534", "0.55983865", "0.55705667", "0.554639", "0.5524945", "0.5523016", "0.5494886", "0.54834664", "0.54707986", "0.5469798", "0.54545856", "0.5441271", "0.5429074...
0.5647696
9
Set cruising altitudes to the closest cruising altitude.
def set_cruise_altitudes(altitudes, cruise_indicies): if cruise_indicies: for index in range(0, len(cruise_indicies), 2): start = cruise_indicies[index] stop = cruise_indicies[index + 1] if start < stop: cruise_altitude = closest_cruising_altitude(altitude...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_altitude(self):\n self.altitude = self.Calculations.convert_to_altitude( self.declination, self.right_ascension, self.Latitude, self.LHA)\n print('altitude set to', self.altitude)\n if self.altitude < 0:\n self.altitude = self.altitude + 360.0\n return self.altitu...
[ "0.6397559", "0.60705537", "0.58555746", "0.58198625", "0.5693789", "0.55685645", "0.5377789", "0.5350137", "0.5192501", "0.5148783", "0.51282614", "0.51085854", "0.51039815", "0.49786505", "0.49037406", "0.48799503", "0.48787838", "0.48784757", "0.48330465", "0.48201117", "0...
0.6250826
1
Classify an altitude profile based on the altitudes.
def classify_altitude_profile(altitudes): max_alt = altitudes.max() has_climb = (max_alt > altitudes[0]) has_descent = (max_alt > altitudes[-1]) if has_climb or has_descent: if has_climb != has_descent: return AltitudeProfileType.CLIMBING if has_climb \ else Altitude...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def altitude_profile(self, alt):\n # checking if the units entered are km\n if alt.unit == u.km:\n if 150 <= alt.value < 500:\n alt_properties = self._altitude_profile(500)\n else:\n alt_properties = self._altitude_profile(alt.value)\n\n retu...
[ "0.7040563", "0.60490364", "0.5742719", "0.569368", "0.56679446", "0.5570887", "0.5441801", "0.54371053", "0.5434901", "0.53988135", "0.52956814", "0.5294227", "0.5294227", "0.52853245", "0.5224944", "0.52045184", "0.51312333", "0.51289755", "0.50556916", "0.50430584", "0.503...
0.7570481
0
Interpolate altitudes at distance values. Uses the scipy.interpolate.interp1d function to linearly interpolate altitudes at the required distances.
def interpolate(self, distances): cs = interp1d(self.distances, self.altitudes, fill_value='extrapolate') return cs(distances)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate(self, distance, normalized=...): # -> BaseGeometry:\n ...", "def interpolate(i0, d0, i1, d1):\n if i0 == i1:\n return [d0]\n values = []\n a = (d1 - d0) / (i1 - i0)\n d = d0\n for i in range(i0,i1+1):\n values.append(d)\n d = d + a\n return values", ...
[ "0.6566528", "0.5902961", "0.58026075", "0.57675046", "0.5665642", "0.5541325", "0.5525913", "0.5521779", "0.5509595", "0.5484826", "0.5441326", "0.54245895", "0.5362832", "0.5246091", "0.52411157", "0.5231471", "0.5227989", "0.5221338", "0.5212287", "0.520249", "0.5196203", ...
0.8268463
0
Determine the range of altitudes between start_distance and finish_distance.
def altitude_range(self, start_distance, finish_distance): start_index, start_ratio = calculate_value_reference(self.distances, start_distance) start_alt = calculate_value(self.altitudes, start_index, start_ratio) finish_index, finish_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection_distances(self, altitude, start_distance, finish_distance):\n distances = []\n alt_index, alt_ratio = calculate_value_reference(self.distances,\n start_distance)\n start_alt = calculate_value(self.altitudes, alt_index, al...
[ "0.7745811", "0.5996923", "0.58210236", "0.5799497", "0.5713338", "0.57017654", "0.56947106", "0.5679401", "0.5613159", "0.5584916", "0.5583578", "0.55816114", "0.5579437", "0.54959893", "0.54946244", "0.5478117", "0.5467547", "0.5465406", "0.54653704", "0.54519516", "0.54467...
0.912184
0
Determine the index of the top of climb altitude. Returns The index of the first cruising altitude.
def top_of_climb_index(self): return self.altitudes.argmax()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_of_descent_index(self):\n tod = self.altitudes.argmax()\n # if the altitude profile is not just a climb\n # and there is a cruising section\n if (tod < len(self.altitudes) - 1) and \\\n (self.altitudes[tod] == self.altitudes[tod + 1]):\n tod += 1\n\n ...
[ "0.82650274", "0.6586973", "0.64087886", "0.63747007", "0.63523763", "0.62209785", "0.60802037", "0.6078412", "0.60293245", "0.60026336", "0.59891087", "0.5984468", "0.5980566", "0.5978508", "0.5973972", "0.59719825", "0.59692377", "0.5964401", "0.59599084", "0.59111434", "0....
0.84036976
0
Determine the index of the top of climb altitude. Returns The index of the last cruising altitude.
def top_of_descent_index(self): tod = self.altitudes.argmax() # if the altitude profile is not just a climb # and there is a cruising section if (tod < len(self.altitudes) - 1) and \ (self.altitudes[tod] == self.altitudes[tod + 1]): tod += 1 return to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_of_climb_index(self):\n return self.altitudes.argmax()", "def alt_index(self) -> Optional[int]:\n if not self.is_hom_alt():\n return None\n return max(self.allele1, self.allele2) - 1", "def top_offset(self):\n raise NotImplementedError", "def top(self):\n ...
[ "0.845523", "0.66592854", "0.6438688", "0.64357513", "0.64272976", "0.64195174", "0.6181029", "0.6179077", "0.6126768", "0.61237574", "0.6112536", "0.61075664", "0.61017954", "0.60960674", "0.60574836", "0.6043104", "0.60421985", "0.6038397", "0.6038397", "0.60144544", "0.601...
0.82606477
1
Determine the path distance of the top of climb altitude. Returns The path distance of the first cruising altitude.
def top_of_climb_distance(self): return self.distances[self.top_of_climb_index()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest_cruising_altitude(altitude):\n return 1000 * ((altitude + 500) // 1000)", "def find_closest_path(self):\n\t\tclosest_distance = sys.maxint\n\t\tclosest_path = 0\n\t\tbike_position = (self.map_model.bike.xB, self.map_model.bike.yB)\n\t\tfor path_index in range(len(self.map_model.paths)):\n\t\t\tnea...
[ "0.6739397", "0.63740313", "0.62297326", "0.6201111", "0.61479735", "0.6109232", "0.58568966", "0.57820773", "0.5728556", "0.5677432", "0.5653691", "0.5620571", "0.5601367", "0.55796075", "0.55561036", "0.5536733", "0.5516684", "0.55092776", "0.54958546", "0.5482631", "0.5458...
0.69647264
0
Determine the path distance of the top of descent altitude. Returns The path distance of the first cruising altitude.
def top_of_descent_distance(self): return self.distances[self.top_of_descent_index()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest_cruising_altitude(altitude):\n return 1000 * ((altitude + 500) // 1000)", "def top_of_descent_index(self):\n tod = self.altitudes.argmax()\n # if the altitude profile is not just a climb\n # and there is a cruising section\n if (tod < len(self.altitudes) - 1) and \\\n ...
[ "0.6641679", "0.6360074", "0.6237355", "0.6115602", "0.6089604", "0.5971742", "0.5874693", "0.58288443", "0.5771951", "0.57360345", "0.5729539", "0.57193947", "0.56928456", "0.5685602", "0.5612506", "0.5589079", "0.5577618", "0.557536", "0.55737656", "0.55690765", "0.55622447...
0.660244
1
Calculate distances where the profile is at the given altitude.
def intersection_distances(self, altitude, start_distance, finish_distance): distances = [] alt_index, alt_ratio = calculate_value_reference(self.distances, start_distance) start_alt = calculate_value(self.altitudes, alt_index, alt_ratio) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def altitude_profile(self, alt):\n # checking if the units entered are km\n if alt.unit == u.km:\n if 150 <= alt.value < 500:\n alt_properties = self._altitude_profile(500)\n else:\n alt_properties = self._altitude_profile(alt.value)\n\n retu...
[ "0.69530743", "0.65202653", "0.6478382", "0.6396903", "0.639056", "0.6178385", "0.6178385", "0.6144988", "0.60816115", "0.58620787", "0.58369505", "0.58215445", "0.58118826", "0.57391644", "0.5735804", "0.5733575", "0.57045203", "0.5664503", "0.56433076", "0.5625876", "0.5607...
0.67026734
1
esta es una funcion que recibe dos parametros y retorna la suma de ellos
def sum(a,v): return a+v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sum(a,b):\n return", "def sum(*args):\n result = 0\n for i in args:\n result += i\n return result", "def sums(arg1, arg2): # create function sums with arguments arg1 and arg2\n totals = arg1 + arg2 # set the variable totals to equal arg1 + arg2\n print(\"Inside the function :...
[ "0.7318327", "0.7009012", "0.698997", "0.6969839", "0.6940038", "0.6829298", "0.6651685", "0.6611744", "0.6542105", "0.6539168", "0.6525985", "0.6523398", "0.6488423", "0.6481863", "0.6465098", "0.64590466", "0.6432706", "0.64280194", "0.63407207", "0.6335891", "0.6335891", ...
0.6171152
33
Read a population from file and return a list of dictionaries of the relationships and the agents
def read_timestep(root_path: str, time: str): path = os.path.join(root_path, time) agent_file = glob.glob(os.path.join(path, "*_agents.csv"))[0] rel_file = glob.glob(os.path.join(path, "*_relationships.csv"))[0] feat_files = glob.glob(os.path.join(path, "*_feat_*.csv")) exposure_files = glob.glob(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self):\n\t\tentities = dict()\n\t\trelations = set()\n\t\tedges = set()\n\t\twith open(self.file_path, encoding=\"utf-8\") as f:\n\t\t\tfor line in tqdm(f):\n\t\t\t\tif(self.prob == 1.0 or random() < self.prob):\n\t\t\t\t\tsource, relation, target, _ = line.split(\" \", 3)\n\t\t\t\t\tis_dataprop = target....
[ "0.67748284", "0.6408295", "0.61751515", "0.5888248", "0.58689374", "0.58549124", "0.583973", "0.58324826", "0.5831974", "0.5760128", "0.5753357", "0.57407457", "0.5708623", "0.56422573", "0.5570306", "0.555868", "0.55579597", "0.5540641", "0.5510702", "0.5494685", "0.5494377...
0.51426554
61
Return pandas dataframe with annual, quarterly, monthly or daily data.
def get_frame(freq: str): url = 'http://minikep-db.herokuapp.com/api/frame?freq={}'.format(freq) return pd.read_csv(url, converters={0: pd.to_datetime}, index_col=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_series_data():\r\n # Grab the requested years and columns from the query arguments\r\n ls_year = [int(year) for year in request.args.getlist(\"n\")]\r\n ls_col = request.args.getlist(\"m\")\r\n\r\n # Generate a list of all the months we need to get\r\n all_years = [str(year) for year in...
[ "0.61230016", "0.6044962", "0.59703547", "0.5963478", "0.5958542", "0.59389883", "0.5922768", "0.5885662", "0.58801645", "0.58436364", "0.5840979", "0.58044046", "0.57593805", "0.57528985", "0.5697548", "0.5684046", "0.5673133", "0.564309", "0.56324506", "0.56079215", "0.5598...
0.0
-1
Run a simulation with the standard and Galilean scheme respectively and check that the first one is unstable while the second one is stable
def test_cherenkov_instability( show=False ): # Dictionary to record the final value of E slope_Erms = {} for scheme in [ 'standard', 'galilean', 'pseudo-galilean']: # Choose the correct parameters for the scheme if scheme == 'standard': v_comoving = 0. use_galilean...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_1_do_valid_sim(self) :\n self.banner(\"Testing if simulation gives the right percentages.\")\n filename = self.find_file('project9.py')\n self.assertIsNotNone(filename, \"I can't find your project file (project9.py)\")\n\n with open('logs/test_1_valid_sim.out', 'a') as log :\n ...
[ "0.68798894", "0.67589664", "0.6691962", "0.6658642", "0.66065735", "0.6502654", "0.6430964", "0.6405235", "0.62871385", "0.6238632", "0.6205848", "0.62035537", "0.6201428", "0.6168178", "0.61394686", "0.611758", "0.60966617", "0.6089579", "0.6072231", "0.60561776", "0.603497...
0.5700753
63
Return a string representation of the config.
def __str__(self): # top row result = ' ' result = '\n ' + '-' * (self.DIM*2+5) + '\n' # board rows for row in range(self.DIM): if row is 3 or row is 6: result += '|' + '-' * (self.DIM*2+5) + '|' + '\n' # result +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__():\n return str(_config)", "def __str__(self):\n config_str = 'Configurations\\n'\n config_str += pprint.pformat(self.__dict__)\n return config_str", "def __repr__(self) -> str:\n return json.dumps(self._config)", "def str(self):\n\n list_of_entries = ['{0} n...
[ "0.85173273", "0.8513157", "0.8259779", "0.7956899", "0.77279353", "0.7583788", "0.7550117", "0.7511544", "0.7511544", "0.7487914", "0.74800324", "0.74372464", "0.7417465", "0.737675", "0.73606914", "0.7319001", "0.72816837", "0.7248459", "0.7144512", "0.7063809", "0.68749636...
0.0
-1
Checks whether a config is a goal or not
def isGoal(self): for index in range(self.DIM): if not self.values('r',index).count(0) is 0: return False if not self.isValid(): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_goal(puzzle_state, goal):\n return puzzle_state.config == goal", "def test_goal(state):\r\n \r\n if state.config == (0,1,2,3,4,5,6,7,8):\r\n return True\r\n else:\r\n return False", "def check_config(cfg):", "def is_goal(self, url):\n return url == self.goal_url", ...
[ "0.7215837", "0.6925614", "0.68441874", "0.67809874", "0.6737237", "0.66554487", "0.6639001", "0.6628785", "0.6553829", "0.6422694", "0.6376019", "0.63585305", "0.63565326", "0.63558185", "0.6341891", "0.63215846", "0.63215846", "0.6273997", "0.6273997", "0.6271821", "0.62718...
0.54483956
84
Compute the entropy of the mean of the predictive distribution obtained from Monte Carlo sampling during prediction phase.
def predictive_entropy(mc_preds): return entropy(np.mean(mc_preds, axis=0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n return -np.sum(self.log_likelihoods * np.exp(self.log_likelihoods))", "def entropy(y):\n EPS = 0.0005\n\n # YOUR CODE HERE\n if len(y) == 0:\n return 0.\n \n pk = np.mean(y, axis=0)\n \n return - np.sum(pk * np.log(pk + EPS))", "def entropy(self):\n Z ...
[ "0.7530867", "0.74424595", "0.74055004", "0.7329188", "0.7220066", "0.7200022", "0.7160352", "0.7152894", "0.71405065", "0.70775807", "0.70759517", "0.7073769", "0.70580447", "0.70529985", "0.7017805", "0.69966227", "0.69941026", "0.69562703", "0.6955483", "0.69474715", "0.69...
0.6855338
28
Compute the difference between the entropy of the mean of the predictive distribution and the mean of the entropy.
def mutual_information(mc_preds): mutual_info = entropy(np.mean(mc_preds, axis=0)) - np.mean(entropy(mc_preds), axis=0) return mutual_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n return -np.sum(self.log_likelihoods * np.exp(self.log_likelihoods))", "def entropy(img):\n # by calculating\n histogram = img.histogram()\n histogram_size = sum(histogram)\n histogram = [float(h) / histogram_size for h in histogram]\n\n return -sum([p * math.log(p, 2) f...
[ "0.73744655", "0.6969958", "0.6913475", "0.68965644", "0.6835691", "0.68118334", "0.6751494", "0.66962296", "0.6673262", "0.666841", "0.6663414", "0.66559005", "0.66333395", "0.660028", "0.6595049", "0.6591081", "0.6569786", "0.6554377", "0.65446806", "0.65093774", "0.6505853...
0.0
-1
sigma is represented by softplus function 'sigma = log(1 + exp(rho))' to make sure it remains always positive and nontransformed 'rho' gets updated during backprop.
def get_rho(sigma, delta): rho = torch.log(torch.expm1(delta * torch.abs(sigma)) + 1e-20) return rho
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rho2sigma(rho):\n return pt.softplus(rho)", "def sigma2rho(sigma):\n return pt.log(pt.exp(pt.abs(sigma)) - 1.0)", "def mbh_sigma(sigma):\n _MASS = 8.32\n _SLOPE = 5.64\n _VEL = 200e5\n\n mbh = _MASS + _SLOPE*np.log10(sigma/_VEL)\n mbh = np.power(10.0, mbh) * MSOL\n return mbh", "d...
[ "0.735956", "0.7310387", "0.6823238", "0.6799738", "0.66822535", "0.66129714", "0.65858775", "0.6508815", "0.6486363", "0.6454253", "0.6414886", "0.6321964", "0.6282718", "0.6269426", "0.6257471", "0.624839", "0.6226637", "0.61909837", "0.6161841", "0.6161265", "0.6147177", ...
0.6352347
11
Set the priors and initialize surrogate posteriors of Bayesian NN with Empirical Bayes MOPED (Model Priors with Empirical Bayes using Deterministic DNN) Example implementation for Bayesian model with variational layers.
def MOPED(model, det_model, det_checkpoint, delta): det_model.load_state_dict(torch.load(det_checkpoint)) for (idx, layer), (det_idx, det_layer) in zip(enumerate(model.modules()), enumerate(det_model.modules())): if (str(layer) == 'Conv1dRe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_bn(bn):\n \n bn.bias.data.fill_(0.)\n bn.running_mean.data.fill_(0.)\n bn.weight.data.fill_(1.)\n bn.running_var.data.fill_(1.)", "def naiveBayes(train_set, train_labels, dev_set, smoothing_parameter, pos_prior):\n # TODO: Write your code here\n # return predicted labels of developm...
[ "0.6395938", "0.63691896", "0.6234702", "0.62117696", "0.6144598", "0.6126539", "0.61065125", "0.61020076", "0.60287267", "0.60050046", "0.60005945", "0.59805095", "0.59656256", "0.59533674", "0.5929694", "0.5922263", "0.58944905", "0.58921105", "0.5883023", "0.58764946", "0....
0.0
-1
THIS FUNCTION REMOVES THE PLANNED EVENTS FROM THE EVENT DATASET
def removePlanned(X,y): X_new=[] y_new=[] for i in range(len(y)): #print(i) if y[i]==0: y_new.append(0) X_new.append(X[i,:,:,:]) elif y[i]==1: y_new.append(1) X_new.append(X[i,:,:,:]) elif y[i]==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OnRearrangeEnd(self, evt):\n\t\tself._potentialRearrange = False\n\t\tself._didCopy = False\n\t\tevt.Skip()", "def bindEvents(fusionEvents,divisionEvents, buff):\n #1/Finding correspondances\n fusion_indices = []\n fusion_labels = []\n fusion_labels_2 = [] # In label 2 says with which cell the d...
[ "0.58445203", "0.5509604", "0.538551", "0.5352465", "0.5347396", "0.53318274", "0.5314644", "0.52846736", "0.5262972", "0.5220926", "0.52139837", "0.51859725", "0.5173534", "0.51570314", "0.51506615", "0.5138261", "0.51148987", "0.5111304", "0.5085959", "0.5082112", "0.505955...
0.0
-1