query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
reinterpolate filter onto a different wavelength definition
def reinterp(self, lamb): _wavelength = self._get_filter_in_units_of(lamb) _lamb = _drop_units(lamb) try: _unit = str(lamb.unit) except Exception: _unit = self.wavelength_unit ifT = np.interp(_lamb, _wavelength, self.transmit, left=0., right=0.) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resample_reflectance(self):\n\n if hasattr(self, \"rwl\"):\n p = interp1d(self.rwl, self.rfl, fill_value=\"extrapolate\")\n self.rfl = p(self.wl)", "def resample(s, p, q, h=None):\n gcd = fractions.gcd(p,q)\n if gcd>1:\n p=p/gcd\n q=q/gcd\n \n if h is No...
[ "0.6383628", "0.60955614", "0.60717416", "0.60653806", "0.59721863", "0.5953074", "0.5816698", "0.57851815", "0.5768415", "0.57580215", "0.574561", "0.57300204", "0.5692947", "0.5690219", "0.5674145", "0.56538874", "0.56202507", "0.55962974", "0.55775946", "0.55615264", "0.55...
0.62156713
1
AB magnitude zero point ABmag = 2.5 log10(f_nu) 48.60 = 2.5 log10(f_lamb) 2.5 log10(lpivot 2 / c) 48.60 = 2.5 log10(f_lamb) zpts
def AB_zero_mag(self): if self.wavelength_unit is None: raise AttributeError('Needs wavelength units') C1 = (Unit(self.wavelength_unit).to('AA') ** 2 / Constants.c.to('AA/s').value) c1 = self._lpivot ** 2 * C1 m = 2.5 * np.log10(_drop_units(c1)) + 48.6 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AB_zero_mag(self):\n return self._get_mean_and_samples_attribute('AB_zero_mag')", "def ST_zero_mag(self):\n return 21.1", "def ST_zero_mag(self):\n return 21.1", "def AB_zero_flux(self):\n return 10 ** (-0.4 * self.AB_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')", "def mab0(s...
[ "0.6977201", "0.68679166", "0.68679166", "0.6799448", "0.6656626", "0.65834796", "0.6518073", "0.6509205", "0.645562", "0.6405983", "0.6377343", "0.63231117", "0.6235717", "0.62258434", "0.6122805", "0.6050308", "0.6024713", "0.60232484", "0.59142274", "0.5909967", "0.5908211...
0.750945
0
AB flux zero point in erg/s/cm2/AA
def AB_zero_flux(self): return 10 ** (-0.4 * self.AB_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ST_zero_flux(self):\n return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')", "def ST_zero_flux(self):\n return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s-1*cm-2*AA-1')", "def AB_zero_flux(self):\n return self._get_mean_and_samples_attribute('AB_zero_flux')", "d...
[ "0.716763", "0.7129419", "0.704939", "0.6842085", "0.6709144", "0.6631988", "0.6543609", "0.65265054", "0.65156466", "0.65156466", "0.62777597", "0.6157258", "0.61449903", "0.6144128", "0.6081448", "0.6073674", "0.60664755", "0.60664755", "0.59975666", "0.59927064", "0.594510...
0.82660484
0
AB flux zero point in Jansky (Jy)
def AB_zero_Jy(self): c = 1e-8 * Constants.c.to('m/s').value f = 1e5 / c * self.lpivot.to('AA').value ** 2 * self.AB_zero_flux.value return f * Unit('Jy')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Vega_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').value\n f = 1e5 / c * (self.lpivot.to('AA').value ** 2 *\n self.Vega_zero_flux.to('erg*s**-1*cm**-2*AA**-1').value)\n return f * Unit('Jy')", "def ST_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').valu...
[ "0.7955171", "0.7926594", "0.74460584", "0.7234044", "0.7013625", "0.67468727", "0.66445875", "0.6607706", "0.6427392", "0.62358874", "0.60310906", "0.5993075", "0.59417474", "0.5927505", "0.5927505", "0.59052306", "0.5900024", "0.58882886", "0.5878071", "0.5853615", "0.58445...
0.8312335
0
vega magnitude zero point vegamag = 2.5 log10(f_lamb) + 2.5 log10(f_vega) vegamag = 2.5 log10(f_lamb) zpts
def Vega_zero_mag(self): flux = self.Vega_zero_flux.value if flux > 0: return -2.5 * np.log10(flux) else: return float('nan')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vega(flag, S, K, t, r, sigma, q):\n\n b = r-q\n\n return numerical_vega(flag, S, K, t, r, sigma, b, f)", "def V_magEarth(alpha,a_p,d):\n V = 5.*np.log10(a_p*d) - 3.99 - 1.060e-3*alpha + 2.054e-4*alpha**2.\n return V", "def Vega_zero_mag(self):\n return self._get_mean_and_samples_attribut...
[ "0.67029834", "0.6667549", "0.6486545", "0.63148516", "0.6298954", "0.62815887", "0.62498194", "0.6225363", "0.6209063", "0.6207316", "0.61869746", "0.6174291", "0.6006104", "0.5963952", "0.5937853", "0.5922701", "0.5920357", "0.5866976", "0.5846626", "0.58458304", "0.5827988...
0.67359966
0
Vega flux zero point in Jansky (Jy)
def Vega_zero_Jy(self): c = 1e-8 * Constants.c.to('m/s').value f = 1e5 / c * (self.lpivot.to('AA').value ** 2 * self.Vega_zero_flux.to('erg*s**-1*cm**-2*AA**-1').value) return f * Unit('Jy')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ST_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').value\n f = 1e5 / c * self.lpivot.to('AA').value ** 2 * self.ST_zero_flux.value\n return f * Unit('Jy')", "def Vega_zero_Jy(self):\n return self._get_mean_and_samples_attribute('Vega_zero_Jy')", "def AB_zero_Jy(self):\n ...
[ "0.78034115", "0.7717615", "0.74681675", "0.6807964", "0.6759582", "0.6725391", "0.6689461", "0.6658358", "0.6530621", "0.6493975", "0.63182706", "0.6184906", "0.6149092", "0.60269374", "0.60091394", "0.59725505", "0.5924603", "0.5868209", "0.585497", "0.5825818", "0.58106613...
0.8467789
0
ST magnitude zero point STmag = 2.5 log10(f_lamb) 21.1
def ST_zero_mag(self): return 21.1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ST_zero_flux(self):\n return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')", "def test_filt_stmag(self):\n sun = Sun.from_builtin('E490_2014')\n V = get_bandpass('johnson v')\n wave, fluxd = sun.filt(V, unit=u.STmag)\n assert np.isclose(fluxd.value, -26....
[ "0.70093596", "0.70056516", "0.69857174", "0.66712135", "0.66427356", "0.64054024", "0.64032966", "0.63863283", "0.6375994", "0.6238827", "0.61884826", "0.6102049", "0.605229", "0.59105134", "0.5887578", "0.58761245", "0.5853663", "0.58294916", "0.5828813", "0.58283526", "0.5...
0.78919375
1
ST flux zero point in erg/s/cm2/AA
def ST_zero_flux(self): return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ST_zero_flux(self):\n return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s-1*cm-2*AA-1')", "def AB_zero_flux(self):\n return 10 ** (-0.4 * self.AB_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')", "def ST_zero_mag(self):\n return 21.1", "def ST_zero_mag(self):\n return 21.1", "d...
[ "0.8245029", "0.77343595", "0.70692843", "0.70692843", "0.684692", "0.68266964", "0.6662627", "0.64646906", "0.64527726", "0.627065", "0.624938", "0.62479645", "0.6240618", "0.6197398", "0.6185988", "0.6144766", "0.6143519", "0.6143519", "0.6035437", "0.60247666", "0.5987293"...
0.8266477
0
ST flux zero point in Jansky (Jy)
def ST_zero_Jy(self): c = 1e-8 * Constants.c.to('m/s').value f = 1e5 / c * self.lpivot.to('AA').value ** 2 * self.ST_zero_flux.value return f * Unit('Jy')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Vega_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').value\n f = 1e5 / c * (self.lpivot.to('AA').value ** 2 *\n self.Vega_zero_flux.to('erg*s**-1*cm**-2*AA**-1').value)\n return f * Unit('Jy')", "def AB_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').valu...
[ "0.8031575", "0.778421", "0.7555299", "0.72557306", "0.7240692", "0.72306865", "0.6943848", "0.65948164", "0.62189764", "0.61693907", "0.61246616", "0.60580975", "0.6041487", "0.6037732", "0.6037732", "0.6031515", "0.5998121", "0.59702444", "0.5884703", "0.5825851", "0.582134...
0.8516831
0
Generate a filter object from a sklearn GP model
def from_gp_model(cls, model, xprime=None, n_samples=10, **kwargs): if xprime is None: xpred = model.X_train_ else: xpred = np.unique(np.hstack([_drop_units(xprime), model.X_train_.ravel()])) xpred = xpred.reshape(1, -1).T ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterf(self):\n from scipy.ndimage.filters import gaussian_filter as gf\n self._obj['u'] = xr.DataArray(gf(self._obj['u'],1),dims=('x','y'))\n self._obj['v'] = xr.DataArray(gf(self._obj['v'],1),dims=('x','y'))\n return self._obj", "def train_filter2(filt, U, Y):\n n = len(U)\n...
[ "0.5598858", "0.5555784", "0.55340725", "0.54918313", "0.54744756", "0.54694295", "0.54687625", "0.5445901", "0.5443735", "0.5411385", "0.5405226", "0.53806835", "0.5366116", "0.5352891", "0.53460985", "0.53263104", "0.5323055", "0.53219515", "0.5308474", "0.52955925", "0.529...
0.6448935
0
Returns the attribute from all samples
def _get_samples_attribute(self, attr, *args, **kwargs): try: vals = [getattr(fk, attr)(*args, **kwargs) for fk in self.samples_] except TypeError: vals = [getattr(fk, attr) for fk in self.samples_] try: unit_ = Unit(str(vals[0].unit)) return np.ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_sample(self):\n return [layer._get_sample() for layer in self.layers]", "def _get_mean_and_samples_attribute(self, attr, *args, **kwargs):\n return (self._get_mean_attribute(attr, *args, **kwargs),\n self._get_samples_attribute(attr, *args, **kwargs))", "def getattrs(self,...
[ "0.6724057", "0.64753133", "0.6256117", "0.62497234", "0.61722106", "0.61034846", "0.60644203", "0.5994633", "0.59837276", "0.59551066", "0.59516436", "0.59206325", "0.590351", "0.58908194", "0.58593976", "0.5857183", "0.58562446", "0.5854983", "0.58479047", "0.58466595", "0....
0.74103487
0
Returns the attribute from the mean passband
def _get_mean_attribute(self, attr, *args, **kwargs): attr = getattr(self.mean_, attr) try: return attr(*args, **kwargs) except TypeError: return attr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMean(self):\n return self.mean", "def mean(self):\r\n\t\treturn sum(self.sample)/len(self.sample)", "def _mean(self,gp):\r\n return self.gp_link.transf(gp)", "def _mean(self,gp):\r\n return self.gp_link.transf(gp)", "def _mean(self,gp):\r\n return self.gp_link.transf(gp)"...
[ "0.6703737", "0.65768284", "0.6554898", "0.6554898", "0.6554898", "0.6554898", "0.6554898", "0.6549539", "0.651033", "0.6477349", "0.6470019", "0.6453719", "0.6453719", "0.6441814", "0.64380246", "0.6393722", "0.63826346", "0.6331023", "0.6312477", "0.62369126", "0.6231755", ...
0.6751219
0
Compute / extract mean and smapled filter attributes
def _get_mean_and_samples_attribute(self, attr, *args, **kwargs): return (self._get_mean_attribute(attr, *args, **kwargs), self._get_samples_attribute(attr, *args, **kwargs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mean(self):\n return [layer._get_mean() for layer in self.layers]", "def calc_attribute_statistics(self, statistic_name):\n stats = {}\n for var, grids in self.attributes.items():\n if len(grids) > 1:\n stats[var] = getattr(np.array([getattr(np.ma.array(x, ...
[ "0.6115722", "0.5960434", "0.58482903", "0.5760802", "0.56175965", "0.56162804", "0.5602458", "0.55813533", "0.55785525", "0.55755043", "0.55487376", "0.549916", "0.5488912", "0.54722214", "0.54548573", "0.5454642", "0.54250157", "0.5421319", "0.5415814", "0.53890353", "0.538...
0.6162975
0
getNphot the number of photons through the filter (Ntot / width in the documentation) getflux() leff / hc
def get_Nphotons(self, slamb, sflux, axis=-1): mean, samples = self._get_mean_and_samples_attribute('get_Nphotons', slamb, sflux, axis=axis) return mean, samples
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_Nphotons(self, slamb, sflux, axis=-1):\n passb = self.reinterp(slamb)\n wave = passb._wavelength\n dlambda = np.diff(wave)\n\n # h = 6.626075540e-27 # erg * s\n # c = 2.99792458e18 # AA / s\n h = Constants.h.to('erg * s').value\n c = Constants.c.to('...
[ "0.70405966", "0.64878976", "0.58738786", "0.5788357", "0.5781081", "0.5660325", "0.5635365", "0.5635365", "0.5635365", "0.5635365", "0.5603567", "0.55821246", "0.5564966", "0.5492401", "0.5468139", "0.5440928", "0.54347175", "0.54328865", "0.54046637", "0.53848064", "0.53453...
0.6628743
1
AB magnitude zero point ABmag = 2.5 log10(f_nu) 48.60 = 2.5 log10(f_lamb) 2.5 log10(lpivot 2 / c) 48.60 = 2.5 log10(f_lamb) zpts
def AB_zero_mag(self): return self._get_mean_and_samples_attribute('AB_zero_mag')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AB_zero_mag(self):\n if self.wavelength_unit is None:\n raise AttributeError('Needs wavelength units')\n\n C1 = (Unit(self.wavelength_unit).to('AA') ** 2 /\n Constants.c.to('AA/s').value)\n c1 = self._lpivot ** 2 * C1\n\n m = 2.5 * np.log10(_drop_units(c1)) +...
[ "0.75092745", "0.68668735", "0.68668735", "0.67999184", "0.6657533", "0.65834665", "0.6518293", "0.65089595", "0.6455892", "0.6407031", "0.63776344", "0.6323117", "0.6235063", "0.6224511", "0.6121852", "0.604906", "0.6026076", "0.6022463", "0.5913845", "0.5909682", "0.5907152...
0.6977242
1
Vega magnitude zero point Vegamag = 2.5 log10(f_lamb) + 2.5 log10(f_vega) Vegamag = 2.5 log10(f_lamb) zpts
def Vega_zero_mag(self): return self._get_mean_and_samples_attribute('Vega_zero_mag')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Vega_zero_mag(self):\n flux = self.Vega_zero_flux.value\n if flux > 0:\n return -2.5 * np.log10(flux)\n else:\n return float('nan')", "def V_magEarth(alpha,a_p,d):\n V = 5.*np.log10(a_p*d) - 3.99 - 1.060e-3*alpha + 2.054e-4*alpha**2.\n return V", "def vega(f...
[ "0.7171862", "0.6595487", "0.6569158", "0.6311985", "0.6289262", "0.62558156", "0.6234904", "0.61879754", "0.616959", "0.61420524", "0.6128055", "0.61219585", "0.60586685", "0.6034381", "0.60135555", "0.5930348", "0.5930348", "0.5911923", "0.590989", "0.5858539", "0.58078855"...
0.69578356
1
ST magnitude zero point STmag = 2.5 log10(f_lamb) 21.1
def ST_zero_mag(self): return 21.1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ST_zero_flux(self):\n return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')", "def test_filt_stmag(self):\n sun = Sun.from_builtin('E490_2014')\n V = get_bandpass('johnson v')\n wave, fluxd = sun.filt(V, unit=u.STmag)\n assert np.isclose(fluxd.value, -26....
[ "0.70093596", "0.70056516", "0.69857174", "0.66712135", "0.66427356", "0.64054024", "0.64032966", "0.63863283", "0.6375994", "0.6238827", "0.61884826", "0.6102049", "0.605229", "0.59105134", "0.5887578", "0.58761245", "0.5853663", "0.58294916", "0.5828813", "0.58283526", "0.5...
0.78919375
0
ST flux zero point in erg/s/cm2/AA
def ST_zero_flux(self): return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s-1*cm-2*AA-1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ST_zero_flux(self):\n return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')", "def AB_zero_flux(self):\n return 10 ** (-0.4 * self.AB_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')", "def ST_zero_mag(self):\n return 21.1", "def ST_zero_mag(self):\n return 21.1"...
[ "0.8266477", "0.77343595", "0.70692843", "0.70692843", "0.684692", "0.68266964", "0.6662627", "0.64646906", "0.64527726", "0.627065", "0.624938", "0.62479645", "0.6240618", "0.6197398", "0.6185988", "0.6144766", "0.6143519", "0.6143519", "0.6035437", "0.60247666", "0.5987293"...
0.8245029
1
Load a given filter from the library
def _load_filter(self, *args, **kwargs): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadFilterFromString(spec):\n return _loadPluginFromString(spec, \"ufo2ft.filters\", isValidFilter)", "def _load_filter(self, fname, interp=True, lamb=None):\n ftab = self.hdf\n if hasattr(fname, 'decode'):\n fnode = ftab.get_node('/filters/' + fname.decode('utf8'))\n else:...
[ "0.75968057", "0.70919794", "0.69015753", "0.6695019", "0.6441112", "0.6273668", "0.6259896", "0.6256544", "0.6248356", "0.6239601", "0.6229317", "0.6228274", "0.61151403", "0.6083157", "0.6026182", "0.59057593", "0.5899445", "0.58482784", "0.5821672", "0.5782775", "0.5756555...
0.73968077
1
get the content of the library
def get_library_content(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content(self):\n return self.get_library_content()", "def readLib(self):\n\t\tdata = self._fileSystem.readLib()\n\t\tif data is None:\n\t\t\treturn\n\t\treturn data", "def get_contents(self):\n return self.contents", "def get_library_contents(response, renderer):\n section = nav(response...
[ "0.8511772", "0.6993598", "0.6885686", "0.65129954", "0.65006393", "0.64867944", "0.6454429", "0.64482415", "0.64347655", "0.63638264", "0.6346293", "0.6312119", "0.63096035", "0.6298098", "0.62693954", "0.623425", "0.61868805", "0.61564106", "0.61414844", "0.6118693", "0.605...
0.85394984
0
load all filters from the library
def load_all_filters(self, interp=True, lamb=None): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_all_filters(self, interp=True, lamb=None):\n with self as s:\n filters = [s._load_filter(fname, interp=interp, lamb=lamb)\n for fname in s.content]\n return(filters)", "def load_filters(self, names, interp=True, lamb=None, filterLib=None):\n with sel...
[ "0.78087586", "0.7530279", "0.7500185", "0.7447812", "0.7330729", "0.71112865", "0.7016552", "0.69027936", "0.6864769", "0.6738107", "0.6726803", "0.6697813", "0.65649813", "0.6521842", "0.64098865", "0.64028484", "0.63616914", "0.634798", "0.62925076", "0.62066776", "0.61431...
0.8180436
0
add a filter to the library
def add_filter(self, f): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_filter(self, filter_):\n assert has_pil, _(\"Cannot add filters without python PIL\")\n self.cache.basename += filter_.basename\n self._filters.append(filter_)", "def add_filter(self, filter_):\n assert has_pil, _(\"Cannot add filters without python PIL\")\n self.cache.basename += filter...
[ "0.78028697", "0.7633678", "0.748139", "0.71143806", "0.703943", "0.693967", "0.6887877", "0.68420005", "0.67931646", "0.6627338", "0.65784967", "0.6577305", "0.65766436", "0.6523976", "0.65038943", "0.64773965", "0.647592", "0.6474607", "0.64635956", "0.644521", "0.6429036",...
0.77451843
1
load all filters from the library
def load_all_filters(self, interp=True, lamb=None): with self as s: filters = [s._load_filter(fname, interp=interp, lamb=lamb) for fname in s.content] return(filters)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_all_filters(self, interp=True, lamb=None):\n raise NotImplementedError", "def load_filters(self, names, interp=True, lamb=None, filterLib=None):\n with self as s:\n filters = [s._load_filter(fname, interp=interp, lamb=lamb)\n for fname in names]\n re...
[ "0.8180436", "0.7530279", "0.7500185", "0.7447812", "0.7330729", "0.71112865", "0.7016552", "0.69027936", "0.6864769", "0.6738107", "0.6726803", "0.6697813", "0.65649813", "0.6521842", "0.64098865", "0.64028484", "0.63616914", "0.634798", "0.62925076", "0.62066776", "0.614311...
0.78087586
1
return the unitwise definition corresponding to attrname
def _get_wavelength_attrs_with_units(self, attrname, units='AA'): attr = self._lick[attrname] if self.wavelength_unit is not None: if units is None: return attr * Unit(self.wavelength_unit) else: return (attr * Unit(self.wavelength_unit)).to(units)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_wavelength_attrs_with_units(self, attrname, units='AA'):\n attr = self._lick[attrname]\n if self.wavelength_unit is not None:\n if units is None:\n return attr * unit[self.wavelength_unit]\n else:\n return (attr * unit[self.wavelength_unit]...
[ "0.64409405", "0.6042665", "0.5773346", "0.5735111", "0.5649198", "0.5624956", "0.5622651", "0.5577118", "0.5577118", "0.5542587", "0.55418724", "0.55399543", "0.5535312", "0.55154866", "0.5480237", "0.54755723", "0.54584", "0.54584", "0.5439651", "0.5430621", "0.5420445", ...
0.6371507
1
Get all entries for an order and return as dict
def get_entries(order): users_entries = {} for item in order.items.all(): entries_per_order = [] entries = Entries.objects.filter(orderItem=item.id) for ent in entries: entries_per_order.append(ent.ticket_number) n_order = { item.id: entries_per_order ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_orders():", "def entries(self):\n return [self._entries[key] for key in self._order]", "def get_all_orders(): \n data = order_obj.get_all_orders()\n return data", "def getOrderList(self):\r\n\t\treturn self.pair.orders", "def get_orders(self):\n return self.order_lst", "de...
[ "0.7248802", "0.680115", "0.6725054", "0.65615946", "0.6542533", "0.6410013", "0.6370044", "0.634741", "0.6155912", "0.6083449", "0.6071332", "0.606243", "0.6045189", "0.59691536", "0.59410083", "0.5935402", "0.5848316", "0.5812314", "0.57936823", "0.57831043", "0.5770468", ...
0.7675266
0
Send out email to user with the order details
def email_order(request, order, user_correct): users_entries = get_entries(order) html_email = loader.render_to_string( 'email_templates/order_complete.html', { 'order': order, 'user': request.user.first_name, 'user_correct': user_correct, 'users_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_email_details(self, order):\n customer_email = order.email\n email_subject = render_to_string(\n 'checkout/confirmation_emails/confirmation_email_subject.txt',\n {'order': order})\n email_body = render_to_string(\n 'checkout/confirmation_emails/confir...
[ "0.82928586", "0.7682682", "0.74174416", "0.7049885", "0.70146614", "0.6994562", "0.6991252", "0.6910069", "0.6819035", "0.6795749", "0.6749802", "0.660168", "0.64808744", "0.6464286", "0.6408604", "0.6406102", "0.63820356", "0.6380898", "0.63727355", "0.6362171", "0.63594854...
0.7942199
1
Update users orders in database
def update_orders(comp, order, user_correct, payment_id): users_orders = [] for item in order.items.all(): users_orders.append(item.id) item.is_paid = True item.save() order.related_competition = comp order.payment_id = payment_id order.order_date = timezone.now() order.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(user, **data):\n try:\n orderId = data.pop('orderId')\n update_rows = Order_basic.order_basic_.filter(consumer=user, orderId=orderId).update(**data)\n return True if update_rows else False\n except Exception as e:\n order_logger.error(e)\n ...
[ "0.71447766", "0.70835954", "0.6827732", "0.6827732", "0.6599464", "0.65368444", "0.65053654", "0.6435917", "0.64278644", "0.6398214", "0.63606465", "0.6309719", "0.63009673", "0.6243627", "0.62345177", "0.6124453", "0.61230206", "0.6080172", "0.6067192", "0.60656226", "0.594...
0.75842
0
Function handle all process if a customer has paid
def customer_paid(request, user_correct, tickets, total, payment_id): comp = Competition.objects.get(is_active=True) user = User.objects.get(id=request.user.id) order = Order.objects.get(user=user, ordered=False) new_order = update_orders(comp, order, user_correct, payment_id) if user_correct: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def awaiting_payment(self):", "def check_order(customer_name, expected_cost, customer_paid):\n\n if expected_cost != customer_paid:\n if expected_cost > customer_paid:\n payment_status = \"UNDERPAID\"\n else: \n payment_status = \"OVERPAID\"\n\n print(f\" {custome...
[ "0.6338793", "0.62812805", "0.6188702", "0.61725444", "0.60997164", "0.607243", "0.6052188", "0.6034899", "0.603349", "0.60248625", "0.60189545", "0.6015979", "0.59833497", "0.5955738", "0.5948259", "0.5940025", "0.58785355", "0.5872602", "0.5840848", "0.5765213", "0.57647526...
0.6774195
0
Takes the 52 individual ensembles and combines them into one compact NetCDF file, saving disk space in the process.
def compress_netcfd(folder_path, start_date, out_folder, file_name, num_of_rivids): # Based on 15 day forecast forecast_day_indices = np.array([0, 8, 16, 24, 32, 40, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84], dtype=np.int8) # Based on 10 day forecast # Excluding the first day because we already have ini...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_merged_file(self):\n \n #out_name = os.getcwd() + '/FAST_INDEX_merged_' + [ x for x in self.datasets[ list(self.datasets_keys)[0]].split('/') if '.nc' in x ] [0] \n \n \"\"\" Loading the econding of variables created from the harvester script \"\"\"\n ...
[ "0.7081038", "0.6392346", "0.62749016", "0.62383837", "0.6200879", "0.6200152", "0.61951476", "0.61918885", "0.6172677", "0.6155779", "0.61530745", "0.6125468", "0.5967592", "0.59602165", "0.5957002", "0.5939759", "0.592656", "0.5870345", "0.58490396", "0.5845654", "0.5805312...
0.6880475
1
Enqueues the funcs for execution
def Enqueue( funcs: List[Callable[[], None]], ) -> List[Future]: raise Exception("Abstract method") # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Enqueue(\r\n funcs: List[Callable[[], None]],\r\n ) -> List[Future]:\r\n raise Exception(\"Abstract method\") # pragma: no cover\r", "def enqueue(self, func):\n self.queue.put(func)", "def enqueue_io_funcs(self, funcs, block=True):\n\n return self._io_executor.enqueue_funcs(...
[ "0.7481477", "0.69800705", "0.65740114", "0.6469171", "0.6467976", "0.63923734", "0.62783223", "0.6277906", "0.62765956", "0.6253373", "0.61750007", "0.6158538", "0.6122484", "0.61081237", "0.6098972", "0.6041494", "0.59374815", "0.590583", "0.58460915", "0.58306855", "0.5799...
0.7582393
0
Returns all currently available dynamic statements based on the current scope
def GetDynamicStatements( value: DynamicStatements, ) -> List["Statement.ItemType"]: raise Exception("Abstract method") # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statements(self):\n return self._statements", "def all_iam_statements(self):\n statements = []\n for managed_policy in self.attached_managed_policies:\n statements.extend(managed_policy.policy_document.statements)\n for inline_policy in self.inline_policies:\n ...
[ "0.5795342", "0.5763785", "0.5718167", "0.55971444", "0.553775", "0.54384804", "0.5401196", "0.53011954", "0.5300472", "0.5294177", "0.5274838", "0.5252126", "0.51920754", "0.5190882", "0.5138957", "0.5132496", "0.51252323", "0.50829583", "0.5052354", "0.50400615", "0.5003935...
0.656209
0
thread worker serial read function
def worker_serial_read(self): while self.active_flag.is_set(): if not self.data_recieved_flag.is_set() and self.serial_data.in_waiting > 0: # strtmp=self.serial_data.read_until(b'\x02\x01\x04\x03\x06\x05\x08\x07'); strtmp = self.serial_data.read_all() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workerThread1(self):\n while self.running:\n sleep(READ_DELAY)\n\n self.gui.do_terminal() \n\n #self.queue.put(self.gui.readSerialByte) # this didn't\n #self.gui.readSerialByte() # this works", "def _read_thread(self):\r\n\r\n while self._reading and ...
[ "0.74379796", "0.734802", "0.7010868", "0.66762", "0.6637041", "0.6624009", "0.65812397", "0.6488655", "0.64418113", "0.6411882", "0.64081246", "0.6381122", "0.632362", "0.62904584", "0.62663025", "0.6260899", "0.62452805", "0.62397486", "0.62019616", "0.618391", "0.61712134"...
0.79291284
0
thread worker file write function
def worker_file_write(self): """ time-based file naming""" time_now = time.ctime().lower() str_time = time_now[4:7] + time_now[8:10] + '_' + time_now[11:13] + time_now[14:16] + '_' # file format: mrr_mmmdd_hhmm_filname.dat full_f_name = 'C:\\work\\rcube_extract\\demo_proje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_write(self, name: str, output: str) -> None:\n\n self._event_loop.call_soon_threadsafe(\n tpartial(self._file_write_in_thread, name, output)\n )", "def write(self, *args) -> \"int\":\n return _ida_fpro.qfile_t_write(self, *args)", "def write(self, fname):\n pass"...
[ "0.6620297", "0.65212023", "0.6321425", "0.63139814", "0.63139814", "0.62494355", "0.6074895", "0.6021628", "0.6018896", "0.6018135", "0.6014678", "0.59966093", "0.5955206", "0.59305865", "0.59172684", "0.5912875", "0.5897195", "0.5872249", "0.58656484", "0.5861548", "0.58568...
0.79426426
0
gets a thread object based on name
def get_thread_by_name( self, name): assert name in self._thread_index, "No thread named {}".format( name ) return self._threads[ self._thread_index[ name ]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thread(self, c, name=None):\n if not name:\n name = 'thread_%d' % self._cnt()\n if name in self.threads and self.threads[n].isAlive():\n raise NameError(unicode(QCoreApplication.translate('Executor', 'thread with this name is still running')))\n logger.info(unicod...
[ "0.67206496", "0.66773677", "0.6526817", "0.6469406", "0.6374534", "0.6368699", "0.63331586", "0.61162347", "0.6082792", "0.6074149", "0.607093", "0.6041508", "0.59784526", "0.58903235", "0.58377624", "0.5826304", "0.5763897", "0.57610494", "0.5753573", "0.5748878", "0.570609...
0.8225576
0
kills all submitted/running jobs
def killall(self): for job_id, job in self.jobs: backend.kill( job )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def killJobs(self):\n self.worker_pool.close()\n self.status_pool.close()\n self.failure = True\n for job in self.active:\n try:\n job.killJob()\n except AttributeError:\n raise SchedulerError('killJob method is not defined')\n ...
[ "0.82086414", "0.7395384", "0.7286887", "0.72592", "0.7164768", "0.7094188", "0.7090773", "0.70655715", "0.7026521", "0.7012052", "0.69952935", "0.69894683", "0.69882005", "0.69847864", "0.69723076", "0.68359464", "0.68123627", "0.67809254", "0.6722848", "0.67225856", "0.6680...
0.86870176
0
Format memory into a more readable format
def format_memory(self, memory): memory = float( memory) if memory is None or memory == 0: return "N/A" elif ( memory > 1000000000): return "{:.2f}GB".format(memory / 1000000000) elif ( memory > 1000000): return "{:.2f}MB".format(memory / 1000000) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_hex(memory, startad, endad, width =4):\n res = \"\"\n gap = 0\n CHUNK_SIZE = 16\n \n addr = startad\n while addr < endad:\n if endad - addr < CHUNK_SIZE:\n read_chunk = endad - addr\n else:\n read_chunk = CHUNK_SIZE\n ...
[ "0.6131784", "0.60585284", "0.60096174", "0.59932333", "0.588779", "0.5869741", "0.57670504", "0.574953", "0.574558", "0.57360154", "0.568659", "0.56678754", "0.56542027", "0.5607796", "0.56047106", "0.5604411", "0.55758935", "0.5572773", "0.5572726", "0.5572694", "0.5519341"...
0.6470922
0
updates the status of and returns all active jobs
def active_jobs(self): active_jobs = [] for job in self._jobs: if job.active: job.backend.status( job ) active_jobs.append( job ) self._active_jobs = active_jobs[:] return active_jobs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_jobs(self):\n all_jobs = self.job_set.all().order_by(\"-time_last_updated\", \"project__name\", \"-id\")\n # for job in all_jobs:\n # job.check_exists()\n\n # get the list of jobs listed in the database as running and update them.\n dbrunning = all_jobs.filter(sta...
[ "0.7723709", "0.73744327", "0.7200749", "0.7174685", "0.7138054", "0.7013222", "0.6916711", "0.68667203", "0.68449706", "0.682917", "0.67679894", "0.6763702", "0.67263097", "0.67171526", "0.6706696", "0.66895294", "0.6673758", "0.6672969", "0.6667411", "0.66340506", "0.662951...
0.7558397
1
check if any of the running jobs are in the depends list
def waiting_for_job(self, depends_on ): # This code is aweful, but I don't have to time and brain # power to fix it right now for depend_on in depends_on: for active_job in self._active_jobs: if (active_job.active and depend_on.name == active_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failed_dependency_jobs(self, depends_on ):\n\n for depend_on in depends_on:\n for active_job in self._active_jobs:\n if (active_job.status == Job_status.NO_RESTART):\n print(\"dependecy {} failed\".format(active_job.step_name))\n return Tr...
[ "0.7060981", "0.645256", "0.6440798", "0.64401525", "0.6380552", "0.63529575", "0.6300623", "0.62935704", "0.62798846", "0.6271928", "0.62698776", "0.6259027", "0.62551874", "0.6254559", "0.624954", "0.6188316", "0.6180763", "0.61568606", "0.61490667", "0.61430496", "0.610900...
0.7091599
0
check if any of the running jobs this one depends on have failed.
def failed_dependency_jobs(self, depends_on ): for depend_on in depends_on: for active_job in self._active_jobs: if (active_job.status == Job_status.NO_RESTART): print("dependecy {} failed".format(active_job.step_name)) return True r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_job_completeness(self, jobs):\n for job in concurrent.futures.as_completed(jobs):\n if job.exception():\n raise (job.exception())", "def check_jobs(self):\n # New/aborted jobs\n try:\n jobs = self.sm.get_job('%', phase = 'QUEUED')\n for job in jobs:\n ...
[ "0.76594204", "0.7127682", "0.70886266", "0.6970586", "0.66919225", "0.6681441", "0.6574967", "0.6534974", "0.6450949", "0.6385302", "0.63848835", "0.63784146", "0.637491", "0.63326406", "0.63141644", "0.63038325", "0.6260518", "0.6253055", "0.6251212", "0.6228166", "0.621897...
0.77655065
0
Perform a review from arguments. Compatible with the CLI interface
def review(*args, mode="simulate", model=DEFAULT_MODEL, **kwargs): reviewer = get_reviewer(*args, mode=mode, model=model, **kwargs) # Start the review process. reviewer.review()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(args=None):\n # Define base parser\n base = argparse.ArgumentParser(prog=PROG_NAME,\n description=version.__description__,\n formatter_class=argparse.RawTextHelpFormatter,\n usage='%(prog)s <action>...
[ "0.7122973", "0.6811216", "0.6423381", "0.6199002", "0.6193584", "0.61890924", "0.6185196", "0.6177973", "0.6067223", "0.6008946", "0.5905972", "0.5891033", "0.5890922", "0.58540666", "0.5853979", "0.5851136", "0.5834349", "0.5825814", "0.5758714", "0.5757882", "0.5750614", ...
0.7033175
1
Construct a service interface for the service with the given name. Use the service interface to send requests to the corresponding service on the Quartjes server.
def get_service_interface(self, service_name): return ServiceInterface(self._factory, service_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service(self, service_name):\n return Service('/'.join((self._url, self._services_path, service_name)))", "def register_service(service, iface, name):", "def __getitem__(self, name):\r\n return Service(self, name)", "def getService(name):\n return Service.getService(name)", "def create...
[ "0.723209", "0.70453", "0.6874511", "0.6826923", "0.6782643", "0.66835463", "0.66826105", "0.66002256", "0.6593263", "0.6526242", "0.63647604", "0.63318646", "0.63271344", "0.6318267", "0.6302385", "0.61979586", "0.61868155", "0.6161456", "0.61520594", "0.6077038", "0.6034125...
0.72474825
0
Internal method called from the reactor to start a new connection.
def _connect(self): #print("Connecting...") self._connection = reactor.connectTCP(self.host, self.port, self.factory) #@UndefinedVariable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self.protocol.makeConnection(self.transport)", "def start(self):\n self.protocol.makeConnection(self.transport)", "def connect(self):\n yield self._connect(reconnecting=False)", "async def __initiate_connection(self):\r\n\r\n chainlink_model = ChainlinkResolver....
[ "0.7337946", "0.7337946", "0.71949714", "0.71623766", "0.69568056", "0.69461787", "0.69151443", "0.6813037", "0.6813037", "0.68052405", "0.67654186", "0.67452", "0.6739675", "0.6730095", "0.6719362", "0.67130834", "0.670997", "0.6708456", "0.66900176", "0.66704965", "0.666262...
0.81878126
0
Prepare a class to receive events from outside the tk mainloop. Call this from the TK mainloop before any events are going to be received. Decorate methods to call using tk_event_listener
def tk_prepare_instance_for_events(instance): def listener(): try: while 1: (method, self, pargs, kwargs) = instance._event_queue.get_nowait() method(self, *pargs, **kwargs) except Queue.Empty: pass instance.after(100, listener) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_events(self):\n # Bind all events from our buttons (including 'exit')\n self.Bind(wx.EVT_BUTTON, self._process_event)", "def listener(cls):\n func = cls.__init__\n\n # Wraps the class constructor to automate the subscription of methods to\n # event handlers\n @wraps(cls.__ini...
[ "0.6590283", "0.6266912", "0.6082102", "0.6077668", "0.6076165", "0.60749245", "0.58977365", "0.5893034", "0.58537287", "0.580785", "0.57926244", "0.57648516", "0.5702302", "0.564894", "0.5645035", "0.5640443", "0.55892384", "0.5588504", "0.55878335", "0.5587666", "0.5587666"...
0.665782
0
Function to check if a straight line can be formed using points in array
def is_straight_line(self, arr): # First pair of point (x0, y0) x0 = arr[0][0] y0 = arr[0][1] # Second pair of point (x1, y1) x1 = arr[len(arr) - 1][0] y1 = arr[len(arr) - 1][1] dx = x1 - x0 dy = y1 - y0 # Loop to iterate over the points ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkStraightLine(coordinates: List[List[int]]) -> bool:\n\t# initializing our comparison slope value\n\tnum = coordinates[1][1] - coordinates[0][1]\n\tden = coordinates[1][0] - coordinates[0][0]\n\tif den == 0:\n\t\tslope = math.inf\n\telse:\n\t\tslope = num / den\n\n\t# checking the initial slope against all...
[ "0.723995", "0.7020243", "0.69923604", "0.6926651", "0.689205", "0.68235546", "0.68024886", "0.68005294", "0.6780866", "0.6670908", "0.66200554", "0.6522632", "0.65156865", "0.6492245", "0.6455775", "0.64274466", "0.6426385", "0.6406562", "0.6374915", "0.63707304", "0.6329164...
0.79051757
0
Publish to a goal distance topic
def publish_goal(self): goal_publisher = rospy.Publisher(self.goal_distance_topic, Float64, queue_size=10) while not rospy.is_shutdown() and (goal_publisher.get_num_connections() == 0): rospy.sleep(1) msg = Float64() msg.data = self.distance goal_publisher.publish(msg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_to_simulation(self, topic, message, **kwargs):\n pass", "def publish_moved_distance(self):\n rospy.spin()\n \n \n \n # spin() simply keeps python from exiting until this node is stopped\n rospy.spin()", "def publish():\n pass", "def sendMessage(self):\n...
[ "0.6441172", "0.63595545", "0.6248034", "0.62343884", "0.62310714", "0.622638", "0.618143", "0.6129996", "0.6079628", "0.5977998", "0.5886554", "0.58577", "0.58263636", "0.5801993", "0.5780853", "0.57443595", "0.5696977", "0.5693978", "0.5663841", "0.5661553", "0.5657858", ...
0.7909717
0
Gazebo model states callback
def model_states_callback(self, msg): self.current_model_state = msg try: gazebo_model_index = self.current_model_state.name.index( self.name) # Looking for main robot which in under namespace gz_pose = self.current_model_state.pose[gazebo_model_index] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback_model_state(self, model_state):\n # find the model in the list of tracked gazebo models\n model_index = model_state.name.index(self.model_name)\n # grab the position of the robot model\n self.ground_truth = model_state.pose[model_index].position", "def gazebo_state_callba...
[ "0.7478226", "0.68123037", "0.6258022", "0.6169628", "0.61401033", "0.61284375", "0.61173207", "0.6094149", "0.60551906", "0.60380363", "0.6021886", "0.5985335", "0.5915751", "0.5866387", "0.58165836", "0.57787937", "0.57579976", "0.57492244", "0.56666315", "0.5650199", "0.56...
0.72479355
1
Prepopulates the city table if the application is started for the first time If table is already prepopulated, the method is returning nothing.
def populate_cities(): if City.query.filter_by(name=CITIES[0]).first(): return for city in CITIES: _add_city(city)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_and_update_observe_table(self):\n # print CHN_CITY_LIST_FILE\n location = ''\n id = ''\n f = open(CHN_CITY_LIST_FILE, 'r')\n for line in f.readlines():\n line_list = line.strip('\\n').split(':')\n location = line_list[0]\n id = line_list[...
[ "0.58392906", "0.57231617", "0.56954944", "0.56918657", "0.5594168", "0.55328506", "0.55204946", "0.5457812", "0.5443111", "0.54183155", "0.5417446", "0.5412629", "0.5402404", "0.5366286", "0.53646445", "0.5294957", "0.5275629", "0.5273356", "0.5265425", "0.52262175", "0.5221...
0.6215234
0
Adds a new city to the database.
def _add_city(city_name): #Checks if city exist, if exist returns ALREADY_EXIST message if City.query.filter_by(name=city_name).first(): return jsonify(MESSAGES.get('ALREADY_EXIST_MESSAGE')) metric_resp, imperial_resp = _get_open_weather_requests(city_name) #Checks if request is OK, if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, city: City):\n self.list_cities.append(city)", "def add_place(city_id=None):\n requeste = request.get_json()\n if requeste is None:\n abort(400, \"Not a JSON\")\n city = storage.get(City, city_id)\n if city is None:\n abort(404)\n if 'user_id' not in requeste:...
[ "0.7292086", "0.704097", "0.6900886", "0.68867284", "0.68692", "0.6766409", "0.6722535", "0.6544163", "0.6532673", "0.6528207", "0.6522167", "0.64189523", "0.6387159", "0.6347277", "0.62955564", "0.6266939", "0.61647654", "0.60789204", "0.60616064", "0.6052377", "0.60226005",...
0.78769594
0
Updates all the temperatures of all cities in the database
def _update_on_refresh(): cities = City.query.all() #Iterates over all cities in the database and updates their value for city in cities: metric_resp, imperial_resp = _get_open_weather_requests(city.name) metric_json = metric_resp.json() imperial_json = imperial_resp.json() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_temperature_values(self):\n year = self._current_date.year\n month = self._current_date.month\n\n self.ensure_temperatures(dt.date(year, month, 15))\n self.set_temperature_arrays(dt.date(year, month, 15))", "def updateTempSensorValues(self):\n # Look through each tem...
[ "0.67448694", "0.6267999", "0.6252442", "0.608185", "0.5853105", "0.57891345", "0.5703693", "0.5593817", "0.55220145", "0.54921836", "0.54873747", "0.5476226", "0.54522425", "0.5447075", "0.5381309", "0.53778374", "0.5363934", "0.533109", "0.5284496", "0.5258118", "0.52513623...
0.77796155
0
Assign particular data vector to current TensorRepresentation instance Accounts input data statistics in the instance.
def set_data(self, data): self.__data = np.asarray(data, dtype=np.float32) if data is not None: self.account(data) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_data(self, polyhedron, data):\n assert polyhedron.parent() is self._polyhedron_parent\n if len(data) != self._vector.degree():\n raise ValueError('V-representation data requires a list of length ambient_dim')\n\n self._vector[:] = data\n\n self._index = len(polyhedro...
[ "0.5906721", "0.5893651", "0.58238554", "0.5732922", "0.56787133", "0.5662887", "0.565338", "0.56478834", "0.56349635", "0.5629319", "0.56290483", "0.5626283", "0.56198037", "0.5561907", "0.55359584", "0.55154806", "0.55116606", "0.5497566", "0.5491141", "0.5475509", "0.54536...
0.5994568
0
Return required number of fractional bits in FX container of 'container_type' according to accumulated statistics.
def frac_bits(self, container_type): container_size = np.iinfo(container_type).bits - 1 frac_bits = container_size - self.int_bits() if frac_bits < 0: print("WARNING: negative number({}) of frac_bits isn't supported by embarc_MLI." "Saturate to 0".format(frac_bits))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_quantazed(self, container_type, frac_bits=None):\n if self.__data is None:\n return None\n if frac_bits is None:\n frac_bits = self.frac_bits(container_type)\n\n one = 2 ** frac_bits\n cont_info = np.iinfo(container_type)\n quantized_data = self...
[ "0.6000018", "0.5734267", "0.5346173", "0.5305299", "0.51938426", "0.5150876", "0.5140338", "0.50894743", "0.5046738", "0.50359684", "0.50091106", "0.5007256", "0.49700788", "0.49210605", "0.4885183", "0.4884919", "0.48805344", "0.48772058", "0.4869614", "0.4869001", "0.48659...
0.7097143
0
Returns data of assigned tensor in quantized form for required container and number of fractiona bits
def get_data_quantazed(self, container_type, frac_bits=None): if self.__data is None: return None if frac_bits is None: frac_bits = self.frac_bits(container_type) one = 2 ** frac_bits cont_info = np.iinfo(container_type) quantized_data = self.__data * one...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantize(self, some_tensor, bits=32) -> dict:\n raise NotImplementedError(\"To be Overidden by derived class\")", "def TensorRepresentations(self) -> tensor_adapter.TensorRepresentations:", "def simple_unet_data():\n return tf.constant(value=1.0, shape=(1, 256, 256, 1))", "def _bits_per_element...
[ "0.62833005", "0.58273613", "0.5819101", "0.5700442", "0.56290907", "0.5627631", "0.5597415", "0.5572534", "0.5553916", "0.54377466", "0.54252887", "0.54252887", "0.54252887", "0.5422741", "0.54142", "0.53600806", "0.5337595", "0.52915096", "0.52607614", "0.52570724", "0.5243...
0.6427194
0
Layer data quantization method. Returns dictionary with data and parameters for required kernel type. If kernel type is 'float', it returns ndarray for each assigned tensor in source (float) representation and the rest parameters EXCLUDING number of fractional bits.
def get_layer_data(self, kernel_type='float'): if kernel_type not in ('float', 'fx8', 'fx16', 'fx8w16d'): raise KeyError("Unknown kernel type ({})".format(kernel_type)) if kernel_type == 'fx8': return self.__quantize_layer_operands(np.int8, np.int8, 32) elif kernel_type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _quantize_dequantize_params(self, inputs=None) -> Dict[str, torch.Tensor]:\n quantized_params = dict()\n shadow_params = {name: param.detach().clone() for name, param in self.named_parameters(recurse=False)}\n\n if self._mode != QcQuantizeOpMode.LEARN_ENCODINGS:\n quantizer_par...
[ "0.575303", "0.55719167", "0.5517406", "0.5380068", "0.5274238", "0.52586174", "0.524133", "0.51661146", "0.51651025", "0.5148277", "0.50826144", "0.50599897", "0.50242865", "0.49933788", "0.49858144", "0.4980995", "0.49648526", "0.4963773", "0.4946032", "0.4942641", "0.49200...
0.7451236
0
Get the average accuracy for a group of networks.
def get_average_accuracy(networks): total_accuracy = 0 for network in networks: total_accuracy += 1 - network.squared_err return total_accuracy / len(networks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accuracy_stats(self, networks):\n total_accuracy = 0\n highest_accuracy = 0\n lowest_accuracy = 1\n best_scoring_network = None\n \n for network in networks:\n total_accuracy += network.accuracy\n if network.accuracy > highest_accuracy:\n ...
[ "0.77235156", "0.71433467", "0.6878926", "0.68078876", "0.6757013", "0.6751074", "0.67089725", "0.66306275", "0.65623474", "0.65397847", "0.6501918", "0.6501918", "0.6485179", "0.6455708", "0.6448343", "0.64172757", "0.63582015", "0.63582015", "0.63367957", "0.6324233", "0.63...
0.82343733
0
Generate a network with the genetic algorithm.
def generate(generations, population, nn_param_choices, X, Y): optimizer = Optimizer(nn_param_choices) networks = optimizer.create_population(population) # Evolve the generation. for i in range(generations): logging.info("***Doing generation %d of %d***" % (i + 1, generations)) # Train and get ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self):\n\n g = nx.Graph()\n g.add_nodes_from(self.graph.nodes)\n\n num_nodes = g.number_of_nodes()\n\n degree_sequence = sorted([d for n, d in self.graph.degree()])\n degree_count = Counter(degree_sequence)\n deg, cnt = zip(*degree_count.items())\n\n de...
[ "0.70312464", "0.661894", "0.65514594", "0.65437233", "0.6538863", "0.6537502", "0.6475667", "0.6417351", "0.63948756", "0.6382878", "0.63625044", "0.6319114", "0.620906", "0.6199897", "0.6182328", "0.6162334", "0.614329", "0.61370224", "0.61182845", "0.6102993", "0.6077624",...
0.7240545
0
Print a list of networks.
def print_networks(networks): logging.info('-'*80) for network in networks: print(network)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_networks(self, networks):\n logging.info('-'*80)\n for network in networks:\n network.log_network()\n network.print_network_details()", "def print_networks(self):\n print('Networks initialized')\n for name in self.network_names:\n if isinstan...
[ "0.8176591", "0.7498333", "0.7276742", "0.7092872", "0.7018045", "0.69786066", "0.68155485", "0.66374326", "0.6631221", "0.65537584", "0.64323777", "0.6291782", "0.624739", "0.6225529", "0.6216135", "0.61721164", "0.61196935", "0.6113492", "0.60588646", "0.6039668", "0.599800...
0.87478006
0
The server sends this message when the connection is successful. It also sends the client's assigned player slot. All connected players are assigned a slot, 0254.
def auth_success(self, msg): slot_num = ord(msg[1:2]) print("auth success: slot_num={}".format(slot_num)) self.player = Player(slot_num, "AIBOT1") # Send information about the player to the server self.add_message(PlayerInfo(self.player)) self.add_message(PlayerHPInfo(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slot_client_connected(self, _sender, _data):\r\n self.check_connect_ready()", "def _accept_client(server_socket):\n (player_socket, player_address) = server_socket.accept()\n print \"a player has joind the game!\"\n new_player = Player.player(player_socket=player_socket, player_address=player...
[ "0.6332382", "0.6167958", "0.61322975", "0.60477805", "0.59931743", "0.59519047", "0.594415", "0.5882579", "0.5806777", "0.57890713", "0.57530373", "0.56617445", "0.5638009", "0.5578126", "0.5476867", "0.54699737", "0.54523015", "0.5424035", "0.54073435", "0.54037", "0.539763...
0.710279
0
Displays the differentiated services code point (DSCP). DSCP is a 6bit value in the Differentiated Services (DS) field of the IP header.
def ip_dscp(self) -> int: return pulumi.get(self, "ip_dscp")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FlowStatIpDscp(self):\n\t\treturn self._get_attribute('flowStatIpDscp')", "def getSDDCS(**kwargs):\n strProdURL = kwargs[\"strProdURL\"]\n orgID = kwargs[\"ORG_ID\"]\n sessiontoken = kwargs[\"sessiontoken\"]\n\n sddcInfo = get_sddcs_json(strProdURL, orgID, sessiontoken)\n if sddcInfo == None:\...
[ "0.56134564", "0.5605445", "0.55469245", "0.55445355", "0.53656566", "0.5334901", "0.52426904", "0.52296585", "0.52035934", "0.51729274", "0.51705396", "0.5115254", "0.5112698", "0.50742847", "0.50742847", "0.50742847", "0.50713813", "0.50713813", "0.50713813", "0.5069965", "...
0.6652336
0
Use this data source (`ltm.Monitor`) to get the ltm monitor details available on BIGIP Example Usage ```python import pulumi import pulumi_f5bigip as f5bigip monitor__tc1 = f5bigip.ltm.get_monitor(name="testmonitor", partition="Common") ```
def get_monitor(name: Optional[str] = None, partition: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetMonitorResult: __args__ = dict() __args__['name'] = name __args__['partition'] = partition opts = pulumi.InvokeOptions.merge(_utilities...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_monitor_data(self):\n json = await self._api_call(\"app/monitors/%s/overview\" % self.sense_monitor_id)\n if \"monitor_overview\" in json and \"monitor\" in json[\"monitor_overview\"]:\n self._monitor = json[\"monitor_overview\"][\"monitor\"]\n return self._monitor", ...
[ "0.7043224", "0.6302207", "0.62478286", "0.6202816", "0.60235775", "0.59800947", "0.5968704", "0.5922319", "0.58660984", "0.58609515", "0.5860896", "0.5707873", "0.5685273", "0.56817913", "0.56764966", "0.5671747", "0.55786175", "0.5562478", "0.55386597", "0.5521031", "0.5515...
0.7200573
0
Set the mol_graph attribute from a PDB file. If self.mol_text is not set, it is set to the base of the filname.
def _set_molecule_from_pdb(self, fpath): try: self.mol_graph = Chem.MolFromPDBFile(fpath) except Exception: raise LoadingError(f'{fpath} could not be loaded') if self.mol_graph is None: raise LoadingError(f'{fpath} could not be loaded') if self.mol_tex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_molecule_from_file(self, mol_src):\n if os.path.isfile(mol_src):\n mol_fname, extension = os.path.basename(mol_src).split(\".\")\n if extension == \"pdb\":\n try:\n self._set_molecule_from_pdb(mol_src)\n except LoadingError as e...
[ "0.62213296", "0.61055094", "0.5684721", "0.53822905", "0.5227185", "0.5121436", "0.504207", "0.50315434", "0.5001103", "0.49542117", "0.49244487", "0.4884051", "0.4874997", "0.4855748", "0.4797936", "0.47612518", "0.4689431", "0.46618012", "0.4641151", "0.46387035", "0.46295...
0.8152831
0
Set the mol_graph attribute from smiles string. If self.mol_text is not set, it is set to the smiles string.
def _set_molecule_from_smiles(self, mol_smiles): try: self.mol_graph = Chem.MolFromSmiles(mol_smiles) except Exception: raise LoadingError(f'{mol_smiles} could not be loaded') if self.mol_graph is None: raise LoadingError(f'{mol_smiles} could not be loaded') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_molecule(smiles: str):\n\n mol = sp.parseSmiles(smiles)\n return mol", "def _set_molecule_from_pdb(self, fpath):\n try:\n self.mol_graph = Chem.MolFromPDBFile(fpath)\n except Exception:\n raise LoadingError(f'{fpath} could not be loaded')\n if self.mol_g...
[ "0.5784627", "0.5729885", "0.5649887", "0.55638474", "0.5415415", "0.51999986", "0.50791556", "0.50332487", "0.49809", "0.49746317", "0.4968839", "0.49654734", "0.49061847", "0.49049538", "0.48579898", "0.4848597", "0.48462826", "0.48157445", "0.48033452", "0.4720721", "0.470...
0.78748995
0
Get value of molecule descriptor.
def get_descriptor_val(self): return self.descriptor.to_numpy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_descriptor_data_value(self, obj):\n return self.extract_descriptor(obj)", "def read_value(self):\n return self.load_attr(\"value\")", "def value(self):\n return self.raw.get_attribute(\"value\")", "def getValue(self):\n return self.value", "def get_value(self, id):\n ...
[ "0.68589014", "0.6748329", "0.66867495", "0.6675326", "0.6673728", "0.667081", "0.66552854", "0.65676755", "0.65473384", "0.65229714", "0.65229714", "0.65229714", "0.6489993", "0.64710575", "0.64623606", "0.6461005", "0.6449509", "0.6449509", "0.64487994", "0.64487994", "0.64...
0.7318435
0
If target_mol.descriptor is a fingerprint, this method will try to calculate the fingerprint of the self molecules. If this fails because of the absence of mol_graph attribute in target_molecule, a ValueError is raised.
def match_fingerprint_from(self, reference_mol): if reference_mol.descriptor.is_fingerprint(): try: self.set_descriptor( fingerprint_type=reference_mol.descriptor.get_label(), fingerprint_params=reference_mol.descriptor.get_params(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_similarity_to(self, target_mol, similarity_measure):\n try:\n return similarity_measure(self.descriptor, target_mol.descriptor)\n except NotInitializedError as e:\n raise NotInitializedError(\n \"Similarity could not be calculated.\") from e", "def to_se...
[ "0.5679209", "0.47473642", "0.47470522", "0.47362632", "0.4658824", "0.4658824", "0.46492046", "0.46177015", "0.46105033", "0.4568104", "0.45401192", "0.45207003", "0.45155114", "0.45046055", "0.44968456", "0.44293115", "0.44210783", "0.43935105", "0.43869847", "0.43840414", ...
0.57946956
0
Get a similarity metric to a target molecule
def get_similarity_to(self, target_mol, similarity_measure): try: return similarity_measure(self.descriptor, target_mol.descriptor) except NotInitializedError as e: raise NotInitializedError( "Similarity could not be calculated.") from e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similarity(self, source, target):\n results = { m.name: m.similarity(source, target) for m in self.metrics }\n return results", "def findSimilarityScore(self, source, destination):\n\n\n if self.similarityScores is not None:\n return self.similarityScores[source][destination]\...
[ "0.7428353", "0.6588876", "0.6482498", "0.6426942", "0.62551093", "0.60644996", "0.60576236", "0.6020257", "0.5988876", "0.5982985", "0.5959437", "0.5958241", "0.59471166", "0.5935165", "0.5911738", "0.59064585", "0.5876502", "0.5851279", "0.5822004", "0.581371", "0.5793319",...
0.7239963
1
Check if the target_molecule is a duplicate of source_molecule.
def is_same(source_molecule, target_molecule): return source_molecule.mol_text == target_molecule.mol_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate(self, other):\n return (self.uas_position.duplicate(other.uas_position) and\n self.uas_heading == other.uas_heading)", "def _check_molecule_uniqueness(molecule_list: Optional[list[Molecule]]):\n # TODO: This could all be replaced by MoleculeSet\n if molecule_list is None...
[ "0.66254187", "0.63731164", "0.625968", "0.62414056", "0.6196357", "0.60711765", "0.602955", "0.5973738", "0.5970073", "0.5836536", "0.58347726", "0.5817711", "0.5811156", "0.5734485", "0.5715588", "0.5713398", "0.5713266", "0.56966674", "0.566906", "0.56676614", "0.5634272",...
0.75942224
0
Save a shaded image as NetCDF file.
def save_to_netcdf(img, filename): filename = os.path.join(datadir, filename + '.nc') print('Saving: ' + filename) img.to_netcdf(filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_netcdf(self, outfile):", "def Save2Nc(self):\r\n\r\n frameNumber = self.spinBox_FrameNum.value()\r\n\r\n segmentNumber = self.spinBox_SegmentNum.value()\r\n\r\n exposeTime = self.spinBox_ExpTime.value()\r\n width = self.spinBox_Width.value()\r\n xshift = self.spinBox_XSh...
[ "0.6756626", "0.6558281", "0.63380456", "0.62166965", "0.61389035", "0.6112522", "0.6095389", "0.6095184", "0.60340077", "0.60308164", "0.60139996", "0.5978833", "0.5958378", "0.59524494", "0.5927677", "0.5900905", "0.58406156", "0.5820741", "0.5819032", "0.5812896", "0.57757...
0.7788282
0
Generate all test images. Returns
def generate_test_images(): results = {} for antialias, aa_descriptor in antialias_options: for canvas, canvas_descriptor in canvas_options: for func in (generate_test_001, generate_test_002, generate_test_003, gener...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generator(self, test_path):\n\n img_list = os.scandir(test_path)\n for img_entry in img_list:\n\n img = cv2.imread(img_entry.path, COLOR_TO_OPENCV[self.color_mode])\n if img.shape[-1] == 3:\n orig_shape = img.shape[-2::-1]\n else:\n ...
[ "0.7324824", "0.716831", "0.70811063", "0.7058882", "0.7024534", "0.69546235", "0.6913075", "0.6885828", "0.6877738", "0.6794677", "0.67585975", "0.6742392", "0.67415005", "0.67351997", "0.67341", "0.67155", "0.6690145", "0.65895134", "0.6567951", "0.6567709", "0.65237755", ...
0.7645315
0
Save all images as PNG and NetCDF files
def save_test_images(images): for description, img in images.items(): save_to_image(img, description) save_to_netcdf(img, description)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_netcdf(img, filename):\n filename = os.path.join(datadir, filename + '.nc')\n print('Saving: ' + filename)\n img.to_netcdf(filename)", "def save_images(PATH, show_img, datasets, from_dataset):\n dataset = datasets[from_dataset]\n imgModels = dataset['models']\n for modelname, model ...
[ "0.6893291", "0.688815", "0.6880174", "0.6858071", "0.68520445", "0.68248546", "0.6792561", "0.66430235", "0.66181785", "0.658478", "0.65789306", "0.65532386", "0.6522179", "0.65135956", "0.6512078", "0.65089685", "0.6473081", "0.6439262", "0.64196175", "0.6397372", "0.637255...
0.7572686
0
Generate graphJSON file for Plotly plot
def create_plot(x_var, y_var): FILE_PATH = 'application/star_data.csv' TARGET_VAR = 'star_type' SIZE_VAR = 'r_clipped' WIDTH = 1000 HEIGHT = 600 # Get the data df = pd.read_csv(FILE_PATH) fig = px.scatter(df, x=x_var, y=y_var, color=TARGET_VAR, size=SIZE_VAR, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotlyfig2json(fig, fpath=None):\n\n redata = json.loads(json.dumps(fig.data, cls=PlotlyJSONEncoder))\n relayout = json.loads(json.dumps(fig.layout, cls=PlotlyJSONEncoder))\n\n fig_json=json.dumps({'data': redata,'layout': relayout})\n\n if fpath:\n with open(fpath, 'w') as f:\n f...
[ "0.71749985", "0.66081625", "0.65252936", "0.64140254", "0.6258708", "0.6035012", "0.591138", "0.58633274", "0.5808581", "0.57597876", "0.57468694", "0.57346493", "0.57243997", "0.56981945", "0.56968826", "0.569453", "0.56909186", "0.5683652", "0.56600523", "0.56476086", "0.5...
0.66388273
1
Eia923 spider can pick forms for a specific year
def test_spider_gets_specific_year(self): spider = Eia923Spider() resp = factories.TestResponseFactory(eia923=True) result = spider.form_for_year(resp, 2007) assert result is not None assert result.url == "https://www.eia.gov/electricity/data/eia923/" \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metacritic_crawl_by_year(year, verbose):\n _crawl_by_year_helper(year, verbose, False, True)", "def test_year_filtering(self):\n # Get a valid date\n entry = Entry.objects.get(id=1)\n params = {\"year\": entry.publication_date.year}\n\n self._test_filtering(**params)", "def c...
[ "0.63149357", "0.6196547", "0.6082734", "0.5953799", "0.59385693", "0.5937531", "0.5883253", "0.5874306", "0.5791532", "0.5771936", "0.57026875", "0.56462467", "0.5638638", "0.56148696", "0.56069", "0.5528392", "0.55214995", "0.55033225", "0.54905486", "0.5466082", "0.5458584...
0.80641997
0
Returns the phone numbers area code
def area_code(self): return self.number[:3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grab_area_code(phone_number):\r\n #number of form +1 XXX XXX XXXX (this should be the form get_twilio_client provides)\r\n if \"+1\" == phone_number[:2]:\r\n return phone_number[2:5]\r\n # number of form 1 XXX XXX XXXX\r\n if len(phone_number) == 11 and phone_number[0] == '1':\r\n ret...
[ "0.8202702", "0.7613238", "0.732421", "0.6728368", "0.6541438", "0.6534267", "0.646514", "0.63591325", "0.62263244", "0.6222225", "0.62019163", "0.6176978", "0.609666", "0.6014851", "0.59840447", "0.5890134", "0.5858725", "0.5858725", "0.5858725", "0.5852107", "0.57479876", ...
0.8170069
1
Download a file containing embeddings in parquet format on hdfs and convert it to several .npy files Optionally save keys in another folder (useful to keep track of what is each embedding)
def download_from_hdfs( embeddings_hdfs_path: str, local_save_path: str, n_cores: int = 10, delete_tmp_files: bool = True, bandwidth_gbytes_per_sec: Optional[float] = None, verbose: bool = True, embedding_column_name: str = "embedding", keys_folder: Optional[str] = None, key_column_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_data(filename, size_needed=None, use_names=None, key='eff', embed='tfidf'):\n data = json.load(open(filename, 'r'))\n\n bag_of_paths = set()\n\n if use_names is not None:\n names = use_names\n else:\n names = list(data.keys())\n\n if size_needed:\n names = names[:size_...
[ "0.62649786", "0.62380284", "0.6016275", "0.58555216", "0.58555025", "0.5764012", "0.5739824", "0.5685189", "0.5633861", "0.5621217", "0.5583355", "0.5492949", "0.5483315", "0.5476223", "0.5458427", "0.5445954", "0.5440679", "0.54181135", "0.5383064", "0.5371506", "0.53410137...
0.6567296
0
Test generating a rural context captions
def rural_configurations_test(): gaz = VladGazetteer(TextIOWrapper(resource_stream('pycaptioner', 'test/data/gazetteer_rural.txt'))) reader = DictReader(TextIOWrapper(resource_stream('pycaptioner', 'test/data/points.csv'))) for line in reader: if line['category'] == 'rural': point = geom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_context(self, m):\n dummy_response(m)\n c = Client(apikey='')\n c.send(utt=u'ぬるぽ', apiname='Dialogue')\n ret = c.apis['Dialogue'].parse(c.last_response)\n self.assertEqual(ret['context'], 'D0yHgwljc_mhTPIGs--toQ')", "def test_recognize_describe(self):\n pass", ...
[ "0.5851048", "0.5766302", "0.57130235", "0.5667921", "0.55337226", "0.55297667", "0.54409605", "0.5423856", "0.541058", "0.53555757", "0.5277752", "0.52468157", "0.52321553", "0.52293783", "0.52280647", "0.5225527", "0.52065694", "0.51939344", "0.51926786", "0.5192302", "0.51...
0.58303666
1
Test generating urban context captions
def urban_configurations_test(): gaz = VladGazetteer(TextIOWrapper(resource_stream('pycaptioner', 'test/data/gazetteer_urban.txt'))) reader = DictReader(TextIOWrapper(resource_stream('pycaptioner', 'test/data/points.csv'))) for line in reader: if line['category'] == 'urban': point = geom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_context(self, m):\n dummy_response(m)\n c = Client(apikey='')\n c.send(utt=u'ぬるぽ', apiname='Dialogue')\n ret = c.apis['Dialogue'].parse(c.last_response)\n self.assertEqual(ret['context'], 'D0yHgwljc_mhTPIGs--toQ')", "def testconfs(email='harryjwang@gmail.com'):\n ge...
[ "0.5793682", "0.5452255", "0.53213435", "0.523342", "0.5221271", "0.51966727", "0.51709914", "0.51673657", "0.51184666", "0.5115225", "0.5084183", "0.5076237", "0.5065186", "0.5051609", "0.5047663", "0.5025502", "0.5018654", "0.5015616", "0.5014353", "0.5000951", "0.49996114"...
0.5992464
0
Applies straighten to an image
def straighten(image): gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) gray = cv2.bitwise_not(gray) thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1] coords = np.column_stack(np.where(thresh > 0)) angle = cv2.minAreaRect(coords)[-1] if angle < -45: angle = -(90 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def straighten_image(img, scale=1):\n img = img[::scale, ::scale]\n blank = (img[:, :, 3] == 0)\n degrees = _find_angle(blank)\n if degrees > 45:\n degrees = degrees - 90\n nr, nc = img.shape[:2]\n radians = np.radians(degrees)\n # Rotate image\n img = img.astype(float) / img.max()\n...
[ "0.7099518", "0.65157235", "0.650285", "0.64764196", "0.6456265", "0.6375804", "0.6330746", "0.6284847", "0.6253362", "0.6249452", "0.6196452", "0.618711", "0.6170503", "0.617003", "0.60692656", "0.60648435", "0.59616816", "0.5941152", "0.5918688", "0.5892734", "0.5879095", ...
0.71638286
0
Creation of the 'Diva Directories' object using the user inputs.
def __init__(self, divamain): if os.path.isdir(divamain): self.divamain = divamain logger.debug("{0} exists".format(self.divamain)) self.divabin = os.path.join(self.divamain, 'DIVA3D/bin') self.divasrc = os.path.join(self.divamain, 'DIVA3D/src/Fortran') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dodir ( self, dirpath, mkdir_p ):\n return", "def __init__(self, dirname, defmode='r'):\n self.name = dirname\n self.defmode = defmode\n\n self.items = []\n\n for i in os.listdir(dirname):\n if os.path.isdir(os.path.join(dirname, i)):\n self.items.a...
[ "0.61463463", "0.57354164", "0.5726506", "0.5643917", "0.5596776", "0.55562586", "0.553816", "0.5506587", "0.5499203", "0.5481033", "0.5479449", "0.54761225", "0.5463005", "0.5461104", "0.54206836", "0.54108346", "0.540756", "0.5396611", "0.538723", "0.53684294", "0.533666", ...
0.69025576
0
Creation of the Diva 2D 'file' object based on the main Diva 2D directory
def __init__(self, diva2d): self.diva2d = diva2d if os.path.isdir(self.diva2d): self.contour = os.path.join(self.diva2d, 'input/coast.cont') self.parameter = os.path.join(self.diva2d, 'input/param.par') self.data = os.path.join(self.diva2d, 'input/data.dat') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make(self, divadir, contourfile=None, paramfile=None):\n\n divadirs = DivaDirectories(divadir)\n divafiles = Diva2Dfiles(divadirs.diva2d)\n\n if paramfile is None:\n if not os.path.exists(divafiles.parameter):\n logger.error(\"No param.par file in ./input\")\n ...
[ "0.6337348", "0.6123362", "0.58417773", "0.5796246", "0.5789723", "0.57777965", "0.5729881", "0.5636476", "0.56349653", "0.5608975", "0.5584956", "0.5564343", "0.55380356", "0.55258566", "0.5522481", "0.55151445", "0.5492583", "0.54914314", "0.54902744", "0.5489767", "0.54805...
0.6946564
0
Creation of the Diva 2D 'data' object using the user inputs.
def __init__(self, x=None, y=None, field=None, weight=None): logger.info("Creating Diva 2D data object") if x is None: logger.info("X vector not defined") self.x = x elif isinstance(x, np.ndarray): pass elif isinstance(x, list): x = np.arr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, x, y):\n if len(x) == len(y):\n self.x = x\n self.y = y\n logger.info(\"Creating Diva 2D valatxy object\")\n else:\n logger.error(\"Input vectors have not the same length\")\n raise Exception(\"Input vectors have not the same l...
[ "0.59667397", "0.59232646", "0.5833424", "0.5821947", "0.5802918", "0.5727178", "0.565939", "0.56462103", "0.5628903", "0.56114376", "0.56014264", "0.5583662", "0.55536294", "0.5546728", "0.5546353", "0.55414873", "0.5518404", "0.5510599", "0.54872537", "0.54639405", "0.54637...
0.69056576
0
Add the data positions to the plot.
def add_positions_to_plot(self, **kwargs): logger.debug('Adding data positions to plot') plt.scatter(self.x, self.y, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_data(self):", "def addDataPoints(self):\n pass", "def setData(self, **kwds):\n self.text = kwds.pop('text', [])\n self.data = kwds\n if 'pos' in self.data:\n npts = self.data['pos'].shape[0]\n self.data['data'] = np.empty(npts, dtype=[('index', int)])\...
[ "0.7073111", "0.6784929", "0.6641994", "0.6627071", "0.6627071", "0.6627071", "0.6627071", "0.6627071", "0.6569471", "0.6535721", "0.649893", "0.64500076", "0.6442837", "0.62949294", "0.6251581", "0.62435", "0.6237146", "0.6215058", "0.6194812", "0.6134656", "0.612742", "0....
0.83300567
0
Count the number of data points in the data file
def count_data(self): try: ndata = len(self.x) logger.info("Number of data points: {0}".format(ndata)) except AttributeError: logger.error("Data object has not been defined") ndata = 0 return ndata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_data_lines(filepath):\n\tif not file_exists(filepath):\n\t\treturn -1\n\tcount = 0\n\twith open(filepath, 'r') as f:\n\t\twhile read_floats(f):\n\t\t\tcount += 1\n\tf.close()\n\treturn count", "def __len__(self) -> int:\n import h5py\n\n with h5py.File(\n os.path.join(self.root, ...
[ "0.7721213", "0.7397836", "0.73551744", "0.72066754", "0.7192161", "0.71710753", "0.7118864", "0.7094991", "0.693322", "0.691588", "0.6776016", "0.67626905", "0.6759568", "0.67562306", "0.6693947", "0.66933405", "0.66932154", "0.6692287", "0.6688288", "0.6670854", "0.66496134...
0.80487597
0
Return the number of subcontours
def get_contours_number(self): ncontour = len(self.x) logger.info("Number of contours: {0}".format(ncontour)) return ncontour
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_amount_directions(contours, image: ndarray):\n return len(contours)", "def __get_contour_num(self,coord_tuple):\r\n boundRect = self.boundRect\r\n x,y = coord_tuple\r\n res = -1\r\n for i in range(len(self.top_contours)):\r\n if ((self.top_contours[i] == True)...
[ "0.66342145", "0.6615303", "0.6589883", "0.63519484", "0.6240736", "0.6103003", "0.6086067", "0.6034078", "0.5897694", "0.58919406", "0.5885994", "0.5844208", "0.5841995", "0.58418053", "0.58371115", "0.58296424", "0.5826714", "0.58122694", "0.57932585", "0.5784911", "0.57684...
0.81652564
0
For each contour, return the number of points
def get_points_number(self): ncontour = self.get_contours_number npoints = [] for i in range(0, ncontour): npoints.append(len(self.x[i])) return npoints
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contours_number(self):\n ncontour = len(self.x)\n logger.info(\"Number of contours: {0}\".format(ncontour))\n return ncontour", "def get_cntr_points(self, contour, img_size):\n res_arr = []\n # for each row\n for row in range(img_size):\n tmp_arr = []\...
[ "0.76834065", "0.674292", "0.6612292", "0.657951", "0.647974", "0.6443905", "0.64418614", "0.6399514", "0.6390381", "0.63709146", "0.6269139", "0.6249763", "0.622549", "0.61194533", "0.60509974", "0.60065305", "0.6000955", "0.5997257", "0.59971184", "0.5990332", "0.5986884", ...
0.7915227
0
Write the contour coordinates into the selected file
def write_to(self, filename): ncontour = self.get_contours_number npoints = self.get_points_number with open(filename, 'w') as f: f.write(str(ncontour) + '\n') for i in range(0, ncontour): logger.debug("Sub-contour no. {0} has {1} points".format(i + 1, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_contour(fname, cs, fmt = 'matlab', simplify = 1e-3, **kwargs):\n\n\tdef write_path_matlab(fout, x_vec, y_vec, z):\n\t\t# Now dump this data back out\n\t\t# Header is level followed by number of rows\n\t\tfout.write('%15.15e\\t%15d\\n' % (z, len(x_vec)))\n\t\tfor x, y in zip(x_vec, y_vec):\n\t\t\tfout.writ...
[ "0.69791406", "0.67067945", "0.6419915", "0.62755615", "0.6262995", "0.60787886", "0.60377157", "0.59978896", "0.5982354", "0.5981652", "0.5976504", "0.59491825", "0.59302944", "0.5889245", "0.5881458", "0.58610517", "0.58130085", "0.5789095", "0.5789095", "0.5764688", "0.574...
0.80921733
0
Write the contour to a geojson file
def to_geojson(self, filename, varname='contours'): geojsoncontour = { "type": "MultiPolygon", "coordinates": [[[[x, y] for x, y in zip(self.x[cont], self.y[cont])]] for cont in range(0, self.get_contours_number)] } try: with open...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeGeoJson(self, file):\n with open(file, 'w') as f:\n json.dump(self._geojson, f)", "def save_to_geojson(self, topology_map, filename):", "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.pat...
[ "0.7698679", "0.7623464", "0.7346912", "0.69078594", "0.68774575", "0.68619096", "0.676889", "0.6703981", "0.6619012", "0.6578908", "0.6436182", "0.64185065", "0.64163256", "0.6413923", "0.63720703", "0.6280809", "0.62569624", "0.6217825", "0.6211546", "0.6137011", "0.6104824...
0.76486284
1
Get the coordinates of the contour from an already existing contour file. The function use numpy method 'genfromtxt' several times and is not optimised at all. For large contour files, prefer 'read_from' function.
def read_from_np(self, filename): # Check if the file exist if os.path.exists(filename): # Count number of contour and lines in the files # %timeit shows that "linecache" is way faster than "readline" on the first line logger.info("Reading contours from file {0}".fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_from(self, filename):\n\n if os.path.exists(filename):\n logger.info(\"Reading contours from file {0}\".format(filename))\n with open(filename, 'r') as f:\n ncontour = int(f.readline().split()[0])\n logger.debug(\"Number of contours: {0}\".format(...
[ "0.7256633", "0.6648982", "0.6260662", "0.60903245", "0.5964818", "0.58651274", "0.5858761", "0.58338743", "0.572939", "0.57067496", "0.56918806", "0.5652628", "0.56131285", "0.56064475", "0.5561452", "0.55589795", "0.5543939", "0.5529787", "0.54940516", "0.54802847", "0.5477...
0.74806476
0
Get the coordinates of the contour from an already existing contour file. The function reads the file only once and performs the conversion from lists to ndarrays at the end of the loop.
def read_from(self, filename): if os.path.exists(filename): logger.info("Reading contours from file {0}".format(filename)) with open(filename, 'r') as f: ncontour = int(f.readline().split()[0]) logger.debug("Number of contours: {0}".format(ncontour)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_from_np(self, filename):\n\n # Check if the file exist\n if os.path.exists(filename):\n\n # Count number of contour and lines in the files\n # %timeit shows that \"linecache\" is way faster than \"readline\" on the first line\n logger.info(\"Reading contours ...
[ "0.78591126", "0.6354731", "0.63515383", "0.6345079", "0.631504", "0.6213191", "0.61683613", "0.61494243", "0.59722704", "0.5965764", "0.5852313", "0.5831331", "0.5807998", "0.57884926", "0.57857525", "0.575899", "0.5738852", "0.5730278", "0.57143164", "0.57139075", "0.568834...
0.7374899
1
Add the contours to the plot
def add_to_plot(self, m=None, **kwargs): if m is None: logger.debug("No projection defined") logger.debug('Adding contours to plot') for lon, lat in zip(self.x, self.y): # Append first element of the array to close the contour plt.plot(np.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self, show_contours=False):\n plt.imshow(self.img, cmap='gray')\n if show_contours:\n for X in self.contours:\n plt.plot(X[:, 0], X[:, 1])\n plt.gca().invert_yaxis()", "def add_other_contours(self, xlabel, ylabel):\n import matplotlib.pyplot as plt\n...
[ "0.7028506", "0.6903206", "0.6839146", "0.68215084", "0.68215084", "0.6797819", "0.67916775", "0.67916775", "0.67916775", "0.6771269", "0.6770371", "0.6746945", "0.6746945", "0.6746945", "0.6746945", "0.6684272", "0.6584649", "0.65831554", "0.65694296", "0.6561613", "0.653727...
0.6988015
1
Plot the specified output grid for the analyzed field. If the grid is too dense, use a scale factor larger than 1. The scale factor is rounded if not chosen as an integer.
def plot_outputgrid(self, scalefactor=1, **kwargs): if not (type(scalefactor) == 'int'): scalefactor = round(scalefactor) xx = np.arange(self.xori, self.xend, scalefactor * self.dx) yy = np.arange(self.yori, self.yend, scalefactor * self.dy) plt.hlines(yy, self.xori, self.x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self, **kwargs):\n\n # get colors\n colors = kwargs.get(\"colors\", GW_OBSERVATORY_COLORS)\n\n # get Result samples\n self._samples = {\n label: value.posterior\n for label, value in self.results.items()\n if isinstance(value, Result)\n }...
[ "0.6031623", "0.5933796", "0.5902754", "0.58833987", "0.5866026", "0.5858156", "0.58255184", "0.57176894", "0.5639347", "0.5632038", "0.56168383", "0.5596933", "0.55659336", "0.5565715", "0.5558663", "0.55581427", "0.5493928", "0.5457642", "0.54230183", "0.54178536", "0.54158...
0.6653864
0
Creation of the Diva 2D 'data' object using the user inputs.
def __init__(self, x, y): if len(x) == len(y): self.x = x self.y = y logger.info("Creating Diva 2D valatxy object") else: logger.error("Input vectors have not the same length") raise Exception("Input vectors have not the same length")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, x=None, y=None, field=None, weight=None):\n\n logger.info(\"Creating Diva 2D data object\")\n if x is None:\n logger.info(\"X vector not defined\")\n self.x = x\n elif isinstance(x, np.ndarray):\n pass\n elif isinstance(x, list):\n ...
[ "0.69056576", "0.59232646", "0.5833424", "0.5821947", "0.5802918", "0.5727178", "0.565939", "0.56462103", "0.5628903", "0.56114376", "0.56014264", "0.5583662", "0.55536294", "0.5546728", "0.5546353", "0.55414873", "0.5518404", "0.5510599", "0.54872537", "0.54639405", "0.54637...
0.59667397
1
Creation of the Diva 2D 'Result' object using the user inputs.
def __init__(self, x=None, y=None, analysis=None, error=None): logger.info("Creating Diva 2D Result object") if isinstance(x, np.ndarray): self.x = x elif isinstance(x, list): self.x = np.array(x) else: logger.debug("X vector not defined. Should be np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, poly1, poly2, inter1, inter2, result=None):\n self.poly1 = poly1\n self.poly2 = poly2\n self.inter1 = inter1\n self.inter2 = inter2\n if result is not None:\n self.result = result\n else:\n self.result = polyhedron([], [], [])", "...
[ "0.5740439", "0.5570202", "0.5535433", "0.5525989", "0.5523582", "0.55134034", "0.5437482", "0.5429256", "0.5314639", "0.5286708", "0.52580607", "0.5189055", "0.51479673", "0.5141593", "0.511471", "0.5090501", "0.5083041", "0.50259537", "0.500573", "0.49955374", "0.49613726",...
0.6921471
0
Read the analyzed field, the error field (if exists) and their coordinates from the netCDF file. If the error field doesn't exist, the function return a field full of NaN's.
def read_from(self, filename): try: with netCDF4.Dataset(filename) as nc: self.x = nc.variables['x'][:] self.y = nc.variables['y'][:] self.analysis = nc.variables['analyzed_field'][:] try: self.error = nc.variables[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_field(self,filename,unmask=True,timeslice=None,fieldname=None,\n check_for_grid_info=False,grid_info=None,grid_type='HD',\n **grid_kwargs):\n\n if not check_for_grid_info:\n grid = gd.makeGrid(grid_type,**grid_kwargs)\n print(\"Reading input fro...
[ "0.5886942", "0.56619745", "0.5557798", "0.54752594", "0.5380489", "0.53471535", "0.53408784", "0.53230596", "0.529746", "0.52763003", "0.52712476", "0.5250071", "0.5217163", "0.51948386", "0.5183918", "0.51596874", "0.51551175", "0.51396614", "0.51263404", "0.5115166", "0.50...
0.5852473
1
Initialise the mesh object by reading the coordinates and the topology from the specified files.
def read_from(self, filename1, filename2): if os.path.exists(filename1) and os.path.exists(filename2): logger.info("Reading mesh from files {0} and {1}".format(filename1, filename2)) # Read mesh topology with open(filename2) as f: self.nnodes = int(f.readline...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, file_path):\n\n # Comments\n # mtllib mtl_name\n # o object_name\n # v x y z\n # vt u v\n # vn x y z\n # f v0/t0/n0 v1/t1/n1 v2/t2/n2\n\n print('loading mesh \"%s\"' % file_path)\n mesh_file = open(file_path, 'r')\n\n verts = ...
[ "0.7110252", "0.694436", "0.65384424", "0.6524579", "0.63086903", "0.6280398", "0.6261749", "0.62446785", "0.6187736", "0.6186447", "0.6180437", "0.61696386", "0.6156223", "0.61297476", "0.61033654", "0.6098606", "0.60961187", "0.60593706", "0.60318375", "0.60065985", "0.5985...
0.70780057
1
Write the mesh to a geojson file
def to_geojson(self, filename, varname='mesh'): NN = self.nelements verts = [] for j in range(0, NN): verts.append([[(self.xnode[self.i1[j]], self.ynode[self.i1[j]]), (self.xnode[self.i2[j]], self.ynode[self.i2[j]]), (self.xnode[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeGeoJson(self, file):\n with open(file, 'w') as f:\n json.dump(self._geojson, f)", "def save_to_geojson(self, topology_map, filename):", "def serialize_mesh(self, filename):\n print 'Saving mesh to', filename\n if self.current_point_index != -1:\n print 'Point...
[ "0.7548227", "0.74803746", "0.72885543", "0.6704085", "0.6661592", "0.64842486", "0.6482616", "0.6472812", "0.6412315", "0.6384249", "0.6377596", "0.63621485", "0.63404024", "0.6272432", "0.62220275", "0.61898583", "0.61764675", "0.6152024", "0.6150315", "0.6146233", "0.61422...
0.7489566
1
Function for extracting the Xth point of a linestring. Default X is the first point, default behaviour is the last
def get_point_from_linestring(geom_row, X=0, behaviour='last'): lat = None lng = None try: X = round(X) except Exception as e: raise TypeError("Please enter a number for the index of the point within the linestring (X)") if behaviour in ['last', 'ignore']: pass else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getXPos(self, tline, x):\n # Find the TWord object\n words = tline.twords\n j = 0 # word index\n imax = len(words) - 1\n for w in words:\n # Find out if the point is in this word -\n # need to include half the space width after the word, if there\n ...
[ "0.68402886", "0.6506931", "0.62733614", "0.61270857", "0.60362756", "0.60123956", "0.5954508", "0.58751136", "0.58751136", "0.58486766", "0.5825443", "0.5824764", "0.572954", "0.56775886", "0.5659878", "0.56520665", "0.5622348", "0.5590907", "0.5582688", "0.5577344", "0.5569...
0.6695527
1
function for plotting a map of counts of a variable
def plot_counts(data, mtl_dissemination_areas, var, purpose=True, cmap='Reds', return_df=False, plot=True): if purpose: assert var in data['purpose'].unique(), "var: \'%s\' is not in the purpose column of the dataframe" % (var) joined_data = gpd.sjoin(data.loc[data['purpose'] == var], mtl_disseminat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_stats(label_mapping):\n\tlabels = list(label_mapping.values())\n\n\tfor count, elem in sorted(((labels.count(e), e) for e in set(labels)), reverse=True):\n\t\tprint('%s: \\t\\t %d' % (elem, count))", "def map_plot(self, iter_no):\n \n m = self._m\n n = self._n\n plt.figure()...
[ "0.63410103", "0.61494255", "0.61087173", "0.6071023", "0.60598767", "0.60558856", "0.60194486", "0.60070515", "0.6004255", "0.59985524", "0.5986106", "0.59742874", "0.59723103", "0.59629005", "0.5937729", "0.58332026", "0.5808128", "0.58024967", "0.579522", "0.5777662", "0.5...
0.6440972
0
Load data, normalize metadata, and prepare only the packet time information for input to VarCNN. Then initialize the VarCNN model, compute final softmax output, and return time taken to run.
def time_cnn(): data_dir = "/home/liyanzeng/git/Var-CNN--DynaFlow/preprocess" # read in data from numpy files train_metadata = np.load(r"%s/train_metadata.npy" % data_dir) test_metadata = np.load(r"%s/test_metadata.npy" % data_dir) train_seq = np.load(r"%s/train_seq.npy" % data_dir) train_labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_train_data(self):\r\n print(\"* Preprocessing training data.\", flush=True)\r\n prep.create_HDF_file(self.C.training_set, is_training_set=True)\r\n\r\n self.print_time_elapsed()", "def compute(self):\n first_row = True\n assert (self.num_samples_batch <= 64), \"B...
[ "0.6045688", "0.6033688", "0.57575405", "0.5733574", "0.57054806", "0.57051134", "0.5695738", "0.5690776", "0.56884027", "0.56845284", "0.5647075", "0.56406444", "0.5627844", "0.56268877", "0.5618513", "0.5606925", "0.558224", "0.55784", "0.55681795", "0.5562732", "0.55470365...
0.69905895
0
Driver for the FAM system.
def main(): fam = FAM() # show main menu fam.show_main_menu()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def falcon():", "def DirFA():\n\n global Asm\n\n target.BoundarySync()\n\n families = ['TINY', 'AVR', 'MEGA', 'XMEGA', 'REDUCED', 'MINIMAL',\n 'CLASSIC8K']\n families += ['CLASSIC128K', 'ENHANCED8K', 'ENHANCED128K', 'ENHANCED4M']\n\n if dec.Asm.Parse_Pointer == 0:\n # No para...
[ "0.5928905", "0.5775691", "0.5569096", "0.54569286", "0.54073775", "0.5359982", "0.5284289", "0.52779734", "0.52688164", "0.5240625", "0.5210477", "0.517503", "0.5155905", "0.51401705", "0.5140094", "0.51354563", "0.51103675", "0.50971484", "0.50919205", "0.5066656", "0.50404...
0.5843739
1
Create a full number from what the user entered.
def evalute_number(dialed): if (len(dialed) == 11 or len(dialed) == 10) and str(dialed).startswith("0"): # UK Number return "+44%s" % (dialed[1:]) elif len(dialed) == 6: # Local Fishguard numbers return "+441348%s" % (dialed) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_phone_number(n):", "def make_g_number():\n return fake.bothify(text='??#########')", "def genRingSetting(self):\n num = random.randrange(0,25) #Generates a random number from 0 to 25\n if num < 10: #If the number is a single digit\n num = str(num) #Turn it into a string\n...
[ "0.67825305", "0.66143125", "0.6443617", "0.6335627", "0.61709976", "0.6137482", "0.61264277", "0.612129", "0.6055422", "0.6015775", "0.59728545", "0.59717906", "0.5958998", "0.5921384", "0.5883006", "0.5873767", "0.586697", "0.5804218", "0.5802712", "0.58013135", "0.5783599"...
0.6641851
1
Build segment tree like postorder traversal. Update val of current node after finishing left and right tree.
def buildTree(self, nums, start, end): if start > end: # did not have this stop condition causing error of corner case: nums=[] return None node = SegmentTreeNode(start, end) if start == end: node.val = nums[start] else: mid = start+(end-start)/2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_order(self):\n def walk(root):\n\n if root.left:\n walk(root.left)\n\n if root.right:\n walk(root.right)\n\n self.post_values.append(root.value)\n \n walk(self.root)\n return self.post_values", "def split(self):\n pos_median = len(self.keys)/2\n key_...
[ "0.6561397", "0.61341494", "0.61319625", "0.60247433", "0.59410894", "0.5884449", "0.58787715", "0.58702564", "0.58403224", "0.5817452", "0.5800125", "0.57779187", "0.5744896", "0.57405335", "0.5740044", "0.57331264", "0.56996477", "0.5665964", "0.566581", "0.5633416", "0.561...
0.6499849
1
Update segment tree. Don't forget to update cur.val when finishing update left or right branch.
def updateTree(self, i, val, cur): start, end = cur.start, cur.end if start == end == i: cur.val = val return mid = start+(end-start)/2 if i <= mid: cur.val -= cur.left.val self.updateTree(i, val, cur.left) cur.val += cur.left.v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update(self, idx):\n parent = (idx - 1) // 2\n while parent >= 0:\n left, right = 2 * parent + 1, 2 * parent + 2\n self.__tree[parent] = self.__tree[left] + self.__tree[right]\n parent = (parent - 1) // 2", "def updatetree(self):\n if self.node:\n self...
[ "0.67214155", "0.6306272", "0.61446464", "0.6127258", "0.59922403", "0.5971634", "0.5816988", "0.5806862", "0.5668333", "0.5661651", "0.56332695", "0.5599132", "0.5585826", "0.55756366", "0.5561707", "0.549598", "0.5485218", "0.54720384", "0.54681623", "0.54573953", "0.543765...
0.7396965
0