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
as reduce2lat_old, but uses the averager module for greater capabilities
def reduce2lat( mv, vid=None ): if vid==None: # Note that the averager function returns a variable with meaningless id. vid = 'reduced_'+mv.id axes = allAxes( mv ) axis_names = [ a.id for a in axes if a.id!='lat' ] axes_string = '('+')('.join(axis_names)+')' avmv = averager( mv, axis=axes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce2lat_old( mv, vid=None ):\n # >>> For now, I'm assuming that the only axes are time,lat,lon\n # And I'm assuming equal spacing in lon (so all longitudes contribute equally to the average)\n # If they aren't, it's best to use area from cell_measures attribute if available; otherwise\n # comput...
[ "0.71746695", "0.7159011", "0.693063", "0.6655468", "0.6433842", "0.60125995", "0.59771603", "0.5941421", "0.5817719", "0.57721925", "0.57491624", "0.57213616", "0.5685925", "0.5673032", "0.559728", "0.5517831", "0.544977", "0.5412728", "0.53823274", "0.53628594", "0.5176197"...
0.7389955
0
as reduce2lat, but averaging reduces coordinates to (lev,lat)
def reduce2levlat( mv, vid=None ): if vid==None: # Note that the averager function returns a variable with meaningless id. vid = 'reduced_'+mv.id if levAxis(mv) is None: return None if latAxis(mv) is None: return None axes = allAxes( mv ) timeax = timeAxis(mv) if timeax.getBounds()==No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce2lat( mv, vid=None ):\n if vid==None: # Note that the averager function returns a variable with meaningless id.\n vid = 'reduced_'+mv.id\n axes = allAxes( mv )\n axis_names = [ a.id for a in axes if a.id!='lat' ]\n axes_string = '('+')('.join(axis_names)+')'\n\n avmv = averager( m...
[ "0.69857925", "0.6807853", "0.6773293", "0.6564294", "0.6501866", "0.64869905", "0.6404557", "0.6294769", "0.59781444", "0.595413", "0.5908495", "0.5811801", "0.5792106", "0.577163", "0.57321805", "0.5651219", "0.55763006", "0.5573147", "0.5571079", "0.5546693", "0.55466807",...
0.6961548
1
as reduce2levlat, but data is averaged only for time restricted to the specified season; as in reduce2lat_seasona.
def reduce2levlat_seasonal( mv, seasons=seasonsyr, vid=None ): if vid==None: # Note that the averager function returns a variable with meaningless id. vid = 'reduced_'+mv.id if levAxis(mv) is None: return None if latAxis(mv) is None: return None axes = allAxes( mv ) timeax = timeAxis(mv) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce2latlon_seasonal( mv, seasons=seasonsyr, vid=None ):\n # This differs from reduce2lat_seasonal only in the line \"axis_names =\"....\n # I need to think about how to structure the code so there's less cut-and-paste!\n if vid==None:\n vid = 'reduced_'+mv.id\n # Note that the averager fu...
[ "0.75936365", "0.74594027", "0.688166", "0.6238695", "0.61847365", "0.6133317", "0.60225564", "0.5992159", "0.58987415", "0.5852854", "0.5766803", "0.5747153", "0.555478", "0.54478663", "0.5436463", "0.5383689", "0.53339547", "0.53088355", "0.5280703", "0.5271107", "0.5259503...
0.74663657
1
as reduce2lat, but data is used only for time restricted to the specified season. The season is specified as an object of type cdutil.ties.Seasons, and defaults to the whole year. The returned variable will still have a time axis, with one value per season specified.
def reduce2lat_seasonal( mv, seasons=seasonsyr, vid=None ): if vid==None: vid = 'reduced_'+mv.id # Note that the averager function returns a variable with meaningless id. # The climatology function returns the same id as mv, which we also don't want. # The slicers in time.py require getBounds()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce2latlon_seasonal( mv, seasons=seasonsyr, vid=None ):\n # This differs from reduce2lat_seasonal only in the line \"axis_names =\"....\n # I need to think about how to structure the code so there's less cut-and-paste!\n if vid==None:\n vid = 'reduced_'+mv.id\n # Note that the averager fu...
[ "0.67101383", "0.61974657", "0.6165893", "0.57036895", "0.54976517", "0.5443406", "0.5429207", "0.5275951", "0.5232346", "0.52280706", "0.5203124", "0.5159468", "0.515358", "0.51510376", "0.5138082", "0.50527817", "0.50496626", "0.5037915", "0.49941966", "0.4983268", "0.49606...
0.6925929
0
as reduce2lat_seasonal, but both lat and lon axes are retained.
def reduce2latlon_seasonal( mv, seasons=seasonsyr, vid=None ): # This differs from reduce2lat_seasonal only in the line "axis_names =".... # I need to think about how to structure the code so there's less cut-and-paste! if vid==None: vid = 'reduced_'+mv.id # Note that the averager function retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce2lat_seasonal( mv, seasons=seasonsyr, vid=None ):\n if vid==None:\n vid = 'reduced_'+mv.id\n # Note that the averager function returns a variable with meaningless id.\n # The climatology function returns the same id as mv, which we also don't want.\n\n # The slicers in time.py require ...
[ "0.7120988", "0.65913016", "0.5912345", "0.58565855", "0.5846651", "0.5827005", "0.5757517", "0.5742788", "0.56260955", "0.5573889", "0.5551024", "0.5517785", "0.5454073", "0.5447219", "0.5380435", "0.5367206", "0.53613245", "0.5329884", "0.52797866", "0.527883", "0.5270271",...
0.7579458
0
Input is a leveldependent variable mv and a level slev to select. slev is an instance of udunits thus it has a value and a units attribute. This function will create and return a new variable mvs without a level axis. The values of mvs correspond to the values of mv with level set to slev. Interpolation isn't done yet,...
def select_lev( mv, slev ): levax = levAxis(mv) # Get ig, the first index for which levax[ig]>slev # Assume that levax values are monotonic. dummy,slev = reconcile_units( levax, slev ) # new slev has same units as levax if levax[0]<=levax[-1]: ids = numpy.where( levax[:]>=slev.value ) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levvar( mv ):\n # First get the axis. This is probably not as general as we'll need...\n if mv is None: return None\n lev_axis = levAxis(mv)\n #levmv = mv.clone() # good if mv has only a lev axis\n #levmv[:] = lev_axis[:]\n levmv = cdms2.createVariable( lev_axis[:], axes=[lev_axis], id='lev...
[ "0.67565304", "0.6339013", "0.5813282", "0.55218333", "0.55123705", "0.54566956", "0.54150814", "0.5345006", "0.53043866", "0.52986836", "0.5298433", "0.5282433", "0.5152977", "0.5144597", "0.50879806", "0.50478345", "0.50315887", "0.5008072", "0.5002643", "0.49997583", "0.49...
0.77553666
0
returns a transient variable which is dimensioned along the lat axis but whose values are the latitudes
def latvar( mv ): # First get the axis. This is probably not as general as we'll need... if mv is None: return None lat_axis = latAxis(mv) #latmv = mv.clone() # good if mv has only a lat axis #latmv[:] = lat_axis[:] latmv = cdms2.createVariable( lat_axis[:], axes=[lat_axis], id='lat', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latlons(self):\n\t\t\n\t\t# First check we have a grid feature type\n\t\tif self.featuretype in ['Grid', 'GridSeries']:\n\n\t\t\tlatvar = self.latitude_variable\n\t\t\tlonvar = self.longitude_variable\n\n\t\t\tlatdims = self.coordinates_mapping['latitude']['map']\n\t\t\tlondims = self.coordinates_mapping['long...
[ "0.67513454", "0.66928744", "0.6395381", "0.63260347", "0.61951125", "0.61491525", "0.613318", "0.6064862", "0.6063187", "0.6053654", "0.6050005", "0.6028488", "0.5952476", "0.58669955", "0.5862181", "0.5862181", "0.58513904", "0.58510435", "0.5826054", "0.58009094", "0.58002...
0.74743557
0
returns a transient variable which is dimensioned along the lon axis but whose values are the longitudes
def lonvar( mv ): # First get the axis. This is probably not as general as we'll need... if mv is None: return None lon_axis = lonAxis(mv) latmv = cdms2.createVariable( lon_axis[:], axes=[lon_axis], id='lon', attributes={'units':lon_axis.units}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latvar( mv ):\n # First get the axis. This is probably not as general as we'll need...\n if mv is None: return None\n lat_axis = latAxis(mv)\n #latmv = mv.clone() # good if mv has only a lat axis\n #latmv[:] = lat_axis[:]\n latmv = cdms2.createVariable( lat_axis[:], axes=[lat_axis], id='lat...
[ "0.67902434", "0.6771255", "0.67498714", "0.6621353", "0.6568897", "0.6417901", "0.617368", "0.61442626", "0.6087874", "0.60350233", "0.5941551", "0.59397936", "0.5933728", "0.5912952", "0.5898972", "0.58715075", "0.5850327", "0.57997036", "0.579611", "0.5794126", "0.57769763...
0.7568185
0
returns a transient variable which is dimensioned along the lev (level) axis but whose values are the levels
def levvar( mv ): # First get the axis. This is probably not as general as we'll need... if mv is None: return None lev_axis = levAxis(mv) #levmv = mv.clone() # good if mv has only a lev axis #levmv[:] = lev_axis[:] levmv = cdms2.createVariable( lev_axis[:], axes=[lev_axis], id='lev', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_lev( mv, slev ):\n levax = levAxis(mv)\n # Get ig, the first index for which levax[ig]>slev\n # Assume that levax values are monotonic.\n dummy,slev = reconcile_units( levax, slev ) # new slev has same units as levax\n if levax[0]<=levax[-1]:\n ids = numpy.where( levax[:]>=slev.va...
[ "0.61772287", "0.60954696", "0.6019012", "0.5921437", "0.57173896", "0.56935555", "0.55191696", "0.55090266", "0.5501754", "0.5488749", "0.5447241", "0.5427211", "0.54218185", "0.54218185", "0.54218185", "0.5372012", "0.5331837", "0.52983266", "0.52873015", "0.5285758", "0.52...
0.7218306
0
From a variable or axis of pressures, this function converts to millibars, and returns the result as a numpy array.
def pressures_in_mb( pressures ): if not hasattr( pressures, 'units' ): return None if pressures.units=='mb': pressures.units = 'mbar' # udunits uses mb for something else return pressures[:] tmp = udunits(1.0,pressures.units) s,i = tmp.how('mbar') pressmb = s*pressures[:] + i re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_mag_1(x):\n return np.array([np.true_divide(ui, mag(x)) for ui in x])", "def cm2inch(x: Union[float, Sequence[float], NDArray]) -> Sequence[float]:\n return list(np.array(x) / 2.54)", "def convertUnits(self, varname, arr):\n if varname == \"SPDQ\" or varname == \"PHQ\":\n retu...
[ "0.50821847", "0.50635743", "0.5063201", "0.5052912", "0.50040376", "0.49670303", "0.48602846", "0.47888026", "0.47871676", "0.47724292", "0.47648123", "0.47488585", "0.46842295", "0.46627557", "0.46367168", "0.46319687", "0.4622999", "0.46144953", "0.46112272", "0.45830104", ...
0.5553397
0
returns a transient variable which is dimensioned along the lev (level) axis and whose values are the heights corresponding to the pressure levels found as the lev axis of mv. Levels will be converted to millibars. heights are returned in km
def heightvar( mv ): if mv is None: return None lev_axis = levAxis(mv) heights = 0.001 * press2alt.press2alt( pressures_in_mb(lev_axis) ) # 1000 m = 1 km heightmv = cdms2.createVariable( heights, axes=[lev_axis], id=mv.id, attributes={'units':"km"} ) return heig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levvar( mv ):\n # First get the axis. This is probably not as general as we'll need...\n if mv is None: return None\n lev_axis = levAxis(mv)\n #levmv = mv.clone() # good if mv has only a lev axis\n #levmv[:] = lev_axis[:]\n levmv = cdms2.createVariable( lev_axis[:], axes=[lev_axis], id='lev...
[ "0.6776988", "0.6006147", "0.590526", "0.5898939", "0.55466783", "0.54994154", "0.547498", "0.5466537", "0.5447086", "0.54124725", "0.5391253", "0.5389002", "0.53862095", "0.5358909", "0.5290569", "0.5286262", "0.5192268", "0.51763445", "0.5174741", "0.51733345", "0.5168547",...
0.77257425
0
returns a transient variable which is dimensioned as whichever of mv1, mv2 has the fewest latitude points but whose values are the latitudes
def latvar_min( mv1, mv2 ): if mv1 is None: return None if mv2 is None: return None lat_axis1 = latAxis(mv1) lat_axis2 = latAxis(mv2) if len(lat_axis1)<=len(lat_axis2): lat_axis = lat_axis1 mv = mv1 else: lat_axis = lat_axis2 mv = mv2 latmv = cdms2.createVaria...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lonvar_min( mv1, mv2 ):\n if mv1 is None: return None\n if mv2 is None: return None\n lon_axis1 = lonAxis(mv1)\n lon_axis2 = lonAxis(mv2)\n if len(lon_axis1)<=len(lon_axis2):\n lon_axis = lon_axis1\n mv = mv1\n else:\n lon_axis = lon_axis2\n mv = mv2\n lonmv = c...
[ "0.69351184", "0.62349105", "0.6094042", "0.5838326", "0.5824384", "0.58051234", "0.57359993", "0.5527261", "0.5517576", "0.5458443", "0.54356056", "0.5415327", "0.54134643", "0.54001105", "0.5361201", "0.52343124", "0.52035445", "0.51936215", "0.5187855", "0.51732856", "0.51...
0.73494667
0
returns a transient variable which is dimensioned as whichever of mv1, mv2 has the fewest longitude points but whose values are the longitudes
def lonvar_min( mv1, mv2 ): if mv1 is None: return None if mv2 is None: return None lon_axis1 = lonAxis(mv1) lon_axis2 = lonAxis(mv2) if len(lon_axis1)<=len(lon_axis2): lon_axis = lon_axis1 mv = mv1 else: lon_axis = lon_axis2 mv = mv2 lonmv = cdms2.createVaria...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latvar_min( mv1, mv2 ):\n if mv1 is None: return None\n if mv2 is None: return None\n lat_axis1 = latAxis(mv1)\n lat_axis2 = latAxis(mv2)\n if len(lat_axis1)<=len(lat_axis2):\n lat_axis = lat_axis1\n mv = mv1\n else:\n lat_axis = lat_axis2\n mv = mv2\n latmv = c...
[ "0.68968886", "0.66709334", "0.6106323", "0.59900844", "0.5892058", "0.57636064", "0.57299185", "0.5693455", "0.5671543", "0.56326985", "0.5609396", "0.5597439", "0.5474902", "0.5423528", "0.5386049", "0.53539693", "0.5313379", "0.5313333", "0.53117704", "0.53086036", "0.5308...
0.7268381
0
returns a transient variable which is dimensioned as whichever of mv1, mv2 has the fewest level points but whose values are the levels
def levvar_min( mv1, mv2 ): if mv1 is None: return None if mv2 is None: return None lev_axis1 = levAxis(mv1) lev_axis2 = levAxis(mv2) if len(lev_axis1)<=len(lev_axis2): lev_axis = lev_axis1 mv = mv1 else: lev_axis = lev_axis2 mv = mv2 levmv = cdms2.createVaria...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_lev( mv, slev ):\n levax = levAxis(mv)\n # Get ig, the first index for which levax[ig]>slev\n # Assume that levax values are monotonic.\n dummy,slev = reconcile_units( levax, slev ) # new slev has same units as levax\n if levax[0]<=levax[-1]:\n ids = numpy.where( levax[:]>=slev.va...
[ "0.60400754", "0.5711261", "0.53916866", "0.5316189", "0.5314503", "0.5262245", "0.5258733", "0.5256473", "0.52382195", "0.5228566", "0.5206168", "0.51694137", "0.51330495", "0.51280445", "0.51269424", "0.5126678", "0.5115695", "0.51080126", "0.50934094", "0.5042593", "0.5039...
0.65224934
0
interpolates a variable mv along its second axis, normally latitude, so as to match the new axis (which should be coarser, i.e. fewer points), and returns a numpy array of the interpolated values. The first axis is normally levels, and isn't expected to be very large (usually <20; surely <50) There shall be no more tha...
def interp2( newaxis1, mv ): missing = mv.get_fill_value() axes = allAxes(mv) if len(newaxis1[:])>len(axes[1][:]): return mv new_vals = numpy.ma.masked_all( ( len(axes[0]), len(newaxis1[:]) ) ) for i in range(len( axes[0] )): new_vals[i,:] = numpy.interp( newaxis1[:], axes[1][:], mv[i,:], l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce2lat_old( mv, vid=None ):\n # >>> For now, I'm assuming that the only axes are time,lat,lon\n # And I'm assuming equal spacing in lon (so all longitudes contribute equally to the average)\n # If they aren't, it's best to use area from cell_measures attribute if available; otherwise\n # comput...
[ "0.6127793", "0.61027855", "0.6082101", "0.59283215", "0.5838112", "0.57578194", "0.5623196", "0.5599504", "0.55420876", "0.54633516", "0.5410154", "0.5350282", "0.5312561", "0.52844816", "0.52626956", "0.5179751", "0.5162937", "0.5137714", "0.5093342", "0.5058199", "0.503866...
0.62990654
0
returns mv1[0,]mv2[0,]; they should be dimensioned alike. Attributes will be fixed up where I know how.
def aminusb0( mv1, mv2 ): mv = mv1[0,] - mv2[0,] if hasattr(mv,'long_name'): if mv.long_name==mv1.long_name: # They're different, shouldn't have the same long_name mv.long_name = '' return mv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gu_matvec(x1, x2):\n return (x1 @ x2[..., np.newaxis])[..., 0]", "def get_molecular_matrix_and_vector(single_body, two_body):\n x, y = single_body.shape\n func = np.vectorize(round_custom)\n _new_dim = x * y\n single_one_dim = func(single_body.reshape(_new_dim, 1))\n two_body_two_dim = fun...
[ "0.5995994", "0.5515784", "0.5483453", "0.5478269", "0.5441555", "0.5402159", "0.5384988", "0.5359179", "0.52837175", "0.5270582", "0.5260968", "0.5260383", "0.525911", "0.5228595", "0.5210489", "0.5195151", "0.5183675", "0.51530695", "0.51313037", "0.51037055", "0.5097388", ...
0.56507003
1
returns a transient variable representing mv1mv2, where mv1 and mv2 are variables, normally transient variables, which are required to depend only one axis. To perform the subtraction, one of the variables is linearly interpolated to the axis of the other. The axis used will be the coarsest (fewest points) of the two a...
def aminusb_1ax( mv1, mv2 ): mv1, mv2 = reconcile_units( mv1, mv2 ) if hasattr(mv1,'units') and hasattr(mv2,'units') and mv1.units!=mv2.units: print "WARNING: aminusb_1ax1 is subtracting variables with different units!",mv1,mv1 if mv1 is None or mv2 is None: return None missing = mv1.get_fill_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_sub(mv1, mv2):\n obj = expand(mv1.obj - mv2.obj)\n return MV(obj)", "def displacement(cls, v1, v2):\n return np.array([v2 - v1])", "def aminusb_ax2( mv1, mv2 ):\n if hasattr(mv1,'units') and hasattr(mv2,'units') and mv1.units!=mv2.units:\n print \"WARING: aminusb_ax2 is...
[ "0.6467121", "0.6038152", "0.60112774", "0.598649", "0.5940264", "0.59214985", "0.5907114", "0.5860278", "0.5774416", "0.57667285", "0.5750668", "0.56914055", "0.5675003", "0.5616137", "0.56054354", "0.5589946", "0.5553921", "0.55365384", "0.55223125", "0.5514815", "0.5504505...
0.66377026
0
Returns time averages of the cems2 variable mv. The average is comuted only over times which lie in the specified season(s). The returned variable has the same number of dimensions as mv, but the time axis has been reduced to the number of seasons requested. The seasons are specified as an object of type cdutil.times.S...
def timeave_seasonal( mv, seasons=seasonsyr ): return seasons.climatology(mv)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_time_seasonal( mv, seasons=seasonsyr, vid=None ):\n if vid==None:\n vid = 'reduced_'+mv.id\n # Note that the averager function returns a variable with meaningless id.\n # The climatology function returns the same id as mv, which we also don't want.\n\n # The slicers in time.py require...
[ "0.7113886", "0.68064904", "0.6650361", "0.61950076", "0.5758541", "0.5734643", "0.55560625", "0.54895353", "0.5439703", "0.522154", "0.51681584", "0.5160492", "0.5129565", "0.5069776", "0.50522226", "0.50236505", "0.4989968", "0.49448606", "0.49113876", "0.48840415", "0.4866...
0.6935159
1
Returns a time average of the cdms2 variable mv. mv is a cdms2 variable, assumed to be timedependent and indexed as is usual for CFcompliant variables, i.e. mv(time,...). What's returned is a numpy array, not a cdms2 variable. (I may change this in the future).
def timeave_old( mv ): # I haven't thought yet about how missing values would work with this... # If time intervals be unequal, this will have to be changed... sh = mv.shape # e.g. [312,90,144] for t,lat,lon n = sh[0] # BTW, this is the size of everything else: # n2 = reduce( operator.mul, sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_time( mv, vid=None ):\n if vid==None: # Note that the averager function returns a variable with meaningless id.\n vid = 'reduced_'+mv.id\n axes = allAxes( mv )\n axis_names = [ a.id for a in axes if a.id=='time' ]\n axes_string = '('+')('.join(axis_names)+')'\n if len(axes_string...
[ "0.58772254", "0.569831", "0.54306823", "0.5339006", "0.52570695", "0.5178657", "0.51458687", "0.5114982", "0.5073207", "0.50591934", "0.50121516", "0.5010453", "0.50002575", "0.49653572", "0.49469918", "0.492515", "0.492515", "0.48782063", "0.48579815", "0.4835696", "0.48353...
0.5918535
0
returns a TransientVariable containing the minimum and maximum values of all the variables provided as arguments
def minmin_maxmax( *args ): rmin = min( [ mv.min() for mv in args ] ) rmax = max( [ mv.max() for mv in args ] ) rmv = cdms2.createVariable( [rmin,rmax] ) return rmv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_minimum():\n return [\n convert_variables([0.78547, 0.78547, 0.78547]),\n ]", "def __minimum_remaining_values(self, unassigned_vars):\n min_var = None\n for var in unassigned_vars:\n if min_var is None:\n min_var = var\n elif len...
[ "0.6460465", "0.61516154", "0.603381", "0.5994661", "0.5891523", "0.5836747", "0.58244497", "0.57395023", "0.5681477", "0.5667921", "0.56678796", "0.5662136", "0.56610906", "0.5639008", "0.562747", "0.5615644", "0.5598546", "0.55895096", "0.5584579", "0.5576427", "0.5575043",...
0.7315337
0
If mv depends on an axis with just one value, create a copy of mv without that axis, and without the corresponding data dimension. Normally this happens when time has been averaged out, but there is still a onevalued time axis left (thus one would normally use id='time'). You can specify the axis id if there might be m...
def delete_singleton_axis( mv, vid=None ): axes = allAxes(mv) saxis = None si = None for i in range(len(axes)): if len(axes[i])==1 and (vid==None or axes[i].id==vid): saxis = axes[i] si = i del axes[si] break if saxis==None: return mv data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_time( mv, vid=None ):\n if vid==None: # Note that the averager function returns a variable with meaningless id.\n vid = 'reduced_'+mv.id\n axes = allAxes( mv )\n axis_names = [ a.id for a in axes if a.id=='time' ]\n axes_string = '('+')('.join(axis_names)+')'\n if len(axes_string...
[ "0.6247364", "0.59301597", "0.55981517", "0.55702573", "0.53490317", "0.5049275", "0.49913675", "0.49404666", "0.48569542", "0.4843272", "0.4835321", "0.47630703", "0.47483668", "0.47441968", "0.47385386", "0.46919236", "0.46870866", "0.4654426", "0.46510515", "0.46408376", "...
0.71518254
0
Not much tested I decided against doing overlapping line plots this way. The input arguments are two variables (cdms2 MVs, normally TransientVariables), with whatever compatibility is needed for this function to work. New axes are computed which can be used for both variables. These axes are returned as a list of tuple...
def common_axes( mv1, mv2 ): axes1 = [a[0] for a in mv1.getDomain()] axes2 = [a[0] for a in mv2.getDomain()] if len(axes1)!=len(axes2): print "ERROR. common_axes requires same number of axes in",mv1," and",mv2 return None axes3 = [] for i in range(len(axes1)): axes3.append(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_axes(self):\n fig = plt.figure(1)\n axs = fig.add_subplot(1, 1, 1)\n fig.clf()\n axs = plt.subplots(1, 2)\n ax1 : plt.axis = axs[0]\n ax2 : plt.axis = axs[1]\n fig.canvas.draw()\n \n line1_t, = ax1.plot([], label='train')\n line1_v, = ...
[ "0.57410544", "0.57360107", "0.5571669", "0.55329823", "0.5515343", "0.54836935", "0.5431624", "0.5425385", "0.5408111", "0.5307821", "0.5279651", "0.5267647", "0.52437675", "0.52202445", "0.51879686", "0.5187689", "0.51863897", "0.5173515", "0.51703244", "0.5135122", "0.5129...
0.63710725
0
Not much tested I decided against doing overlapping line plots this way. The input arguments are two axes (AbstractAxis class), as compatible as necessary for the following to be sensible. This function has 3 return values. It returns a TransientAxis which includes all the points of the input axes. It may be one of the...
def common_axis( axis1, axis2 ): if hasattr( axis1, 'units' ): units1 = axis1.units.lower().replace(' ','_') if axis1.isTime(): axis1.toRelativeTime( units1 ) #probably will change input argument else: units1 = None if hasattr( axis2, 'units' ): units2 = axis2.un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_axes( mv1, mv2 ):\n axes1 = [a[0] for a in mv1.getDomain()]\n axes2 = [a[0] for a in mv2.getDomain()]\n if len(axes1)!=len(axes2):\n print \"ERROR. common_axes requires same number of axes in\",mv1,\" and\",mv2\n return None\n axes3 = []\n for i in range(len(axes1)):\n ...
[ "0.61138195", "0.6088058", "0.6041942", "0.5724058", "0.55722874", "0.54428166", "0.5421346", "0.5317659", "0.53087", "0.52630603", "0.5246884", "0.521855", "0.5203898", "0.5200251", "0.51671886", "0.5156836", "0.51552814", "0.5126504", "0.51036406", "0.5095335", "0.5079292",...
0.69112474
0
Not much tested I decided against doing overlapping line plots this way. Returns a TransientVaraible made by replacing an axis axisold of a TransientVariable mv with a new axis. The new axis will have all points of the old axis, but may have more, thus requiring the new variable to have more missing data. The variable ...
def convert_axis( mv, axisold, axisindnew ): (axisnew, indexina3) = axisindnew axes = allAxes(mv) kold = None for k in range(len(axes)): if axes[k]==axisold: kold=k if kold==None: print "ERROR. convert_axis cannot find axis",axisold," in variable",mv if len(axisold)==len(axisnew)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_axis(self, dim:NamedIndex,\n mapping_or_old:'Union[Mapping[NamedIndex, NamedIndex], NamedIndex]',\n new:'Optional[NamedIndex]'=None):\n\n axes = self[dim] # disable idx_dim access\n # axes = self.get(dim) or self._dim_axes[dim] # dim:'Union[int, Nam...
[ "0.5527314", "0.5408021", "0.5342411", "0.52576274", "0.52193874", "0.52078605", "0.5200823", "0.5182296", "0.5143223", "0.5039198", "0.5026079", "0.49834254", "0.49665734", "0.48400095", "0.48353782", "0.48336178", "0.4820047", "0.48099452", "0.4761784", "0.47465044", "0.471...
0.71285164
0
From a filename, extracts the first part of the filename as the possible name of a family of files; e.g. from 'ts_Amon_bcccsm11_amip_r1i1p1_197901200812.nc' extract and return 'ts_Amon_bcccsm11_amip_r1i1p1'. To distinguish between the end of a file family name and the beginning of the filespecific part of the filename,...
def extract_filefamilyname( self, filename ): matchobject = re.search( r"^.*_\d\d", filename ) if matchobject is None: return filename else: familyname = filename[0:(matchobject.end()-3)] return familyname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reFileName(str_):\n rv = 'None', str_\n m = re.match(r'((?:[a-zA-Z0-9-]){4,})_(.*)$', str_)\n if m:\n rv = m.group(1), m.group(2)\n else:\n m = re.match(r'(\\d+-\\d+)\\.-\\.(.*)$', str_)\n if m:\n rv = m.group(1), m.group(2)\n return rv", "def parse_rarefaction_...
[ "0.7018564", "0.68886405", "0.6759327", "0.6749364", "0.6716706", "0.6699516", "0.6672866", "0.66605604", "0.6640363", "0.65921485", "0.6585", "0.65480256", "0.6478625", "0.64543766", "0.64543766", "0.6446561", "0.6443001", "0.64351195", "0.6385604", "0.6374533", "0.6354233",...
0.7713043
0
Finds and opens the files containing data required for the variable, Applies the reduction function to the data, and returns an MV. When completed, this will treat missing data as such. At present only CFcompliant files are supported.
def reduce( self, vid=None ): if vid is None: vid = self._vid rows = self._filetable.find_files( self.variableid, time_range=self.timerange, lat_range=self.latrange, lon_range=self.lonrange, level_range=sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_files(self):\n if not self.unbalanced:\n if not self.validation:\n datas={}\n for var in self.variables:\n datas[var]=xr.open_dataset(\n f'/{self.dlfile_directory}/{self.climate}_{self.variable_translate(var).lower()...
[ "0.5547697", "0.51804596", "0.51175356", "0.50851357", "0.49448034", "0.49235836", "0.49108392", "0.49066615", "0.49041834", "0.4902881", "0.48873246", "0.48858833", "0.48858833", "0.48857036", "0.48537314", "0.47822648", "0.47778893", "0.4767607", "0.47633898", "0.4755537", ...
0.62348145
0
Prepare the file locker. Specify the file to lock and optionally the maximum timeout and the delay between each attempt to lock.
def __init__(self, file_name, timeout=10, delay=.05): self.is_locked = False #self.lockfile = os.path.join(os.getcwd(), "%s.lock" % file_name) self.lockfile = file_name + '.lock' self.file_name = file_name self.timeout = timeout self.delay = delay
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, file_name, timeout=10, delay=.05):\n self.is_locked = False\n self.lockfile = os.path.abspath(file_name)\n self.file_name = file_name\n self.timeout = timeout\n self.delay = delay\n self.fd = None", "def __init__(self, protected_file_path, timeout=None...
[ "0.7269624", "0.6982146", "0.69293517", "0.67427164", "0.6594269", "0.6411413", "0.6381823", "0.63453645", "0.63121194", "0.63120097", "0.62144", "0.6043685", "0.59835607", "0.5917388", "0.5861188", "0.577998", "0.5779113", "0.57543266", "0.5674176", "0.56467295", "0.5624611"...
0.72758126
0
Gets the view model for the cards in the deck
def get_cards(self): return [card.view_model() for card in self._deck.loc]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_card_model(self, model: str) -> Any:\n return self.collection.models.byName(model)", "def cards(self):\r\n return Cards(self)", "def get_card_list(self):\n return self.cards", "def cards(self):\n return self._cards", "def GetView(self):\r\n return self.model.GetV...
[ "0.62337184", "0.6114645", "0.5980971", "0.5815437", "0.5713382", "0.57027954", "0.5669594", "0.5646416", "0.56217915", "0.5597641", "0.55945307", "0.5587441", "0.5510169", "0.5467855", "0.5467855", "0.54545987", "0.542285", "0.540551", "0.5393853", "0.5392188", "0.52771145",...
0.7292069
0
validate rpy2 can load correctly
def test_rpy2_integration(): ## Try to import rpy (test R_HOME path) ## import rpy2.robjects as robjects import rpy2 from rpy2.robjects.packages import importr req_filepath = path.join(ROOT, R_REQUIREMENTS_FILE) with open(req_filepath, 'r') as req_fh: raw_req = req_fh.read().splitlines(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_python():\n from decisionengine.framework.util import reaper # noqa: F401\n\n pass", "def test_rlmm_imported():\n assert \"rlmm\" in sys.modules", "def rpy2_import_test(self):\n try:\n import rpy2\n\n rpy2_present = True\n except:\n rpy2_p...
[ "0.6022934", "0.59124196", "0.5730419", "0.5573902", "0.551886", "0.5433446", "0.5393205", "0.53599614", "0.53094214", "0.53094214", "0.5308447", "0.5308447", "0.5308447", "0.5288998", "0.52846456", "0.52457887", "0.52206194", "0.52099794", "0.5209703", "0.51939344", "0.51855...
0.7157122
0
Returns a generator of packets. This is the sync version of packets_from_tshark. It wait for the completion of each coroutine and reimplements reading packets in a sync way, yielding each packet as it arrives.
def _packets_from_tshark_sync(self, tshark_process, packet_count=None, timeout:float=3.0, max_data_length:int=10000): # NOTE: This has code duplication with the async version, think about how to solve this psml_structure, data = self.eventloop.run_until_complete(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_pkt_seq(self):\n pkt = self.read_pkt_line()\n while pkt:\n yield pkt\n pkt = self.read_pkt_line()", "def pkt_gen(self):\n for i in range(self.num_pkts):\n # create the test packets\n pkt = Ether()/IP()/TCP()/'hello there pretty world!!!'\n...
[ "0.6388171", "0.59669185", "0.58295953", "0.58010983", "0.57933766", "0.579229", "0.57740164", "0.56658477", "0.5569597", "0.55228883", "0.5494399", "0.5487101", "0.5454645", "0.5428898", "0.54204917", "0.53887296", "0.5376197", "0.53683877", "0.52956384", "0.52746814", "0.52...
0.6835916
0
Tests the matrix_vector_product code.
def test_matrix_product(self, use_cache): key = jrandom.PRNGKey(0) dim = 50 max_power = 25 matrix = jrandom.normal(key, (dim, dim)) / 10 vector = jnp.ones((dim,), dtype=jnp.float32) if use_cache: mpstate = model_utils.CachedMatrixPowerState.precompute(matrix, max_power) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mul():\n assert_equal(Vector(3, 1) * 2, Vector(6, 2))\n assert_equal(2 * Vector(3, 1), Vector(6, 2))", "def matrix_vector_prod(m,u):\n each_product = []\n for v in m:\n each_product.append(dot_prod(v, u))\n return each_product", "def test_suite():\r\n test(add_vectors([1, 1], ...
[ "0.7020426", "0.68284523", "0.6791578", "0.67468673", "0.67026436", "0.66827", "0.66523254", "0.66410244", "0.65571856", "0.65571856", "0.650921", "0.6467925", "0.6419744", "0.6303483", "0.62950623", "0.62891656", "0.6261458", "0.62439704", "0.62265456", "0.6186289", "0.61308...
0.75648934
0
Tests the matrix_power_cached code.
def test_matrix_power(self, use_cache): key = jrandom.PRNGKey(0) dim = 50 max_power = 25 matrix = jrandom.normal(key, (dim, dim)) / 10 if use_cache: mpstate = model_utils.CachedMatrixPowerState.precompute(matrix, max_power) else: mpstate = model_utils.LazyMatrixPowerState(matrix) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_matrix_product(self, use_cache):\n\n key = jrandom.PRNGKey(0)\n dim = 50\n max_power = 25\n\n matrix = jrandom.normal(key, (dim, dim)) / 10\n vector = jnp.ones((dim,), dtype=jnp.float32)\n\n if use_cache:\n mpstate = model_utils.CachedMatrixPowerState.precompute(matrix, max_power)\n...
[ "0.73225653", "0.58746", "0.58050704", "0.56987643", "0.5631421", "0.5607155", "0.55773807", "0.55611145", "0.54241306", "0.5411276", "0.5373944", "0.5357646", "0.5337961", "0.5331032", "0.5329204", "0.5325335", "0.5301618", "0.5290857", "0.52838194", "0.5280639", "0.5274496"...
0.824397
0
This function returns the stations with the N highest relative water levels.
def stations_highest_rel_level(stations, N): relative_water_level = [] # Create dictionary of relevant stations with relative water levels for station in stations: if type(station.relative_water_level()) != float: continue else: relative_water_level.append((station.na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\n # build the station list and update the current levels\n station_list = build_station_list()\n update_water_levels(station_list, use_cache=True)\n\n num_stations = 10\n highest_level_stations = stations_highest_rel_level(station_list, num_stations)\n\n print(\"{} stations with the hi...
[ "0.6555966", "0.5809836", "0.5742762", "0.5694438", "0.5691747", "0.56783056", "0.56687224", "0.564456", "0.56208897", "0.56125605", "0.5601425", "0.5596799", "0.55452675", "0.55452675", "0.5542017", "0.55126023", "0.54798305", "0.54398257", "0.5438739", "0.54237264", "0.5405...
0.83433473
0
returns the number of vertices of a graph
def num_vertices(self): return len(self.__graph_dict.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_vertices(self):\n\n return self._graph_state.get_num_vertices()", "def num_vertices(self):\n return self._top_exp.number_of_vertices()", "def n_vertices(self):\n try: \n return self._n_vertices\n except AttributeError:\n self._n_vertices = 0\n ...
[ "0.8294428", "0.82162774", "0.8099264", "0.8084873", "0.8084873", "0.80744034", "0.80422086", "0.7976934", "0.79424685", "0.79383194", "0.7920504", "0.7877179", "0.7767539", "0.7748465", "0.7637932", "0.75549054", "0.74742794", "0.7297782", "0.72895753", "0.7250115", "0.72318...
0.8577807
0
assumes that edge is of type set, tuple or list; between two vertices can be multiple edges!
def add_edge(self, edge): edge = set(edge) (vertex1, vertex2) = tuple(edge) if vertex1 in self.__graph_dict.keys() and vertex2 in self.__graph_dict.keys(): if vertex2 in self.__graph_dict[vertex1] and vertex1 in self.__graph_dict[vertex2]: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, edge):\n edge = set(edge)\n (vertex1, vertex2) = tuple(edge)\n if vertex1 in self.graph_dict:\n self.graph_dict[vertex1].append(vertex2)\n else:\n self.graph_dict[vertex1] = [vertex2]\n return edge", "def add_edge(self, edge):\n e...
[ "0.6924097", "0.67404646", "0.6645291", "0.6581878", "0.65670335", "0.65597415", "0.6473252", "0.6442472", "0.64420813", "0.6412036", "0.6311367", "0.6298211", "0.62873614", "0.6284625", "0.6282889", "0.62800133", "0.6269465", "0.6244941", "0.6243469", "0.62401235", "0.622762...
0.69176805
1
Slim options if more than n left.
def slim_down_options(options, count_func, n=25, v=''): if len(options) > 100: options_slim = [] c = count_func(base) for obj in options: if c == count_func(obj): options_slim.append(obj) if len(options_slim) > n: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keep_n(self, n=100):\n before = self.item_count()\n\n item_count = self.item_count()\n if item_count > n: self.filter(self.sample(n))\n\n after = self.item_count()\n with msg(f'Keeping (at most) {n} items: {after} of {before}', done=False, enabled=self.output):pass", "def l...
[ "0.5554807", "0.54940754", "0.544022", "0.53377664", "0.5276856", "0.5170868", "0.5170868", "0.51587814", "0.51399946", "0.51267874", "0.50891244", "0.50637853", "0.5049573", "0.50469786", "0.5009878", "0.49905896", "0.4988287", "0.49703386", "0.49435568", "0.4943084", "0.493...
0.7012843
0
Print the words in the vocabulary sorted according to their embeddingdistance to the given word. Different metrics can be used, e.g. 'cosine' or 'euclidean'.
def print_sorted_words(word, metric='cosine'): # Get the token (i.e. integer ID) for the given word. token = tokenizer.word_index[word] # Get the embedding for the given word. Note that the # embedding-weight-matrix is indexed by the word-tokens # which are integer IDs. embedding = weights_emb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_analogy(self):\n data = open(\"data/word_analogy_subset.en.ar.txt\").read().split('\\n')\n data = [x for x in data if len(x.split()) == 4]\n cnt = 0\n keys = list(self.embeddings_index.keys())\n vectors = np.array(list(self.embeddings_index.values()))\n norms = np...
[ "0.6305388", "0.6230253", "0.6139421", "0.6103458", "0.60941505", "0.6086169", "0.60522497", "0.6010836", "0.6005883", "0.5975922", "0.5967013", "0.59614223", "0.59542745", "0.5919518", "0.5901676", "0.5882043", "0.58806413", "0.5867562", "0.5837269", "0.5824132", "0.58083713...
0.8753714
0
Calculate the FDR curve for arrays of target scores and decoy scores.
def calc_fdr_arr(target_arr, decoy_arr, ascending=False): n, m = len(target_arr), len(decoy_arr) if n != m: raise TypeError('target should be same length as decoy {} {}'.format(n, m)) ordering = 1 if ascending else -1 # reversed sorting if score is not ascending combined = np.concatenate((targe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cost_function_derivative(self, y_pred, y, X, m):\n\n derivatives= np.zeros((X.shape[0],1))\n for j in range(X.shape[0]):\n auxsum = 0\n for i in range(m):\n auxsum+=(y_pred[0][i] -y[0][i])*X[j][i]\n derivatives[j][0] = self.theta[j][0] - self.alpha...
[ "0.5936621", "0.5873862", "0.5801516", "0.5756439", "0.57008326", "0.5582457", "0.55692595", "0.55287987", "0.55272543", "0.55269563", "0.55214703", "0.5503548", "0.5492775", "0.5465149", "0.54620695", "0.5462017", "0.54504746", "0.5437137", "0.5423348", "0.5410652", "0.54100...
0.7097738
0
Find the index of the point before the rightmost crossing point between an FDR curve and a FDR target value. Formally speaking, given an array fdr_curve and a number fdr_target, find the smallest index i such that fdr_curve[j] >= fdr_target for all j > i
def find_crossing(fdr_curve, fdr_target): #if not is_fdr_curve(fdr_curve): # raise ValueError("Not a valid FDR curve") #ADP - need to review is_fdr_curve criteria +noise means can start above 0 if not 0 < fdr_target < 1: return -1 less_zero_indices = np.where(fdr_curve <= fdr_target)[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_closest(A, target):\n idx = A.searchsorted(target)\n idx = np.clip(idx, 1, len(A)-1)\n left = A[idx-1]\n right = A[idx]\n idx -= target - left < right - target\n return idx", "def __find_r_corr_in_points(arr):\n n = len(arr)\n th = arr[n // 2] * exp(-1.0)\n for i i...
[ "0.6155449", "0.60407877", "0.5844136", "0.5744244", "0.5732119", "0.5721886", "0.57151353", "0.56536", "0.56136966", "0.55823135", "0.5580776", "0.557572", "0.557235", "0.55606055", "0.5549734", "0.55226475", "0.5512953", "0.5509117", "0.55001134", "0.5492124", "0.5484047", ...
0.8555478
0
Calculation file hash use md5
def calc_file_md5(file_path): hash_md5 = str() method = hashlib.md5() if not os.path.exists(file_path): logger.error("File(%s) don not exist, can not calculation file hash" % file_path) return hash_md5 with open(file_path, 'rb') as f: for chunk in read_chunks(f, 1024 * 1024): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CalcMD5(filepath):\n with open(filepath,'rb') as f:\n md5obj = hashlib.md5()\n md5obj.update(f.read())\n return md5obj.hexdigest()", "def calc_file_hash(filepath):\n with open(filepath, 'rb') as f:\n return md5(f.read()).hexdigest()", "def md5_hash(file_path):\n with op...
[ "0.82365745", "0.80100733", "0.79871917", "0.7958175", "0.79547316", "0.7920195", "0.78607863", "0.7847036", "0.7811081", "0.7784871", "0.7781297", "0.7760272", "0.7756879", "0.7747943", "0.7744211", "0.7732946", "0.77212536", "0.77095705", "0.7701398", "0.7690354", "0.768329...
0.8185329
1
Fetch the process of cpu and memory info
def get_cpu_memory_info(process_name): info_dict = dict() try: process_list = get_process_info(process_name) for process in process_list: cmdline = process.cmdline() name = os.path.basename(cmdline[2]) if len(cmdline) > 3 else process_name + "_" + str(process.pid) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cpuinfo(self):\n \n command = 'cat /proc/cpuinfo'\n\tpipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n stdout, stderr = pipe.communicate()\n\tinfo = stdout.strip()\n cpu_type = None\n\tn_proc = 0\n\tfor line in info.split('\\n'):\n ...
[ "0.7663754", "0.74077755", "0.7378916", "0.72161144", "0.71284556", "0.7078209", "0.7037945", "0.70256805", "0.70198095", "0.6998216", "0.69025713", "0.68909866", "0.68835574", "0.6817426", "0.67715806", "0.67403156", "0.673724", "0.6727778", "0.6664821", "0.66454977", "0.663...
0.75478333
1
Check whether `obj` inherits from Boost.Python.enum.
def is_boost_enum(obj: Any) -> bool: for cls in type(obj).__bases__: if "Boost.Python.enum" in str(cls): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enum(schema_obj):\n\n return (isinstance(schema_obj, schema.Enum) or\n (isinstance(schema_obj, schema.Field) and schema_obj.enum_type))", "def is_enum(self):\n return False", "def is_enum(self):\n return self.is_complex and not self.is_class", "def inherits_from(obj, a_class):\...
[ "0.7379043", "0.6682498", "0.6575283", "0.63988435", "0.6314002", "0.63092816", "0.6300783", "0.62994534", "0.62766397", "0.6261479", "0.6242206", "0.6231385", "0.6226024", "0.62231505", "0.6219832", "0.6219832", "0.6207228", "0.61851394", "0.61775", "0.6171979", "0.6163057",...
0.8621327
0
Check whether `obj` is an IceCubespecific class.
def is_icecube_class(obj: Any) -> bool: classname = str(type(obj)) return "icecube." in classname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obj_is_in_class(obj: unrealsdk.UObject, in_class: str) -> bool:\n return bool(obj.Class == unrealsdk.FindClass(in_class))", "def isclass(object):\r\n return isinstance(object, (type, types.ClassType))", "def is_child_class(obj, classinfo):\n try:\n return issubclass(obj, classinfo)\n exc...
[ "0.6861989", "0.6678009", "0.6629571", "0.6614257", "0.6606721", "0.65752107", "0.65565765", "0.6548872", "0.6548872", "0.6548872", "0.6548872", "0.6548872", "0.6548872", "0.6514387", "0.65030473", "0.6499084", "0.6499084", "0.6495338", "0.6488729", "0.6484178", "0.6481067", ...
0.8361728
0
Check whether `obj` is a method.
def is_method(obj: Any) -> bool: return inspect.ismethod(obj) or "Boost.Python.function" in str(type(obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ismethod(object):\r\n return isinstance(object, types.MethodType)", "def is_method_of(method, object):\n if not callable(method) or not hasattr(method, \"__name__\"):\n return False\n if inspect.ismethod(method):\n return method.__self__ is object\n for cls in inspect.getmro(object....
[ "0.8177807", "0.77033913", "0.7681355", "0.76295954", "0.7574309", "0.71349955", "0.6971231", "0.6931637", "0.68637705", "0.6751655", "0.6716016", "0.6662323", "0.665518", "0.6646023", "0.6576209", "0.6575024", "0.6565945", "0.6479175", "0.6429495", "0.6226134", "0.6117707", ...
0.8378316
0
Return list of valid member variables. Ignoring mangled (__) variables, types, methods, and Boost enums.
def get_member_variables( obj: Any, return_discarded: bool = False ) -> Union[List[str], Tuple[List[str], Dict[str, List[str]]]]: valid_member_variables = [] discarded_member_variables: Dict[str, List[str]] = { "mangled": [], "is_type": [], "invalid_attr": [], "is_method": []...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vars(cls):\n for key in dir(cls):\n if key.startswith('var_'):\n yield key[4:]", "def unusedVars(self):\n fullcode = self.code_cfg\n variables = set([x[1:] for x in codeconfig_getvars(fullcode)])\n exceptions = set(['complexity', 'code_cfg'])\n cls...
[ "0.65596557", "0.65094596", "0.64906734", "0.6424824", "0.6148797", "0.61362445", "0.59760153", "0.58430034", "0.5842859", "0.57547677", "0.5730297", "0.5725713", "0.56944275", "0.56628054", "0.56521", "0.5649057", "0.5615413", "0.56144106", "0.5612419", "0.5602482", "0.55804...
0.6909306
0
Cast `obj`, and any members/elements, to purepython classes. The function takes any object `obj` and tries to cast it to a pure python class. This is mainly relevant for IceCubespecific classes (I3) that cannot be cast trivially. For IceCubespecific classes, we check whether the object has any member, variables and if ...
def cast_object_to_pure_python(obj: Any) -> Any: logger = Logger() logger.debug(f"Value: {obj}") logger.debug(f"Type: {str(type(obj))}") if not is_icecube_class(obj): logger.debug("Found non-I3 class. Exiting.") if isinstance(obj, (list, tuple, set)): return [cast_object_to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_casting(obj: object, cls: type):\n orig_cls = obj.__class__\n obj.__class__ = cls\n yield\n obj.__class__ = orig_cls", "def ns_from_py(pyobj):\n\n if isinstance(pyobj, enum.Enum):\n pyobj = pyobj.value\n\n # Many Objective-C method calls here use the convert_result=False kwarg ...
[ "0.6468261", "0.6169947", "0.60216856", "0.5780408", "0.5687424", "0.5681913", "0.56698275", "0.5660798", "0.5552916", "0.5541389", "0.5449535", "0.5432965", "0.5367629", "0.5346508", "0.53237635", "0.530361", "0.52975327", "0.52757865", "0.5227139", "0.5226663", "0.51880336"...
0.7611115
0
Ensure values are <= max brightness and != stop byte
def _check_values(self, rgb_array): for i, value in enumerate(rgb_array): if value > self.brightness_limit: rgb_array[i] = self.brightness_limit if value == self.STOP_BYTE: rgb_array[i] -= 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_channel_value(value: int) -> None:\n if 0 <= value <= 255:\n pass\n else:\n raise ValueError(\"Color channel has to be in range [0; 255]\")", "def is_0to255(value):\n return 0 <= value <= 255", "def verify_brightness_value(brightness):\n\n check_value_is_number_type(brigh...
[ "0.6506269", "0.648789", "0.632641", "0.6291771", "0.6192554", "0.6170371", "0.6110706", "0.6030551", "0.5996378", "0.59669286", "0.5962", "0.59381783", "0.58866835", "0.5861975", "0.5832914", "0.5733476", "0.5728271", "0.5698746", "0.5698746", "0.5675874", "0.56753343", "0...
0.77700883
0
Install emacs with some features in python 2.7 environement
def install_p2k(): if 'pkgs' not in env: env.pkgs = [] pkgs = [ 'python2', 'git', 'mercurial', 'emacs', # For flymake 'xmlstarlet', #'csslint-git', ] require.arch.packages(pkgs) python_cmd = 'python2.7' virtualenv = '.virtualenvs/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_zxpy_repl() -> None:\n print(\"zxpy shell\")\n print(\"Python\", sys.version)\n print()\n\n install()", "def develop():\n# Install package in development mode\n sh('python setup.py develop')", "def open_in_emacs_command(event):\n c = event.get('c')\n if c:\n open_in_emac...
[ "0.594541", "0.58539075", "0.5628848", "0.5576539", "0.5572069", "0.5543689", "0.5543153", "0.54723585", "0.54654664", "0.54646444", "0.54574805", "0.54236794", "0.5378128", "0.5352251", "0.53416926", "0.53223884", "0.5298473", "0.5297451", "0.5256946", "0.5242978", "0.523045...
0.67693573
0
Create creates a set session
async def create( self, *, header: Optional[headers.RequestHeader] = None ) -> CreateResponse: request = CreateRequest() if header is not None: request.header = header return await self._unary_unary( "/atomix.set.SetService/Create", request, CreateResponse, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(data):\n \n return Setlist(\n list_id = data['id'],\n name = data['name'],\n items = data['num_sets'])", "def new_set(*, ctx: context.ContextLevel, **kwargs) -> irast.Set:\n ir_set = irast.Set(**kwargs)\n ctx.all_sets.append(ir_set)\n return ir_s...
[ "0.6151142", "0.6048097", "0.60076725", "0.5988856", "0.5988856", "0.5877816", "0.5837743", "0.5801947", "0.57588005", "0.572035", "0.57137334", "0.5670384", "0.56422436", "0.5623634", "0.5616179", "0.5612067", "0.5610329", "0.5587627", "0.5562947", "0.5547399", "0.550339", ...
0.62500304
0
Close closes a set
async def close( self, *, header: Optional[headers.RequestHeader] = None, delete: bool = False ) -> CloseResponse: request = CloseRequest() if header is not None: request.header = header request.delete = delete return await self._unary_unary( "/atomi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_changeset(self):\n pass", "def _close_result_set(self):\n if self._result_set:\n self._result_set.close(self.session)\n self._result_set = None", "def close_file(self, data_set):\n if hasattr(data_set, '_h5_base_group'):\n data_set._h5_base_group....
[ "0.6684206", "0.6438695", "0.6179789", "0.5959591", "0.5912371", "0.5891763", "0.5832663", "0.58226657", "0.58226657", "0.58226657", "0.58226657", "0.58226657", "0.58226657", "0.58226657", "0.58226657", "0.58226657", "0.58226657", "0.58129406", "0.58081174", "0.5796722", "0.5...
0.64467335
1
Loads 10 seconds of 8000Hz music ('dataset/wind_lq_predicted.wav'), applies algorithm on windows of size alg.N, and outputs the result in a .wav file.
def test_real_song(alg): alg.input_func = None alg.input_func_args = 'dataset/wind_lq.wav',True alg.predict_long_wav_data(fs=8000, outname='wind_lq_predicted.wav')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(_):\n\tlabel_wav()", "def load_train_dataset(data_dir, word_list, silence_percentage, noise_percentage):\n validation_percentage, testing_percentage = 0.1, 0.1\n temp_list = []\n\n #wav_lists = os.path.join(data_dir, *, '*.wav')\n for word_l in word_list:\n #wav_word_list = os.path.jo...
[ "0.5846201", "0.57938576", "0.57843184", "0.57702315", "0.56909996", "0.5670173", "0.5635622", "0.5609626", "0.558032", "0.5578267", "0.5574669", "0.55611974", "0.55452716", "0.5497656", "0.54688525", "0.5414804", "0.5396864", "0.5391886", "0.538346", "0.53793347", "0.5373648...
0.74534905
0
Ensure class methods' signatures.
def test_class_method() -> None: assert inspect.signature(lmp.tknzr._bpe.BPETknzr.add_CLI_args) == inspect.signature(BaseTknzr.add_CLI_args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_implemented_functions(_class):\n mandatory_functions_to_implement = [('generate', 2), ('__init__', 6)]\n implemented_class_function_names = get_implemented_class_functions(_class)\n for function in mandatory_functions_to_implement:\n function_name = function[0]\n number_function_ma...
[ "0.6865951", "0.6779388", "0.6498488", "0.6362184", "0.62972075", "0.62814236", "0.6257724", "0.62441605", "0.6198573", "0.61527693", "0.6070059", "0.60478127", "0.6041627", "0.6029048", "0.5988869", "0.59486306", "0.5920295", "0.5917137", "0.59127486", "0.587004", "0.5849536...
0.6849367
1
Instantiate a StartFunction task.
def __init__(self, func=None, **kwargs): self.func = func if func is not None else self.start_func_default super(StartFunction, self).__init__(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_start(self):\n def start(core, args):\n task = ' '.join(args.task) if args.task else ''\n return core.start(task=task)\n\n usage = 'stl start [task]'\n desc = (\n 'make a log that you are starting to work'\n )\n\n subp = self.subparsers....
[ "0.64261806", "0.6352809", "0.6259454", "0.61059666", "0.6070468", "0.6019398", "0.5951755", "0.593934", "0.5893391", "0.5785626", "0.57718456", "0.5657987", "0.56442446", "0.5641955", "0.5632375", "0.5630811", "0.56288636", "0.5609423", "0.56023276", "0.55829614", "0.5582961...
0.6456831
0
Instantiate a Function task.
def __init__(self, func, task_loader=None, **kwargs): self.func = func self.task_loader = task_loader super(Function, self).__init__(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_task():", "def from_function(\n cls,\n task: ty.Callable,\n cleanup: ty.Callable=None,\n provides=tuple(),\n depends_on=tuple(),\n submit_to='thread',\n parallel=True,\n changing_inputs=False):\n if not len(...
[ "0.7264041", "0.6980909", "0.68889225", "0.6819239", "0.6739775", "0.65774894", "0.65699", "0.6558215", "0.6550279", "0.6496677", "0.6468632", "0.64679205", "0.64679205", "0.6448362", "0.644499", "0.6404104", "0.64028794", "0.63484013", "0.63439476", "0.63439476", "0.63439476...
0.722987
1
Summary for every series
def base_summary(series: pd.Series) -> dict: summary = { "frequencies": series.value_counts().to_dict(), "n_records": series.shape[0], "memory_size": series.memory_usage(index=True, deep=True), "dtype": series.dtype, "types": series.map(lambda x: type(x).__name__).value_count...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _summary(self, name=None):\n if name is None:\n if len(self._tracker_dict.keys()) > 1:\n dataframes = []\n for (_name, tracker) in self._tracker_dict.items():\n summary_df = tracker.series.summary()\n summary_df = summary_df....
[ "0.7089863", "0.65536255", "0.653386", "0.6407142", "0.63080764", "0.62465453", "0.6217058", "0.6183639", "0.61406666", "0.60740024", "0.6058445", "0.6054211", "0.60406715", "0.6035013", "0.6030795", "0.60064787", "0.6001196", "0.5956691", "0.59167403", "0.5907618", "0.590478...
0.7123433
0
Creates a vector out of a string. Gets a string (e.g. Book), splits it into and returns a vector with all possible ngrams/features.
def create_vector(string): vec = {} words = string.split() for word in words: if len(word) <= NGRAM_SIZE: add(vec, word) else: for i in range(len(word) - NGRAM_SIZE + 1): add(vec, word[i : i + NGRAM_SIZE]) return vec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_terms_from_string(s):\n u = s\n return u.split()", "def ngramas(n, string):\n\n ngrams = []\n i = 0\n while i + n < len(string):\n ngrams.append(string[i:i + n])\n i += 1\n\n return ngrams", "def from_string(string):\n return Sentence(string.split(\" \"))", "de...
[ "0.6692081", "0.620363", "0.61938727", "0.6170458", "0.6045155", "0.59495336", "0.59380984", "0.592855", "0.587873", "0.5878487", "0.5867894", "0.5849799", "0.58483064", "0.5833884", "0.58311754", "0.58128583", "0.5803685", "0.57831234", "0.5774572", "0.57539713", "0.5753545"...
0.7425697
0
Calculates the minmax similarity of two vectors. Calculates minmax similarity of two vectors vec_x and vec_y.
def minmax(vec_x, vec_y): minsum = 0 maxsum = 0 for ngram in vec_x: if ngram in vec_y: # ngram is in both vectors minsum += min(vec_x[ngram], vec_y[ngram]) maxsum += max(vec_x[ngram], vec_y[ngram]) else: # ngram only in vec_x maxsu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_similarity(vector_x, vector_y):\n if(len(vector_x)!=len(vector_y)):\n raise Exception('Vectors must be the same dimensions')\n \n return 1-np.dot(vector_x,vector_y)/(np.linalg.norm(vector_x)*np.linalg.norm(vector_y))", "def cosine_similarity(vec_x, vec_y):\n sim_prod = 0.0\n ...
[ "0.62996674", "0.6249005", "0.6130107", "0.6097062", "0.6059761", "0.6027226", "0.59534824", "0.5932027", "0.59160405", "0.58726966", "0.58326", "0.5826938", "0.58192986", "0.579559", "0.5791049", "0.57742333", "0.5760231", "0.57585263", "0.57527345", "0.575017", "0.5737195",...
0.78629965
0
Returns a feature list of the vector from the string. Turns a given string into a ngram vector and returns its feature list.
def training(string): print("Training...") vec = create_vector(string) print("Selecting features...") feature_list = select_features(vec) print("Done!") return feature_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_vector(string):\n vec = {}\n words = string.split()\n\n for word in words:\n if len(word) <= NGRAM_SIZE:\n add(vec, word)\n else:\n for i in range(len(word) - NGRAM_SIZE + 1):\n add(vec, word[i : i + NGRAM_SIZE])\n\n return vec", "def crea...
[ "0.66118634", "0.64273095", "0.6327371", "0.6292743", "0.62504566", "0.6237537", "0.61925775", "0.61103535", "0.60202676", "0.6020088", "0.5987974", "0.5959671", "0.59375215", "0.59162277", "0.59138423", "0.59009033", "0.58965003", "0.5834525", "0.58342415", "0.5805564", "0.5...
0.6722822
0
Returns a random part of a string. Returns a random part of a string s that has a given length.
def get_random_string(string, length): words = string.split() random_part = random.randint(0, len(words) - length) return "".join(words[random_part : random_part + length])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_random_string(string_length=17):\n random = str(uuid.uuid4())\n random = random.upper() \n random = random.replace(\"-\",\"\")\n return random[0:string_length]", "def random_string(length=8, chars=string.ascii_letters + string.digits):\n return ''.join([chars[random.randint(0, len(chars) - ...
[ "0.72976446", "0.7289028", "0.72863644", "0.7257486", "0.7251793", "0.7228094", "0.7225105", "0.72134733", "0.72119886", "0.72024626", "0.72024626", "0.72007173", "0.71958107", "0.7194601", "0.7194079", "0.7183809", "0.7183112", "0.7173273", "0.7160337", "0.7153696", "0.71514...
0.7963441
0
Set the sky dip model configuration
def set_configuration(self, configuration): if not isinstance(configuration, Configuration): raise ValueError(f"Configuration must be {Configuration} " f"instance. Received {configuration}.") self.configuration = configuration if self.configuration.is_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_parameters(self, skydip):\n if self.configuration.is_configured('skydip.tsky'):\n self.initial_guess['tsky'] = self.configuration.get_float(\n 'skydip.tsky')\n elif skydip.tamb_weight > 0:\n temp = skydip.tamb\n if isinstance(temp, units.Quanti...
[ "0.6260431", "0.59479874", "0.59430236", "0.57023", "0.5684856", "0.5664265", "0.5639438", "0.5633307", "0.55982137", "0.55243534", "0.5451777", "0.5441184", "0.54367733", "0.5416396", "0.5416396", "0.5393091", "0.53578675", "0.53553176", "0.53494585", "0.5281941", "0.5273201...
0.63351405
0
Fit the skydip model.
def fit(self, skydip): parameter_order = ['tau', 'offset', 'kelvin', 'tsky'] self.parameters = {} self.errors = {} self.p_opt = None self.p_cov = None self.fitted_values = None self.data = None self.sigma = None self.elevation = None log.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skydip(scans):\n title = Path(scans[0]).name + \" \".join([Path(scan).name.split(\"_\")[4] for scan in scans[1:]])\n\n signal = []\n std = []\n elevation = []\n\n for scan in scans:\n kd = KissData(scan)\n kd.read_data(list_data=[\"A_masq\", \"I\", \"Q\", \"F_tone\", \"F_tl_Az\", \...
[ "0.71958387", "0.6706675", "0.66250366", "0.6449008", "0.62683755", "0.6221359", "0.61551917", "0.6120607", "0.6083158", "0.60547644", "0.60453737", "0.6025587", "0.60035104", "0.5981096", "0.5972988", "0.5968424", "0.5968424", "0.5968424", "0.59320873", "0.58962053", "0.5896...
0.7225869
0
Returns a fit to elevation with the model.
def fit_elevation(self, elevation): if self.p_opt is None: result = elevation * np.nan else: result = self.value_at(elevation, *self.p_opt) if isinstance(result, units.Quantity): result = result.value return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_sky(self):\n min_value = self.data.min()\n ring_model = models.Ring2D(\n min_value, self.x, self.y, self._box * 0.4, width=self._box * 0.4\n )\n ring_model.r_in.fixed = True\n ring_model.width.fixed = True\n ring_model.x_0.fixed = True\n ring_mode...
[ "0.6175527", "0.5854759", "0.57457453", "0.5709625", "0.5693753", "0.5398284", "0.53812927", "0.53534794", "0.53487504", "0.5308275", "0.52831", "0.52750176", "0.52045095", "0.520028", "0.5186781", "0.51401824", "0.51340437", "0.51340437", "0.5090348", "0.5071652", "0.5067156...
0.7041972
0
Return a string representation of a given parameter.
def get_parameter_string(self, parameter): if not self.has_converged or self.parameters is None: return None if parameter not in self.parameters: return None fmt = self.get_parameter_format(parameter) unit = self.get_parameter_unit(parameter) value = fmt ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n\n return \"<ExoParameter>: {0}\".format(self.__dict__)", "def __repr_parameter__(self, name: str, value: Any) -> str:\n return f\"{name}={value!r}\"", "def format_parameter(param, required):\n\n param_string = check_param(flatten_param(param))\n if not required:\n ...
[ "0.7343561", "0.71605086", "0.710844", "0.69979465", "0.69655436", "0.6828032", "0.67813796", "0.6732115", "0.67217475", "0.6646251", "0.66266364", "0.65682906", "0.656694", "0.6539286", "0.639672", "0.63439494", "0.6307336", "0.62920564", "0.628318", "0.6257743", "0.62439185...
0.7855388
0
Return the string format for a given parameter.
def get_parameter_format(cls, parameter_name): formats = { 'tau': '%.3f', 'tsky': '%.1f', 'kelvin': '%.3e' } return formats.get(parameter_name, '%.3e')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parameter_string(self, parameter):\n if not self.has_converged or self.parameters is None:\n return None\n if parameter not in self.parameters:\n return None\n\n fmt = self.get_parameter_format(parameter)\n unit = self.get_parameter_unit(parameter)\n ...
[ "0.7667087", "0.72878444", "0.71903205", "0.68664265", "0.68105346", "0.68105346", "0.68084127", "0.6786722", "0.6781522", "0.67550427", "0.6714451", "0.6662671", "0.6652037", "0.6647457", "0.6626901", "0.6590343", "0.6559082", "0.6547835", "0.6534224", "0.6534224", "0.645761...
0.74919534
1
Return the parameter unit for the given parameter.
def get_parameter_unit(self, parameter_name): parameter_units = { 'tsky': units.Unit("Kelvin"), 'kelvin': self.data_unit } return parameter_units.get(parameter_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"unit\")", "def get_unit(self):\n return self.unit", "def unit(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"unit\")", "def unit(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"un...
[ "0.73394704", "0.7300321", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", "0.7261834", ...
0.8258069
0
Return a string representation of the sky dip fit. Returns str
def __str__(self): if not self.has_converged or self.parameters is None: log.warning("The fit has not converged. Try again!") return '' result = [] for parameter in self.parameters.keys(): if parameter in self.fit_for: parameter_string = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n #Get an ordered list of the elements strings so it outputs always the same\n #string given a mass function.\n elements = []\n for element in self.focals:\n elements.append((element, str(element)))\n sortedList = sorted(elements, key=lambda x:x[1])\...
[ "0.63235986", "0.5925334", "0.5918602", "0.5917366", "0.59062576", "0.5836863", "0.58009154", "0.578009", "0.5776318", "0.57657", "0.5755946", "0.574386", "0.5697488", "0.569668", "0.5695591", "0.5693888", "0.56415474", "0.56415474", "0.5632635", "0.5627902", "0.5618648", "...
0.6171846
1
Calibrated linear classifier binary model. This model uses a piecewise linear calibration function on each of the real (as opposed to binary) inputs (parametrized) and then combines (sum up) the results. Optionally calibration can be made monotonic. It usually requires a preprocessing step on the data, to calculate the...
def calibrated_linear_classifier(feature_columns=None, model_dir=None, quantiles_dir=None, keypoints_initializers_fn=None, optimizer=None, config=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_calibrate_predict(clf, X_t, y_t, X_v, y_v, params, jobs):\n\n # Indicate the classifier and the training set size\n print(\"Training a {} with None...\".format(clf.__class__.__name__))\n\n # Train the classifier\n clf = train_classifier(clf, X_t, y_t, params, jobs)\n\n # # Calibrate classi...
[ "0.60893214", "0.60358334", "0.5759546", "0.5748178", "0.57063353", "0.56848466", "0.56386817", "0.5601485", "0.5578915", "0.5504322", "0.55038977", "0.549859", "0.54438186", "0.5441058", "0.5316333", "0.5284502", "0.52768564", "0.5275868", "0.52657294", "0.52634394", "0.5245...
0.6290439
0
Calibrated linear estimator (model) for regression. This model uses a piecewise linear calibration function on each of the inputs (parametrized) and then combine (sum up) the results. Optionally calibration can be made monotonic. It usually requires a preprocessing step on the data, to calculate the quantiles of each u...
def calibrated_linear_regressor(feature_columns=None, model_dir=None, quantiles_dir=None, keypoints_initializers_fn=None, optimizer=None, config=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calibrated_linear_classifier(feature_columns=None,\n model_dir=None,\n quantiles_dir=None,\n keypoints_initializers_fn=None,\n optimizer=None,\n config...
[ "0.6054098", "0.5928749", "0.5801186", "0.57329446", "0.57322824", "0.5710905", "0.57070893", "0.56966364", "0.56741047", "0.56055945", "0.55519617", "0.5540491", "0.5518398", "0.5488559", "0.54868513", "0.5474618", "0.54654014", "0.54624677", "0.54408914", "0.54407585", "0.5...
0.6264422
0
For a given WABBIT parameter file, check for the most common stupid errors
def check_parameters_for_stupid_errors( file ): import os # print('~~~~~~~~~~~~~~~~~~~~~ini-file~~~~~~~~~~~') # # read jobfile # with open(file) as f: # # loop over all lines # for line in f: # line = line.lstrip() # line = line.rstrip() # if len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkParamsError(self):\n # check if parameter combinations match with the simulation filename.\n for i, f in enumerate(self.yadeDataFiles):\n # get the file name fore the suffix\n f = f.split('.' + f.split('.')[-1])[0]\n # get parameters from the remaining string...
[ "0.6367045", "0.63627934", "0.626574", "0.6190518", "0.6190518", "0.61401314", "0.60877657", "0.607748", "0.6049413", "0.59709966", "0.59606194", "0.5958436", "0.5945568", "0.58771724", "0.5862091", "0.5859376", "0.5834433", "0.58315766", "0.5829629", "0.5814439", "0.5794336"...
0.73345405
0
check if a given parameter in the ini file exists or not. can be used to detect deprecated entries somebody removed
def exists_ini_parameter( inifile, section, keyword ): found_section = False found_parameter = False # read jobfile with open(inifile) as f: # loop over all lines for line in f: # once found, do not run to next section if found_section and line[0] == "[": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_config(cfg):", "def exists_ini_section( inifile, section ):\n found_section = False\n\n # read jobfile\n with open(inifile) as f:\n # loop over all lines\n for line in f:\n # until we find the section\n if \"[\"+section+\"]\" in line and line[0]!=\";\" and l...
[ "0.6333489", "0.63048834", "0.61332923", "0.60334665", "0.6019133", "0.59849584", "0.58812857", "0.5851556", "0.58060586", "0.57881004", "0.5765527", "0.5734839", "0.5717389", "0.56993365", "0.568473", "0.56755203", "0.56699747", "0.56562424", "0.56547135", "0.56511873", "0.5...
0.6938629
0
we look for the latest .h5 files to resume the simulation, and prepare the INI file accordingly. Some errors are caught.
def prepare_resuming_backup( inifile ): import numpy as np import os import glob import flusi_tools # does the ini file exist? if not os.path.isfile(inifile): raise ValueError("Inifile not found!") Tmax = get_ini_parameter(inifile, "Time", "time_max", float) dim = get_ini_para...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_phase(self):\r\n if not self.C.restart: # start preprocessing job from scratch\r\n if (\r\n os.path.exists(self.valid_h5_path)\r\n or os.path.exists(self.test_h5_path)\r\n or os.path.exists(self.train_h5_path)\r\n ):\r\n ...
[ "0.60261214", "0.5696248", "0.5661924", "0.5481591", "0.5385601", "0.5378313", "0.5364455", "0.5312231", "0.5307268", "0.52681684", "0.5235969", "0.5219296", "0.5212105", "0.5211143", "0.52081215", "0.51801795", "0.5176859", "0.5160141", "0.51429856", "0.5139128", "0.50798786...
0.57191813
1
Read a 2D/3D wabbit file and return a list of how many blocks are at the different levels
def block_level_distribution_file( file ): import h5py import numpy as np # open the h5 wabbit file fid = h5py.File(file,'r') # read treecode table b = fid['block_treecode'][:] treecode = np.array(b, dtype=float) # close file fid.close() # number of blocks Nb = treecode.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readGR3File(inputFilename):\n print 'Reading ' + inputFilename + ' ...'\n infile = open(inputFilename, 'r')\n description = infile.readline().strip() # remove leading/trailing whitespace\n tmpStr = infile.readline()\n nTriangles, nNodes = (int(s) for s in tmpStr.split())\n print ' nTriangle...
[ "0.62876856", "0.62518936", "0.60057634", "0.5994908", "0.5979423", "0.5979423", "0.59490186", "0.5920892", "0.58702004", "0.5859132", "0.5837403", "0.5836277", "0.5833768", "0.58279437", "0.5771492", "0.5762479", "0.57591116", "0.5756959", "0.5705301", "0.56720674", "0.56655...
0.707528
0
Read a wabbittype HDF5 of blockstructured data. Return time, x0, dx, box, data, treecode. Get number of blocks and blocksize as N, Bs = data.shape[0], data.shape[1]
def read_wabbit_hdf5(file, verbose=True, return_iteration=False): import h5py import numpy as np if verbose: print("~~~~~~~~~~~~~~~~~~~~~~~~~") print("Reading file %s" % (file) ) fid = h5py.File(file,'r') b = fid['coords_origin'][:] x0 = np.array(b, dtype=float) b = fid['c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_wabbit_hdf5( file, time, x0, dx, box, data, treecode, iteration = 0, dtype=np.float64 ):\n import h5py\n import numpy as np\n\n\n Level = np.size(treecode,1)\n if len(data.shape)==4:\n # 3d data\n Bs = np.zeros([3,1])\n N, Bs[0], Bs[1], Bs[2] = data.shape\n Bs = B...
[ "0.7095553", "0.684908", "0.67961204", "0.62631047", "0.608267", "0.6046284", "0.6046284", "0.5913353", "0.585708", "0.5756927", "0.57358474", "0.56931156", "0.5675092", "0.5658997", "0.55911225", "0.5576085", "0.5573528", "0.55517644", "0.55503565", "0.5536557", "0.5531724",...
0.74340147
0
Read a wabbittype HDF5 of blockstructured data. same as read_wabbit_hdf5, but reads ONLY the treecode array.
def read_treecode_hdf5(file): import h5py import numpy as np fid = h5py.File(file,'r') b = fid['block_treecode'][:] treecode = np.array(b, dtype=float) return treecode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_wabbit_hdf5(file, verbose=True, return_iteration=False):\n import h5py\n import numpy as np\n\n if verbose:\n print(\"~~~~~~~~~~~~~~~~~~~~~~~~~\")\n print(\"Reading file %s\" % (file) )\n\n fid = h5py.File(file,'r')\n b = fid['coords_origin'][:]\n x0 = np.array(b, dtype=flo...
[ "0.7511299", "0.68497235", "0.6839176", "0.6466713", "0.6055406", "0.6010037", "0.6009357", "0.5869854", "0.5803738", "0.57437724", "0.57119524", "0.5656739", "0.5625802", "0.5617597", "0.5598882", "0.55979973", "0.55816346", "0.5550571", "0.5539923", "0.5537304", "0.548983",...
0.7173856
1
Write data from wabbit to an HDF5 file
def write_wabbit_hdf5( file, time, x0, dx, box, data, treecode, iteration = 0, dtype=np.float64 ): import h5py import numpy as np Level = np.size(treecode,1) if len(data.shape)==4: # 3d data Bs = np.zeros([3,1]) N, Bs[0], Bs[1], Bs[2] = data.shape Bs = Bs[::-1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def write_hdf5(filename, data):\n \n if '.h5' in filename:\n fid = h5py.File(filename, 'w')\n else:\n filename = filename+'.h5'\n fid = h5py.File(filename, 'w')\n\n print('Writing %s...'%filename)\n\n write_hdf5_group(fid, data)\n\n fid....
[ "0.739396", "0.718801", "0.7148199", "0.69659054", "0.68264276", "0.6792738", "0.6753575", "0.66656506", "0.66584826", "0.6568733", "0.65683955", "0.6483694", "0.64607877", "0.63932073", "0.63770145", "0.632899", "0.63053787", "0.63048476", "0.63000256", "0.6252908", "0.62099...
0.7852353
0
Read all h5 files in directory dir. Return time, x0, dx, box, data, treecode. Use data["phi"][it] to reference quantity phi at iteration it
def read_wabbit_hdf5_dir(dir): import numpy as np import re import ntpath import os it=0 data={'time': [],'x0':[],'dx':[],'treecode':[]} # we loop over all files in the given directory for file in os.listdir(dir): # filter out the good ones (ending with .h5) if file.ends...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_h5_file_arvind_format(folder, filen):\n \n ### file path\n \n fpath = folder + filen + '.h5'\n assert os.path.exists(fpath), \"The out.h5 file does NOT exist for \" + fpath\n fl = h5py.File(fpath, 'r')\n \n ### cell information\n \n xu = np.array(fl['/positions/xu'], dtype=np...
[ "0.66390574", "0.65969133", "0.65183514", "0.64874375", "0.64845943", "0.6476374", "0.6446031", "0.6411749", "0.63776684", "0.63614887", "0.63193595", "0.62539995", "0.6228941", "0.6222934", "0.61189467", "0.61138064", "0.60822386", "0.6060295", "0.60524553", "0.60471475", "0...
0.7388911
0
This generic function adds the local convergence rate as nice labels between
def add_convergence_labels(dx, er): import numpy as np import matplotlib.pyplot as plt for i in range(len(dx)-1): x = 10**( 0.5 * ( np.log10(dx[i]) + np.log10(dx[i+1]) ) ) y = 10**( 0.5 * ( np.log10(er[i]) + np.log10(er[i+1]) ) ) order = "%2.1f" % ( convergence_order(dx[i:i+1+1],er[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _show_learning_rate():\n fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(6.4 * 2, 4.8))\n\n # Visualize c_prime\n c_prime_list = np.linspace(1, 100, num=11)\n x_label = f\"c'\"\n y_label = \"Minimum Clusters Size\"\n title = \"\"\n\n ax = axes[0]\n x_list = c_prime_list\n\n # MNI...
[ "0.5802661", "0.57484186", "0.5591566", "0.55610377", "0.554035", "0.5481976", "0.541913", "0.54128134", "0.5400878", "0.53928256", "0.52825266", "0.5259621", "0.5238246", "0.52341664", "0.52058315", "0.519785", "0.5196426", "0.5191651", "0.5189148", "0.51671124", "0.5163327"...
0.6630967
0
This is a small function that returns the convergence order, i.e. the least squares fit to the log of the two passed lists.
def convergence_order(N, err): import numpy as np if len(N) != len(err): raise ValueError('Convergence order args do not have same length') A = np.ones([len(err), 2]) B = np.ones([len(err), 1]) # ERR = A*N + B for i in range( len(N) ) : A[i,0] = np.log(N[i]) B[i] = np.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logfit(N, err):\n import numpy as np\n\n if len(N) != len(err):\n raise ValueError('Convergence order args do not have same length')\n\n A = np.ones([len(err), 2])\n B = np.ones([len(err), 1])\n # ERR = A*N + B\n for i in range( len(N) ) :\n A[i,0] = np.log10(N[i])\n B[i]...
[ "0.6337905", "0.62787294", "0.6042211", "0.5989017", "0.5960942", "0.5899967", "0.58939946", "0.58498496", "0.5838031", "0.5715212", "0.56407213", "0.56352633", "0.5627826", "0.56239766", "0.5622977", "0.55958897", "0.5592456", "0.55830264", "0.55826944", "0.55535156", "0.555...
0.67130005
0
This is a small function that returns the logfit, i.e. the least squares fit to the log of the two passed lists.
def logfit(N, err): import numpy as np if len(N) != len(err): raise ValueError('Convergence order args do not have same length') A = np.ones([len(err), 2]) B = np.ones([len(err), 1]) # ERR = A*N + B for i in range( len(N) ) : A[i,0] = np.log10(N[i]) B[i] = np.log10(err[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_exp_data(x_vals, y_vals):\n log_vals = []\n for y in y_vals:\n log_vals.append(math.log(y, 2)) #get log base 2\n fit = np.polyfit(x_vals, log_vals, 1)\n return fit, 2", "def logp(self, xs, ys, **kwargs):\n ind = np.isclose(self.predict(xs, **kwargs),ys)\n axis = tuple(ran...
[ "0.71505827", "0.64535785", "0.63110274", "0.62836516", "0.61950827", "0.613543", "0.6083297", "0.60600305", "0.6027912", "0.6003056", "0.5989711", "0.59861887", "0.59799457", "0.5965218", "0.59623635", "0.5953407", "0.5946081", "0.59381616", "0.59283286", "0.59197503", "0.59...
0.6784488
1
Read and plot a 2D wabbit file. Not suitable for 3D data, use Paraview for that.
def plot_wabbit_file( file, savepng=False, savepdf=False, cmap='rainbow', caxis=None, caxis_symmetric=False, title=True, mark_blocks=True, block_linewidth=1.0, gridonly=False, contour=False, ax=None, fig=None, ticks=True, colorbar=True, dpi=300, block_edge_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readpil3d(self):\r\n\r\n # Read the data in as an array.\r\n res = np.loadtxt(self.name, delimiter=' ')\r\n\r\n # Split into useful chunks\r\n self.pos = res[:, 0:3] # Grid point locations\r\n self.Pn = res[:, 3:4] # Normal pressure [Pa]\r\n self.flux = res[...
[ "0.6419704", "0.5728336", "0.57164586", "0.56596476", "0.558751", "0.5581649", "0.55814993", "0.55613047", "0.5553209", "0.5500591", "0.54784054", "0.5467062", "0.5463366", "0.54342484", "0.5429662", "0.53756815", "0.53702176", "0.536499", "0.53567004", "0.53496575", "0.53309...
0.6046627
1
compute error given two flusi fields
def flusi_error_vs_flusi(fname_flusi1, fname_flusi2, norm=2, dim=2): import numpy as np import insect_tools # read in flusi's reference solution time_ref, box_ref, origin_ref, data_ref = insect_tools.read_flusi_HDF5( fname_flusi1 ) time, box, origin, data_dense = insect_tools.read_flusi_HDF5( fnam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_compute(self):\n self.tt_error = np.linalg.norm(self.rel_error)\n if self.global_rank==0:print('Overall error is::',self.tt_error)\n return {'NMF': self.rel_error, 'tt': self.tt_error}", "def _compute_error(self,expected_out,actual_out,error_func):\n\n error = error_func(exp...
[ "0.6367832", "0.62551594", "0.61732644", "0.6122448", "0.60979503", "0.60338694", "0.60156256", "0.6001351", "0.59415543", "0.592916", "0.5922433", "0.59000087", "0.58998704", "0.5872513", "0.5853913", "0.5831379", "0.58297896", "0.5827409", "0.5809093", "0.57668793", "0.5764...
0.65988445
0
Convert a WABBIT grid to a full dense grid in a single matrix. We asssume here that interpolation has already been performed, i.e. all blocks are on the same (finest) level.
def to_dense_grid( fname_in, fname_out = None, dim=2 ): import numpy as np import insect_tools import matplotlib.pyplot as plt # read data time, x0, dx, box, data, treecode = read_wabbit_hdf5( fname_in ) # convert blocks to complete matrix field, box = dense_matrix( x0, dx, data, treecode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sparse_matrix(self, grid, format=None):\n S = self.centered_stencil()\n # print(\"grid :\")\n\n grid = tuple(grid)\n # print(grid)\n if not (np.asarray(S.shape) % 2 == 1).all():\n raise ValueError('all stencil dimensions must be odd')\n\n assert_condition...
[ "0.5821582", "0.5726809", "0.5702125", "0.5558751", "0.5553554", "0.5539239", "0.5486648", "0.5427895", "0.5423916", "0.537605", "0.53138", "0.53079635", "0.52916086", "0.52071506", "0.5201484", "0.5168702", "0.5151044", "0.51481164", "0.51444805", "0.51429015", "0.513387", ...
0.6513067
0
Compare two grids. The number returned is the % of blocks from treecode1 which have also been found in treecode2
def compare_two_grids( treecode1, treecode2 ): import numpy as np common_blocks = 0 for i in range(treecode1.shape[0]): # we look for this tree code in the second array code1 = treecode1[i,:] for j in range(treecode2.shape[0]): code2 = treecode2[j,:] if np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PDiffGrids(A, B):\n if (A.xllcorner,A.yllcorner) == (B.xllcorner,B.yllcorner) and (A.ncols,A.nrows)==(B.ncols,B.nrows):\n Bx = numpy.where(B.data != B.nodata, B.data, 1.0)\n Bx = numpy.where(B.data != 0., B.data, 1.0)\n C = 100. * (A.data-Bx)/Bx\n New = grid(C, A.xllcorner, A.yll...
[ "0.65731466", "0.63465333", "0.6300452", "0.6264339", "0.61934185", "0.61712897", "0.5996527", "0.5989321", "0.5979154", "0.5934525", "0.59334546", "0.59026194", "0.58587474", "0.58309686", "0.58261055", "0.5805267", "0.57949764", "0.5784748", "0.5769305", "0.5745499", "0.574...
0.83875257
0
On all blocks of the data array, replace any function values by the level of the block
def overwrite_block_data_with_level(treecode, data): if len(data.shape) == 4: N = treecode.shape[0] for i in range(N): level = treecode_level(treecode[i,:]) data[i,:,:,:] = float( level ) elif len(data.shape) == 3: N = treecode.shape[0] for i in range(N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_block(self, block_id, func=..., edges=..., inplace=...): # -> None:\n ...", "def postSI(self):\n # for cell in self.cells:\n # cell.resetTotOrdFlux()\n self.depth = 0", "def replace(arr, fixers, data_tag='mydata', logger=None):\n # if logger not provided, create def...
[ "0.5757027", "0.5234304", "0.5134023", "0.51197505", "0.5062385", "0.50325173", "0.50212735", "0.48631778", "0.4849501", "0.48456857", "0.47853938", "0.47664374", "0.4762566", "0.4750089", "0.47483295", "0.47385266", "0.47344804", "0.4733381", "0.4728765", "0.47240093", "0.47...
0.7074382
0
This routine performs a shell command on each .h5 file in a given directory!
def command_on_each_hdf5_file(directory, command): import re import os import glob if not os.path.exists(directory): err("The given directory does not exist!") files = glob.glob(directory+'/*.h5') files.sort() for file in files: c = command % file os.system(c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_h5(walk_dir):\n\n file_list = []\n for root, subdirs, files in os.walk(walk_dir):\n\n for filename in files:\n file_path = os.path.join(root, filename)\n if file_path[-2:] == 'h5':\n file_list.append(file_path)\n\n return file_list", "def h5ls(h5o, ma...
[ "0.69875836", "0.6177355", "0.59026027", "0.57904077", "0.5747277", "0.57445157", "0.5651457", "0.5643685", "0.56236434", "0.5591664", "0.55789", "0.555372", "0.5539781", "0.5523432", "0.5506336", "0.54694766", "0.54544675", "0.5440774", "0.5433494", "0.5421979", "0.54104507"...
0.8061157
0
Convert directory with flusi h5 files to wabbit h5 files
def flusi_to_wabbit_dir(dir_flusi, dir_wabbit , *args, **kwargs ): import re import os import glob if not os.path.exists(dir_wabbit): os.makedirs(dir_wabbit) if not os.path.exists(dir_flusi): err("The given directory does not exist!") files = glob.glob(dir_flusi+'/*.h5') fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def h5root():\n with h5py.File('dummy.nxs', mode='w', driver=\"core\", backing_store=False) as f:\n yield f", "def read_wabbit_hdf5_dir(dir):\n import numpy as np\n import re\n import ntpath\n import os\n\n it=0\n data={'time': [],'x0':[],'dx':[],'treecode':[]}\n # we loop over all...
[ "0.63210124", "0.62002695", "0.60205424", "0.59618264", "0.58658123", "0.58440155", "0.57978594", "0.57177514", "0.57131207", "0.56950307", "0.5659476", "0.5612546", "0.55923796", "0.5582833", "0.5499074", "0.5433757", "0.54336375", "0.54284495", "0.53850937", "0.5381837", "0...
0.74297935
0
Convert flusi data file to wabbit data file.
def flusi_to_wabbit(fname_flusi, fname_wabbit , level, dim=2, dtype=np.float64 ): import numpy as np import insect_tools import matplotlib.pyplot as plt # read in flusi's reference solution time, box, origin, data_flusi = insect_tools.read_flusi_HDF5( fname_flusi, dtype=dtype ) box = box[1:] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flusi_to_wabbit_dir(dir_flusi, dir_wabbit , *args, **kwargs ):\n import re\n import os\n import glob\n\n if not os.path.exists(dir_wabbit):\n os.makedirs(dir_wabbit)\n if not os.path.exists(dir_flusi):\n err(\"The given directory does not exist!\")\n\n files = glob.glob(dir_flus...
[ "0.6466376", "0.5578025", "0.5258005", "0.52233136", "0.5194225", "0.5156527", "0.51492476", "0.51063263", "0.50713205", "0.5061902", "0.50611764", "0.5058425", "0.5032972", "0.5028185", "0.50022244", "0.48981017", "0.4894581", "0.48687062", "0.48647705", "0.48561457", "0.484...
0.6721087
0
This function creates a _.h5 file with the wabbit block structure from a given dense data matrix. Therefore the dense data is divided into equal blocks, similar as sparse_to_dense option in wabbitpost.
def dense_to_wabbit_hdf5(ddata, name , Bs, box_size = None, time = 0, iteration = 0, dtype=np.float64): # concatenate filename in the same style as wabbit does fname = name + "_%12.12d" % int(time*1e6) + ".h5" Ndim = ddata.ndim Nsize = np.asarray(ddata.shape) level = 0 Bs = np.asarray(Bs)# make ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dense_grid( fname_in, fname_out = None, dim=2 ):\n import numpy as np\n import insect_tools\n import matplotlib.pyplot as plt\n\n # read data\n time, x0, dx, box, data, treecode = read_wabbit_hdf5( fname_in )\n\n # convert blocks to complete matrix\n field, box = dense_matrix( x0, dx, ...
[ "0.7129957", "0.7095275", "0.61546594", "0.59248036", "0.56526315", "0.5634567", "0.56303704", "0.5613793", "0.56120116", "0.5585933", "0.5540948", "0.5519374", "0.54959834", "0.5490673", "0.54355556", "0.5431243", "0.5422526", "0.54188895", "0.5410818", "0.5400482", "0.53950...
0.7183506
0
convert hash_str to hash_dec
def hash2dec(hash_str: str) -> int: length = len(hash_str) bases = [32 ** i for i in range(length)][::-1] dec = 0 for i, d in enumerate(hash_str): dec += ch2int[d] * bases[i] return dec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_string_to_int(\r\n k: bytes,\r\n e: str,\r\n) -> int:\r\n return int.from_bytes(hash_string(k, e), 'big')", "def strhash(s: str) -> int:\n h = hashlib.md5(s.encode('utf-8'))\n h = int(h.hexdigest(), base=16)\n return h", "def dec2hash(hash_dec: int, pre: int) -> str:\n bas...
[ "0.676085", "0.6701529", "0.6644186", "0.64678264", "0.64379567", "0.64147437", "0.6400152", "0.63800716", "0.6376264", "0.63746643", "0.63039637", "0.62607664", "0.62387604", "0.62307084", "0.62161714", "0.61618865", "0.61301386", "0.61214674", "0.6107932", "0.60902554", "0....
0.81465983
0
convert hash_dec to hash_str
def dec2hash(hash_dec: int, pre: int) -> str: bases = [32 ** i for i in range(pre)][::-1] hash_str = "" v = hash_dec for b in bases: a = v // b v = v % b hash_str += ch32[a] return hash_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_str(c, hash_length):\n if isinstance(c, float):\n if numpy.isnan(c):\n return c\n raise ValueError(f\"numpy.nan expected, not {c}\")\n m = hashlib.sha256()\n m.update(c.encode(\"utf-8\"))\n r = m.hexdigest()\n if len(r) >= hash_length:\n return r[:hash_length...
[ "0.67123157", "0.6692818", "0.66889405", "0.66310173", "0.6559617", "0.65580744", "0.6501489", "0.64891833", "0.64672464", "0.6397518", "0.6363674", "0.63632846", "0.6330039", "0.63063854", "0.6293308", "0.6279598", "0.627666", "0.6234947", "0.62323284", "0.62225", "0.6185577...
0.7153087
0
convert lat, lon coordinate to decimal geohash representation (pre=6)
def coords2geohash_dec(*, lat: float, lon: float, pre: int = 6) -> int: return hash2dec(encoder(lat, lon, pre))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode(geohash):\n lat_val, lng_val, lat_err, lng_err = _decode_val_err(geohash)\r\n precision = _get_precision(lng_err)\n lat_val = \"%.*f\" % (precision, lat_val)\r\n lng_val = \"%.*f\" % (precision, lng_val)\r\n return lat_val, lng_val", "def geohash_encode(latitude, longitude, precision=1...
[ "0.7197927", "0.7073706", "0.6947506", "0.68074983", "0.67318535", "0.66749907", "0.66701984", "0.65034956", "0.64117384", "0.6199895", "0.61259615", "0.59396446", "0.5933387", "0.59319395", "0.57969904", "0.5766618", "0.5754867", "0.5753793", "0.5708975", "0.56883526", "0.56...
0.7521665
0
convert decimal geohash to lat, lon coordinate (we require pre=6)
def geohash_dec2coords(*, geohash_dec: int, pre: int = 6) -> Tuple[float, float]: res = decoder(dec2hash(geohash_dec, pre=pre)) return round(sum(res[0]) / 2, max(3, pre - 3)), round( sum(res[1]) / 2, max(3, pre - 3) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode(geohash):\n lat_val, lng_val, lat_err, lng_err = _decode_val_err(geohash)\r\n precision = _get_precision(lng_err)\n lat_val = \"%.*f\" % (precision, lat_val)\r\n lng_val = \"%.*f\" % (precision, lng_val)\r\n return lat_val, lng_val", "def coords2geohash_dec(*, lat: float, lon: float, p...
[ "0.7526719", "0.7387216", "0.7375263", "0.63441426", "0.6267863", "0.624697", "0.6224477", "0.6146233", "0.6016872", "0.5977346", "0.592548", "0.5918737", "0.5868537", "0.5856564", "0.5801432", "0.5772634", "0.57722", "0.5735534", "0.57101923", "0.570122", "0.5676153", "0.5...
0.7478197
1
uploads file to Google Cloud storage
def _cloud_storage_upload(local_file, bucket, filename_on_bucket): client = storage.Client() bucket = client.get_bucket(bucket) blob = bucket.blob(filename_on_bucket) blob.upload_from_filename(local_file) print('uploaded ', bucket, filename_on_bucket)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_to_gcs():\n client = storage.Client(project=\"filmreccommendations\")\n bucket = client.get_bucket(\"filmreccommendations.appspot.com\")\n blob = bucket.blob(os.path.basename(PICKLE_FILENAME))\n blob.upload_from_filename(PICKLE_FILENAME)", "def gcloud_upload_file(file):\n if not file:\n...
[ "0.7862477", "0.7417298", "0.73990583", "0.7352191", "0.7321791", "0.7267003", "0.6985354", "0.69010127", "0.6875503", "0.68445647", "0.68404883", "0.6832378", "0.6829256", "0.67942363", "0.67374986", "0.67214787", "0.67042154", "0.66991466", "0.6689875", "0.6675743", "0.6637...
0.74267185
1
Lists all the catalystport bindings
def get_all_catalystport_bindings(): LOG.debug("get_all_catalystport_bindings() called") session = db.get_session() try: bindings = session.query (catalyst_models.CatalystPortBinding).all() return bindings except exc.NoResultFound: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bindings(self):\n return self.__bindings", "def list_ports(state):\n\tstate.report()", "def list_ports(self):\n return self.ironic_client.port.list()", "def port_list(self):\n return self._port_list", "def get_all_port(self, conf, dpid):\n\t\tpass", "def getBindings(self):\n r...
[ "0.6451805", "0.62612075", "0.58983856", "0.5897845", "0.579027", "0.5786138", "0.5704574", "0.56907016", "0.5677487", "0.56535304", "0.56521446", "0.56430465", "0.5607622", "0.56039107", "0.5600516", "0.55635554", "0.55596274", "0.5467314", "0.5458655", "0.5453633", "0.54411...
0.78534424
0
Adds a catalystport binding
def add_catalystport_binding(port_id, vlan_id): LOG.debug("add_catalystport_binding() called") session = db.get_session() binding = catalyst_models.CatalystPortBinding(port_id, vlan_id) session.add(binding) session.flush() return binding
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_binding(ctx, binding_name, pool_name, acl_name, nat_type, twice_nat_id):\n\n entryFound = False\n table = 'NAT_BINDINGS'\n key = binding_name\n dataKey1 = 'access_list'\n dataKey2 = 'nat_pool'\n dataKey3 = 'nat_type'\n dataKey4 = 'twice_nat_id'\n\n if acl_name is None:\n acl_...
[ "0.6066342", "0.6021122", "0.5959869", "0.5917959", "0.5857227", "0.5852962", "0.5653113", "0.56476676", "0.55153096", "0.5501996", "0.5498605", "0.5429331", "0.5401681", "0.53849334", "0.5362603", "0.53139096", "0.52629244", "0.5251845", "0.5244616", "0.5243897", "0.52343386...
0.7463989
0
Removes a catalystport binding
def remove_catalystport_binding(vlan_id): LOG.debug("remove_catalystport_binding() called") session = db.get_session() try: binding = (session.query(catalyst_models.CatalystPortBinding). filter_by(vlan_id=vlan_id).all()) for bind in binding: session.delete...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_binding(ctx, binding_name):\n\n entryFound = False\n table = 'NAT_BINDINGS'\n key = binding_name\n\n if len(binding_name) > 32:\n ctx.fail(\"Invalid binding name. Maximum allowed binding name is 32 characters !!\")\n\n config_db = ConfigDBConnector()\n config_db.connect()\n\n ...
[ "0.73616654", "0.6799897", "0.6344198", "0.6337611", "0.617905", "0.6130057", "0.61269933", "0.6104561", "0.5963844", "0.5883558", "0.58721596", "0.5811271", "0.5778574", "0.5777863", "0.57622343", "0.5755362", "0.5706742", "0.5679512", "0.5677332", "0.5649031", "0.5630688", ...
0.7389213
0
Test whether the numpy data type `dt` can be safely cast to an int.
def _safely_castable_to_int(dt): int_size = np.dtype(int).itemsize safe = (np.issubdtype(dt, np.signedinteger) and dt.itemsize <= int_size) or ( np.issubdtype(dt, np.unsignedinteger) and dt.itemsize < int_size ) return safe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_integer(x):\n return (not isinstance(x, (bool, np.bool))) and \\\n isinstance(x, (numbers.Integral, int, np.int, np.long, long)) # no long type in python 3", "def is_int(x):\n # From sktime: BSD 3-Clause\n # boolean are subclasses of integers in Python, so explicitly exclude them\n re...
[ "0.68389726", "0.67490387", "0.6626902", "0.6598004", "0.6508628", "0.64784265", "0.64210194", "0.6398246", "0.63903487", "0.6372374", "0.6356024", "0.6314418", "0.63074124", "0.6301813", "0.6293644", "0.62889963", "0.6231258", "0.62195265", "0.6181786", "0.6180847", "0.61740...
0.8405704
0
Starts a while loop that sends 'command' to tello every 5 second.
def _sendingCommand(self): while True: self.tello.send_command('command') time.sleep(5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Listen(self):\n while True:\n time.sleep(1)", "def run(self):\n while True:\n time.sleep(RTM_READ_DELAY)\n for event in self._slack_client.rtm_read():\n self.handle_event(event)", "def run():\n # 1 sec delay to allow DHT22 sensor to start as ...
[ "0.63576066", "0.6166633", "0.60652816", "0.60415244", "0.60114336", "0.59595996", "0.595747", "0.5923307", "0.5898725", "0.58431983", "0.58387035", "0.58356047", "0.5832241", "0.56968737", "0.5675272", "0.56747895", "0.56568396", "0.56439304", "0.562048", "0.56196946", "0.56...
0.7657067
0
Open the cmd window and initial all the button and text.
def openCmdWindow(self): panel = Toplevel(self.root) panel.wm_title('Command Panel') # create text input entry text0 = tki.Label(panel, text='This Controller map keyboard inputs to Tello control commands\n' 'Adjust the tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(self):\n self.state = True\n self.mainwindow.sendMessage('a')\n print(\"opening \" + self.name)", "def build_initial() :\r\n titleframe = T.Frame(ROOT)\r\n TITLE = T.Label(titleframe, text = \"Welcome to Microgp!\")\r\n var = T.StringVar()\r\n INSTRUCTIONS = T.Message(ti...
[ "0.61820495", "0.61781216", "0.6119948", "0.60934174", "0.60702914", "0.5959592", "0.5948371", "0.5943641", "0.593772", "0.5910269", "0.59019053", "0.5892788", "0.58925205", "0.5891495", "0.5889927", "0.58737874", "0.5858974", "0.5835644", "0.5834646", "0.58337766", "0.582894...
0.68487906
0
Open the flip window and initial all the button and text.
def openFlipWindow(self): panel = Toplevel(self.root) panel.wm_title('Gesture Recognition') self.btn_flipl = tki.Button( panel, text='Flip Left', relief='raised', command=self.telloFlip_l) self.btn_flipl.pack(side='bottom', fill='both', expand='ye...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_state():\n\tDmg.OpenWindow()", "def show(self):\r\n self.wf.Show()", "def show(self, window):\r\n\r\n return", "def finish_render():\n get_window().static_display = True\n get_window().flip_count = 0\n get_window().flip()", "def cb_main_window(self, event):\n self.m...
[ "0.6244811", "0.61130655", "0.60361177", "0.58716136", "0.5835317", "0.5802721", "0.58015156", "0.57977974", "0.57581085", "0.5736185", "0.5727664", "0.56942797", "0.5663911", "0.5637016", "0.5626047", "0.5598497", "0.55893236", "0.5587088", "0.55717754", "0.55463487", "0.553...
0.8400445
0