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
r""" einsum(subscripts, operands) Evaluates the Einstein summation convention on the operands. This implementation exactly mirrors that of ``numpy.einsum`` and supports backpropagation through all variety of tensorproducts, sums, traces, and views that it can perform. The following docstring was adapted from the docume...
def einsum(*operands, optimize=False, constant=False): # TODO: normalize error handling for invalid inputs operands = list(operands) if isinstance(operands[0], str): # operands form: "ijk, ijk", x, y variables = operands[1:] if any(isinstance(i, Tensor) for i in operands): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def einsum(subscripts, *operands):\n raise NotImplementedError", "def einsum(ops, *args):\n\n if len(args) != 2:\n raise ValueError(\"Currently only two operands are supported\")\n\n inops, outops = ops.split('->')\n inops = inops.split(',')\n\n # All indices that are in input AND in ou...
[ "0.8047489", "0.7242151", "0.7152754", "0.63151926", "0.61698246", "0.6114144", "0.6113121", "0.6074974", "0.6068289", "0.59489155", "0.5899865", "0.5805374", "0.5726775", "0.5560793", "0.5545564", "0.5527907", "0.5518557", "0.54571724", "0.5398596", "0.537284", "0.5371635", ...
0.7332211
1
Return a np.array that encodes the optimal order of multiplications. The optimal order array is then used by `_multi_matmul()` to do the multiplication. The implementation CLOSELY follows Cormen, "Introduction to Algorithms", Chapter 15.2, p. 370378. Note that Cormen uses 1based indices. cost[i, j] = min([ cost[prefix]...
def _multi_matmul_chain_order(arrays): n = len(arrays) # p stores the dimensions of the matrices # Example for p: A_{10x100}, B_{100x5}, C_{5x50} --> p = [10, 100, 5, 50] # Using -2 to generalize for shapes that are more than 2 dimmensions p = [a.shape[-2] for a in arrays] + [arrays[-1].shape[-1]] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cost(self) -> numpy.ndarray:\n def product(*args, repeat=1):\n # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy\n # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111\n pools = [list(pool) for pool in args] * repeat\n result = [[]]\n ...
[ "0.6332576", "0.58288455", "0.5734787", "0.53652775", "0.5258656", "0.52273583", "0.5158673", "0.5094171", "0.50633603", "0.5053747", "0.50302494", "0.5024", "0.49989206", "0.4962712", "0.49599314", "0.49564028", "0.4950593", "0.49419805", "0.49388745", "0.4921839", "0.492147...
0.6240288
1
Prepare a wrapper script for executable including as required environment, proxy, sandbox,... A temporary directory is created and removed at the end where sandbox is unpacked and executable called In executable, arguments and execDir environmental variables can be used
def getExecutableScript( executable, arguments=[], proxy=None, sandboxDict = {}, environDict={}, execDir='' ): if type( arguments) in types.StringTypes: arguments = arguments.split(' ') compressedAndEncodedFiles = {} if proxy: compressedAndEncodedFiles['.proxy'] = base64.encodestring( bz2.compress( proxy....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_local_shell_script(arg_list, shell_env, working_dir, deploy_environment, **kwargs):\n script_file = tempfile.NamedTemporaryFile(delete=False)\n logger.debug(\"script file name: \" + script_file.name)\n\n #TODO: Make this less hard-coded\n commander_bin_path = os.path.join(LOCAL_DD_BINS_PA...
[ "0.62365025", "0.5803571", "0.5701789", "0.5668321", "0.5615997", "0.56158394", "0.55758077", "0.55747175", "0.5572322", "0.55430245", "0.55383515", "0.55258495", "0.55219984", "0.55011", "0.5492433", "0.54498655", "0.54323846", "0.5424304", "0.54076076", "0.5370583", "0.5361...
0.7469305
0
Create a self extracting archive bundling together an executable script and a proxy
def bundleProxy( executableFile, proxy ): compressedAndEncodedProxy = base64.encodestring( bz2.compress( proxy.dumpAllToString()['Value'] ) ).replace( '\n', '' ) compressedAndEncodedExecutable = base64.encodestring( bz2.compress( open( executableFile, "rb" ).read(), 9 ) ).replace( '\n', '' ) bundle = """#!/us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getExecutableScript( executable, arguments=[], proxy=None, sandboxDict = {}, environDict={}, execDir='' ):\n if type( arguments) in types.StringTypes:\n arguments = arguments.split(' ')\n compressedAndEncodedFiles = {}\n if proxy:\n compressedAndEncodedFiles['.proxy'] = base64.encodestring( bz2.compre...
[ "0.64918727", "0.577996", "0.5766763", "0.5732159", "0.5664186", "0.56264096", "0.55321336", "0.54871804", "0.5453495", "0.5452204", "0.54016155", "0.53714234", "0.5365304", "0.5356464", "0.5349629", "0.53425586", "0.53410804", "0.53264445", "0.532383", "0.5323592", "0.529593...
0.7249348
0
Write script into a temporary unique file under provided writeDir
def writeScript( script, writeDir=None ): fd, name = tempfile.mkstemp( suffix = '_pilotWrapper.py', prefix = 'DIRAC_', dir=writeDir ) pilotWrapper = os.fdopen(fd, 'w') pilotWrapper.write( script ) pilotWrapper.close() return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeScript(self, content):\n path = self.mktemp()\n with open(path, \"wb\") as f:\n f.write(content.encode(\"ascii\"))\n return self.FakeFilePath(path)", "def writeToFile(self, basedir, write_code=0):", "def _write_test_script(self, code, filename='mytestscript.py'):\n ...
[ "0.67781335", "0.66012955", "0.65073466", "0.6407213", "0.6256304", "0.6105215", "0.6081204", "0.6081174", "0.6069676", "0.59164095", "0.59164095", "0.59063745", "0.5889878", "0.58634055", "0.5811188", "0.5810063", "0.5809809", "0.5808512", "0.57509655", "0.57483935", "0.5738...
0.7689995
0
Add a ``meshDensity`` field into a spherical MPAS mesh. The mesh density is
def inject_spherical_meshDensity(cellWidth, lon, lat, mesh_filename): minCellWidth = cellWidth.min() meshDensityVsXY = (minCellWidth / cellWidth)**4 print(' minimum cell width in grid definition: {0:.0f} km'.format( minCellWidth)) print(' maximum cell width in grid definition: {0:.0f} km'.for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_planar_meshDensity(cellWidth, x, y, mesh_filename):\n minCellWidth = cellWidth.min()\n meshDensityVsXY = (minCellWidth / cellWidth)**4\n print(' minimum cell width in grid definition: {0:.0f} km'.format(minCellWidth))\n print(' maximum cell width in grid definition: {0:.0f} km'.format(cell...
[ "0.6255262", "0.5389025", "0.5353687", "0.5337097", "0.5220311", "0.5205907", "0.5183979", "0.5168345", "0.5165704", "0.5144504", "0.5129817", "0.50951695", "0.5082213", "0.5032988", "0.5024678", "0.4994296", "0.49550906", "0.4927413", "0.4902144", "0.48918068", "0.48687795",...
0.6803281
0
Add a ``meshDensity`` field into a planar MPAS mesh. The mesh density is
def inject_planar_meshDensity(cellWidth, x, y, mesh_filename): minCellWidth = cellWidth.min() meshDensityVsXY = (minCellWidth / cellWidth)**4 print(' minimum cell width in grid definition: {0:.0f} km'.format(minCellWidth)) print(' maximum cell width in grid definition: {0:.0f} km'.format(cellWidth.max...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_spherical_meshDensity(cellWidth, lon, lat, mesh_filename):\n\n minCellWidth = cellWidth.min()\n meshDensityVsXY = (minCellWidth / cellWidth)**4\n print(' minimum cell width in grid definition: {0:.0f} km'.format(\n minCellWidth))\n print(' maximum cell width in grid definition: {0:....
[ "0.6207636", "0.5802445", "0.5500732", "0.5258404", "0.52491003", "0.51573426", "0.5149103", "0.5126807", "0.5113957", "0.5108011", "0.5081855", "0.5055205", "0.502482", "0.50101423", "0.50040215", "0.500278", "0.4998487", "0.49955565", "0.49754664", "0.49744093", "0.48911595...
0.6627931
0
Function to initialize Sentry
def initialize_sentry(environment): if "SENTRY_DSN" in os.environ.keys(): sentry_sdk.init( dsn=os.environ.get("SENTRY_DSN"), environment=environment, integrations=[DjangoIntegration()] ) return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_sentry():\n sentry = Sentry(dsn=config.secrets.server('sentry_server_dsn'))\n sentry.init_app(app)\n return sentry", "def init() -> None:\n # Setup elib_config\n elib_config.ELIBConfig.setup(\n app_version=__version__,\n app_name='ESST',\n config_file_path='esst.toml'...
[ "0.78315777", "0.7149965", "0.710248", "0.7008173", "0.69983727", "0.63846207", "0.6302857", "0.61942387", "0.60620224", "0.6033692", "0.60148823", "0.5795357", "0.5795357", "0.57491374", "0.5670272", "0.56558675", "0.56230986", "0.5617356", "0.56154907", "0.5534803", "0.5515...
0.74507827
1
This determines the merge order
def merge(): #Status: WIP pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MergeLogic(self) -> str:", "def _merge(self):\n raise NotImplementedError", "def test_two_ordered():\n run_mergesort([1, 2], [1, 2])", "def on_merge(self, to_be_merged, merge_result, context):\n pass", "def get_merge_sequence(self):\n return self.merge_sequence", "def is_merged(se...
[ "0.69793624", "0.6375147", "0.5961325", "0.5882218", "0.5839865", "0.5720159", "0.5710173", "0.5695595", "0.56796813", "0.567619", "0.5671704", "0.5640544", "0.5591835", "0.55816936", "0.5576377", "0.55395395", "0.55362004", "0.55304503", "0.55234206", "0.55118245", "0.551122...
0.68436176
1
use to change the networks group it can by anything between 0x01 0xEF
def setNetGroup(addr): #status: Done, not tested pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ipam_vlan_groups_update(self):\n pass", "def test_update_port_group(self):\n pass", "def set_group(self, address, group):\n self.groups[address] = group", "def test_patch_port_group(self):\n pass", "def set_groupname(diagram, p, g):\n if diagram.startswith('C2'):\n ...
[ "0.57677805", "0.5639445", "0.56374234", "0.5602725", "0.548471", "0.5479683", "0.5457365", "0.54199606", "0.54149854", "0.5407051", "0.53807145", "0.53760237", "0.53623086", "0.53456455", "0.53274316", "0.5314117", "0.5301763", "0.5292072", "0.52674496", "0.5256307", "0.5240...
0.76038957
0
Accept only tickets with owner and resources fields
def validate(self, ticket): debug(self, "Called validate(%s)..." % ticket) if ticket is not None and isinstance(ticket, AgiloTicket) and \ Key.OWNER in ticket.fields_for_type and \ Key.RESOURCES in ticket.fields_for_type: owner = ticket[Key.OWNER] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, ticket):\n debug(self, \"Called validate(%s)...\" % ticket)\n if ticket is not None and isinstance(ticket, AgiloTicket) and \\\n ticket.is_writeable_field(Key.REMAINING_TIME) and \\\n ticket[Key.STATUS] == Status.ACCEPTED and \\\n len(ti...
[ "0.6037742", "0.59489167", "0.5743269", "0.5716779", "0.56177723", "0.52751845", "0.5262805", "0.5198149", "0.5196399", "0.5172493", "0.5157789", "0.51400733", "0.510725", "0.5104805", "0.5089132", "0.50819653", "0.505614", "0.5042159", "0.5028506", "0.5016411", "0.50083715",...
0.70165884
0
Validate the ticket against the defined rules
def validate(self, ticket): debug(self, "Called validate(%s)..." % ticket) if ticket is not None and isinstance(ticket, AgiloTicket) and \ Key.REMAINING_TIME in ticket.fields_for_type: sprint_name = ticket[Key.SPRINT] if sprint_name not in (None, ''):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, ticket):\n debug(self, \"Called validate(%s)...\" % ticket)\n if ticket is not None and isinstance(ticket, AgiloTicket) and \\\n ticket.is_writeable_field(Key.REMAINING_TIME):\n \n remaining_time = self.parse_remaining_time(ticket)\n ...
[ "0.7121333", "0.69162714", "0.6892796", "0.68606627", "0.6850321", "0.683399", "0.6795548", "0.67947423", "0.6785463", "0.6763113", "0.67308116", "0.67259127", "0.6641505", "0.6573511", "0.6535643", "0.64295244", "0.6426748", "0.6384699", "0.6375668", "0.6317942", "0.63037723...
0.75969833
0
Accepts only tickets with remaining_time field
def validate(self, ticket): debug(self, "Called validate(%s)..." % ticket) if ticket is not None and isinstance(ticket, AgiloTicket) and \ ticket.is_writeable_field(Key.REMAINING_TIME): remaining_time = self.parse_remaining_time(ticket) if (not self.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, ticket):\n debug(self, \"Called validate(%s)...\" % ticket)\n if ticket is not None and isinstance(ticket, AgiloTicket) and \\\n ticket.is_writeable_field(Key.REMAINING_TIME):\n remaining_time = ticket[Key.REMAINING_TIME] or ''\n match = self.ex...
[ "0.62892735", "0.59172094", "0.5889611", "0.5771665", "0.5746504", "0.57293135", "0.57168686", "0.5565989", "0.5542619", "0.54507524", "0.5418683", "0.5412213", "0.5389857", "0.5378949", "0.53786576", "0.53773236", "0.53708684", "0.5360094", "0.5325163", "0.53125954", "0.5304...
0.6272372
1
Accept only tickets with remaining time field
def validate(self, ticket): debug(self, "Called validate(%s)..." % ticket) if ticket is not None and isinstance(ticket, AgiloTicket) and \ ticket.is_writeable_field(Key.REMAINING_TIME): remaining_time = ticket[Key.REMAINING_TIME] or '' match = self.extract_numbers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, ticket):\n debug(self, \"Called validate(%s)...\" % ticket)\n if ticket is not None and isinstance(ticket, AgiloTicket) and \\\n ticket.is_writeable_field(Key.REMAINING_TIME):\n \n remaining_time = self.parse_remaining_time(ticket)\n ...
[ "0.62235576", "0.5930954", "0.5924396", "0.5728849", "0.5681178", "0.5598768", "0.55793047", "0.55727834", "0.5567891", "0.5556556", "0.55286473", "0.5485982", "0.54775614", "0.54507387", "0.5408299", "0.53727615", "0.5359535", "0.5350708", "0.5334622", "0.5323026", "0.532276...
0.6171973
1
Accept tickets which have story as parents and have remaninig time
def validate(self, ticket): debug(self, "Called validate(%s)..." % ticket) if ticket is not None and isinstance(ticket, AgiloTicket) and \ ticket.is_writeable_field(Key.REMAINING_TIME) and \ ticket[Key.STATUS] == Status.ACCEPTED and \ len(ticket.get_incomi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, ticket):\n debug(self, \"Called validate(%s)...\" % ticket)\n if ticket is not None and isinstance(ticket, AgiloTicket) and \\\n Key.REMAINING_TIME in ticket.fields_for_type:\n \n sprint_name = ticket[Key.SPRINT]\n if sprint_name not ...
[ "0.55081975", "0.5396109", "0.53002375", "0.5185368", "0.5136249", "0.4999718", "0.49846944", "0.4942345", "0.49404863", "0.4934086", "0.49325326", "0.49133107", "0.48925877", "0.4815072", "0.4796127", "0.47953743", "0.47921637", "0.47720098", "0.47668797", "0.47517326", "0.4...
0.6494623
0
Given the two soup objects, constructs the trees, then returns a similarity % as a fraction of shared paths in both trees.
def compare_trees(first_soup: HTMLStrip, second_soup: HTMLStrip) -> float: first_tree = Tree.from_soup_object(first_soup.file_name, first_soup.original_soup) second_tree = Tree.from_soup_object(second_soup.file_name, second_soup.original_soup) common_paths_size: int = first_tree.num_of_common_paths(second_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substructure_sim_exact(subtrees_1, subtrees_2):\n assert(len(subtrees_1) == len(subtrees_2))\n n = len(subtrees_1)\n f1 = np.zeros(n)\n for i in range(n):\n f1[i] = subtrees_1[i] == subtrees_2[i] # calculate the number of matching pairs\n\n return float(np.count_no...
[ "0.66590446", "0.6644326", "0.650429", "0.64014494", "0.62307227", "0.62196964", "0.6145667", "0.6128364", "0.6120113", "0.60842484", "0.60697687", "0.6064608", "0.5990783", "0.5938749", "0.58866894", "0.58763576", "0.5856706", "0.58279485", "0.5817448", "0.58054096", "0.5756...
0.8511093
0
Add columns from a source. SOURCE is any object supporting the DataTableBase interface. The values from the source are inserted into the current datatable.
def add_cols(self, source) : cols = source.get_cols() types = source.get_types() new_cols = [] new_types = [] for i in range(len(cols)) : if cols[i] not in self.cols : new_cols.append(cols[i]) new_types.append(types[i]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_columns(source):\n return _get_tuple(source)", "def init_sources(self):\n\n columns = ['some', 'column', 'headers']\n self.columns = columns\n\n self.data_source = ColumnDataSource(data=dict(zip(columns, []*len(columns))))", "def add_column_into_source(self, tap_type, table...
[ "0.5886388", "0.5737543", "0.56411767", "0.56024194", "0.5431844", "0.5185482", "0.5174467", "0.51542056", "0.5090378", "0.50158465", "0.4980832", "0.4965107", "0.49250972", "0.4916635", "0.49140692", "0.4913746", "0.4887684", "0.4868349", "0.48492506", "0.47867334", "0.47823...
0.75367403
0
Bulk addition of rows to the current data store.
def add_rows(self, rows) : converted = [self._convert_row(row) for row in rows] self._bulk_add_rows(converted) self.version += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, batch_size=10000):\n if self.N <= batch_size:\n self.index.add(self.database)\n else:\n [self.index.add(self.database[i:i + batch_size])\n for i in tqdm(range(0, len(self.database), batch_size),\n desc='[index] add')]", "def ...
[ "0.6800859", "0.67184347", "0.66490245", "0.6497402", "0.6457419", "0.6363493", "0.63525057", "0.63324183", "0.62612504", "0.6115649", "0.6114725", "0.6071344", "0.6056107", "0.60227334", "0.6014365", "0.59977376", "0.5985", "0.5969385", "0.5962843", "0.5947866", "0.5943048",...
0.69902265
0
Get all values for a column.
def get_values(self, col) : if col not in self.cols : raise Exception('Column %s not in data' % col) select_sql = 'SELECT "%s" FROM "%s" ORDER BY __ROWID ASC' % (col, self.name) cur = self.con.cursor() cur.execute(select_sql) vs = cur.fetchall() return [v[0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_column_values(self, col: str) -> ndarray:\n dtype, loc = self._get_col_dtype_loc(col) # type: str, int\n return self._data[dtype][:, loc]", "def getColVals(self, col=None, include_nones=None):\n if col is None or col < 1 or col > self.nCol:\n raise SelectError(f\"bad col...
[ "0.7334679", "0.7305222", "0.7281065", "0.72333074", "0.71866804", "0.7137106", "0.7075483", "0.70516676", "0.6973242", "0.6973242", "0.69352984", "0.6925997", "0.68097365", "0.6736817", "0.67097217", "0.66028225", "0.6600815", "0.65863425", "0.65640897", "0.6531349", "0.6408...
0.8198163
0
Group rows by keys and run aggregations on the result sets.
def group_by(self, name, keys, *aggregators) : ct = [(k.get_name(), k.get_type()) for k in keys] ct.extend([(a.get_name(), a.get_type()) for a in aggregators]) def key_func(row) : r = row.as_dict() key = tuple([k(r) for k in keys]) return key ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregated_records(all_records, key_fields=KEY_FIELDS):\n flow_table = defaultdict(_FlowStats)\n for flow_record in all_records:\n key = tuple(getattr(flow_record, attr) for attr in key_fields)\n if any(x is None for x in key):\n continue\n flow_table[key].update(flow_reco...
[ "0.6727804", "0.6534261", "0.6243136", "0.61962014", "0.61670434", "0.6080323", "0.59835595", "0.5978169", "0.5965234", "0.5922633", "0.59160596", "0.59066767", "0.58740807", "0.577791", "0.57384926", "0.5633788", "0.56305957", "0.56286687", "0.5621585", "0.55719036", "0.5568...
0.73832095
0
Check if the register is a single scalar register
def is_single_scalar_reg(register): if register in [ProcessorRegister.single_scalar_0, ProcessorRegister.single_scalar_1]: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_double_scalar_reg(register):\n if register in [ProcessorRegister.double_scalar_0,\n ProcessorRegister.double_scalar_1]:\n return True\n else:\n return False", "def is_scalar(x):\n return x.ndim == 0", "def is_scalar(self):", "def _is_scalar(shape):\n return...
[ "0.73714584", "0.73224545", "0.73195636", "0.73158556", "0.725745", "0.71078616", "0.7105153", "0.70777756", "0.70706964", "0.67859447", "0.66995853", "0.6691538", "0.66578716", "0.6628365", "0.658303", "0.6576255", "0.65515006", "0.65294164", "0.65118945", "0.6501335", "0.64...
0.8844347
0
Check if the register is a double scalar register
def is_double_scalar_reg(register): if register in [ProcessorRegister.double_scalar_0, ProcessorRegister.double_scalar_1]: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_single_scalar_reg(register):\n if register in [ProcessorRegister.single_scalar_0,\n ProcessorRegister.single_scalar_1]:\n return True\n else:\n return False", "def _is_double(arr):\n\n # Figure out which dtype for data\n if arr.dtype == np.float32:\n ret...
[ "0.71812314", "0.6803923", "0.6488886", "0.6485871", "0.6484429", "0.6457998", "0.6375544", "0.6313629", "0.63097554", "0.6269042", "0.60941887", "0.60719603", "0.6063898", "0.605297", "0.5937596", "0.59306127", "0.58607227", "0.58412564", "0.5760337", "0.5674177", "0.5632394...
0.8824392
0
Copy the value to a register.
def copy_value_to_reg(self, imm_value, destination): value = bytearray() if is_single_scalar_reg(destination): # mov the single scalar to eax value += bytearray([0xb8]) packed = struct.pack("f", imm_value) value += bytearray(packed) # movd eax ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_reg_to_val(self):\n register = (self.opcode & 0x0F00) >> 8\n value = self.opcode & 0x00FF\n self.registers[register] = value\n logger.info(\"Set register V{} to {}\".format(register, value))", "def copy_reg_value_to_reg(reg_to, reg_from):\n assembler_generator.add_asm_one_r...
[ "0.7018513", "0.6931211", "0.67756915", "0.66774344", "0.65979373", "0.6564151", "0.65439546", "0.6416204", "0.63776696", "0.6352915", "0.63355935", "0.630146", "0.6149315", "0.6148996", "0.5979759", "0.597642", "0.5951145", "0.5872855", "0.5795711", "0.578806", "0.57697916",...
0.733808
0
Copy the contents of the stack to the register
def copy_stack_to_reg(self, stack_offset, register): value = bytearray() if is_single_scalar_reg(register): value.extend([0xF3, 0x0F, 0x10]) # movss elif is_double_scalar_reg(register): value.extend([0xF2, 0x0F, 0x10]) # movsd else: value.append(0x8b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_reg_to_stack(self, stack_offset, register):\n value = bytearray()\n if is_single_scalar_reg(register):\n value.extend([0xF3, 0x0F, 0x11]) # movss\n elif is_double_scalar_reg(register):\n value.extend([0xF2, 0x0F, 0x11]) # movsd\n else:\n value...
[ "0.7748646", "0.6577543", "0.65748715", "0.6447559", "0.6304862", "0.6295246", "0.6287437", "0.6286772", "0.6275601", "0.59576297", "0.59378946", "0.5866902", "0.5784351", "0.56626123", "0.56469893", "0.56143683", "0.56070364", "0.5536163", "0.54922116", "0.54764456", "0.5418...
0.7878859
0
Copy the contents of the register to the stack
def copy_reg_to_stack(self, stack_offset, register): value = bytearray() if is_single_scalar_reg(register): value.extend([0xF3, 0x0F, 0x11]) # movss elif is_double_scalar_reg(register): value.extend([0xF2, 0x0F, 0x11]) # movsd else: value.append(0x89...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_stack_to_reg(self, stack_offset, register):\n value = bytearray()\n if is_single_scalar_reg(register):\n value.extend([0xF3, 0x0F, 0x10]) # movss\n elif is_double_scalar_reg(register):\n value.extend([0xF2, 0x0F, 0x10]) # movsd\n else:\n value...
[ "0.7600056", "0.6819244", "0.67555225", "0.65509045", "0.6505106", "0.6460816", "0.63151485", "0.6158361", "0.60928094", "0.5828619", "0.5786608", "0.5688019", "0.5656908", "0.56331605", "0.5570781", "0.5527366", "0.5483633", "0.5469795", "0.54677147", "0.54260415", "0.539760...
0.76553535
0
Divide the value of the source by the destination. Store the result in the dividend register.
def div(self, source, destination): value = bytearray() dividend = destination divider = source if is_single_scalar_reg(divider): value.extend([0xF3, 0x0F, 0x5E]) # divss mod = 0b11 rm = get_register_encoding(divider) reg = get_register_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_divide(c, dst, src, result_in8, result_in16):\n # We're likely going to need to save some temporary variables\n # No 'push' or 'pop' are used because 'ah /= 3', for instance, destroys 'al'\n # 'al' itself can be pushed to the stack, but a temporary variable can hold\n tmps = TmpVariables(c)...
[ "0.67757773", "0.67567253", "0.66414994", "0.6501039", "0.64605814", "0.64605814", "0.64605814", "0.6441025", "0.64403903", "0.64396286", "0.6424072", "0.6408364", "0.63651264", "0.6292784", "0.6286183", "0.62550056", "0.62484014", "0.6233559", "0.6230967", "0.61737823", "0.6...
0.79756457
0
Multiply the value of the source by the destination. destination = source destination
def mul(self, destination, source): value = bytearray() if is_single_scalar_reg(destination): value.extend([0xF3, 0x0F, 0x59]) # mulss mod = 0b11 reg = get_register_encoding(destination) rm = get_register_encoding(source) modr_byte = (mod << ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def math_map(val, src, dst):\n return ((val - src[0]) / (src[1] - src[0])) * (dst[1] - dst[0]) + dst[0]", "def mul(self, b):\n self.a *= float(b)", "def multiplies(x, y):\n x[:] *= y[:]\n return x", "def remap(self, value, from1, to1, from2, to2):\n return from2 + (value - from...
[ "0.6133633", "0.60931295", "0.60898423", "0.6068581", "0.5986951", "0.59738857", "0.5968131", "0.5964594", "0.59246063", "0.5863239", "0.5857235", "0.58549577", "0.584587", "0.584587", "0.5834254", "0.58266693", "0.5799772", "0.5781363", "0.57643366", "0.5759176", "0.57497007...
0.6766946
0
Compare the 2 registers.
def cmp(self, register_1, register_2): value = bytearray() # CMP r/m32, r32 value.append(0x39) mod = 0b11 rm = get_register_encoding(register_1) reg = get_register_encoding(register_2) modr_byte = (mod << 6) + (reg << 3) + (rm << 0) value.append(modr_byte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CMP(self):\n # print(\"CMP\")\n reg_a = self.reg[self.ram[self.pc + 1]]\n # print(f\"reg_a: {reg_a}\")\n reg_b = self.reg[self.ram[self.pc + 2]]\n # print(f\"reg_b: {reg_b}\")\n\n if reg_a == reg_b:\n self.fl = 1\n else:\n self.fl = 0\n ...
[ "0.68264544", "0.68111324", "0.64941096", "0.6487504", "0.6472108", "0.63142914", "0.6259232", "0.62587726", "0.6232579", "0.6195376", "0.61831623", "0.61306226", "0.61166954", "0.6099898", "0.6075872", "0.60540825", "0.6052531", "0.5970426", "0.5965147", "0.5943324", "0.5907...
0.6984432
0
Bitwise xor the value of the source to the destination.
def bitwise_xor(self, source, destination): value = bytearray() value.append(0x31) # XOR r/m32, r32 rm = get_register_encoding(destination) reg = get_register_encoding(source) # ModR_byte encoded operands ( ModR/M Byte) MOD 11, RM source and # REG destination m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor(a, b):", "def bitwise_xor(lhs, rhs):\n return _make.bitwise_xor(lhs, rhs)", "def xor_inplace(a,b):", "def __rxor__(self, other):\n return self.runtime.xor(self, other)", "def __xor__(self, other):\r\n return self + other - 2 * self * other", "def __xor__(self, other):\n re...
[ "0.7672315", "0.7345452", "0.7186943", "0.7153426", "0.7133025", "0.70072496", "0.69311196", "0.6911939", "0.6863202", "0.6833823", "0.6805386", "0.6799764", "0.67088455", "0.6669043", "0.6613773", "0.6537522", "0.65117395", "0.64186114", "0.63984483", "0.63516384", "0.633965...
0.75418687
1
Logical and the value of the source to the destination.
def logical_and(self, source, destination): value = bytearray() value.append(0x85) # TEST r/m32, r32 rm = get_register_encoding(destination) reg = get_register_encoding(source) # ModR_byte encoded operands ( ModR/M Byte) MOD 11, RM source and # REG destination ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __and__(self, other):\n return self.__class__(self.value + '&' + str(other))", "def instruction_and(self, register, a, b):\n if Vm.is_register(a):\n a = self.get_register(a)\n\n if Vm.is_register(b):\n b = self.get_register(b)\n\n self.set_register(register, ...
[ "0.6758583", "0.6654114", "0.6651573", "0.66340053", "0.66058034", "0.66024464", "0.6432625", "0.64138114", "0.64005196", "0.63145876", "0.6220739", "0.6164685", "0.6164348", "0.6157701", "0.6103254", "0.60866845", "0.6062071", "0.6052317", "0.60380524", "0.6037289", "0.60364...
0.69457
0
Move the value from the register to the displacement.
def mov_to_displacement(self, register, displacement): value = bytearray() # 89 /r MOV r/m32,r32 value.append(0x89) rm = 5 # disp32 reg = get_register_encoding(register) mod = 0b00 modr_byte = (mod << 6) + (reg << 3) + (rm << 0) value.append(modr_byte) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, displacement):\n self._position = self._position + np.array(displacement)", "def move_by(cls, value):\n cls.set_position(cls._position + value)", "def move(self, p):\r\n self.position.setvalue(p)", "def mov_from_displacement(self, register, displacement):\n value = byt...
[ "0.64975315", "0.64043707", "0.6337014", "0.61767346", "0.5963736", "0.5932595", "0.58778435", "0.58335906", "0.581935", "0.5766156", "0.5750786", "0.5742687", "0.5707826", "0.5682735", "0.56792897", "0.56579965", "0.5653679", "0.5644983", "0.56442827", "0.5611535", "0.558919...
0.64129525
1
call the symbol with the specified displacement
def call(self, displacement): value = bytearray() # E8 cd CALL rel32 value.append(0xe8) displacement_offset = len(value) encoded_displacement = struct.pack("i", displacement) value += encoded_displacement return value, displacement_offset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawSymbol(x,y,nsymb='circle',ucoords=1):\n if ucoords:\n dislin.rlsymb(symboldict[nsymb],x,y)\n else:\n dislin.symbol(symboldict[nsymb],x,y)", "def process(opcode):\n opcode.process()", "def translate(self, displacement):\n print 'Invoked abstract {}.translate({})'.format(self, d...
[ "0.56943285", "0.5489482", "0.5402592", "0.53867096", "0.52879184", "0.5286736", "0.5284965", "0.5274234", "0.5264603", "0.5246484", "0.5241409", "0.5233029", "0.52160776", "0.52016294", "0.5199983", "0.5192509", "0.51686007", "0.5160502", "0.514106", "0.51327693", "0.5121817...
0.6060208
0
Sets the status_switch_time of this EnabledInfo.
def status_switch_time(self, status_switch_time): self._status_switch_time = status_switch_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_sys_time(self, state_sys_time):\n self._state_sys_time = state_sys_time", "def __init__(self, status=False, comment=None, status_switch_time=None, teamcity=None): # noqa: E501 # noqa: E501\n\n self._status = None\n self._comment = None\n self._status_switch_time = None\n ...
[ "0.56983596", "0.56610054", "0.54731107", "0.54664826", "0.5443645", "0.5386132", "0.53337675", "0.5331197", "0.5310322", "0.5297834", "0.5279101", "0.5279101", "0.5279101", "0.5268614", "0.5240808", "0.52355987", "0.5214942", "0.52022564", "0.5184441", "0.51803786", "0.51623...
0.86382955
0
Makes a numpy array of length (life + 1) containing an escalation pattern that starts with a 1.0 in year 1 and escalates at the rate of 'esc' per year.
def make_pattern(esc, life): pat = np.ones(life - 1) * (1 + esc) return np.insert(pat.cumprod(), 0, [0.0, 1.0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_emission(seed, alpha):\n emission = np.full((len(seed), 4), alpha)\n for i in range(len(seed)):\n emission[i][mf.converting_dict[seed[i]]] = 1 - (3 * alpha)\n return emission", "def year_emissions_intensity_rule(_m, y):\r\n\r\n return m.YEAR_EMISSIONS[y] / m.YEAR_DEMAND[y]", ...
[ "0.537839", "0.5295557", "0.51413655", "0.50725186", "0.5033424", "0.503185", "0.49648854", "0.4937964", "0.49305174", "0.49206144", "0.48922628", "0.48883197", "0.48796484", "0.48640448", "0.48597133", "0.48559386", "0.48517108", "0.48076227", "0.4794939", "0.47877327", "0.4...
0.6938873
0
Returns a string with all the object attributes shown. Text is truncated at 1,000 characters for attributes with long representations.
def __repr__(self): s = '' for attr in self.__dict__: val = pformat(self.__dict__[attr])[:1500] if len(val)>70: s+=f'\n{attr}:\n{val}\n\n' else: s += f'{attr}: {val}\n' return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self) -> str:\n result = \"\"\n for attr in self.ATTRS:\n if len(result) != 0:\n result += \"\\n\"\n result += f\"{attr}: {getattr(self, attr)}\"\n\n return result", "def print_attr(self):\n return \"name : {0}\\nprice : {1}\\ndescripti...
[ "0.75190467", "0.69517773", "0.6905581", "0.68455577", "0.6838535", "0.6838535", "0.67091894", "0.6650824", "0.66367036", "0.6604279", "0.65919584", "0.649932", "0.64982975", "0.6483168", "0.6443407", "0.64355075", "0.641786", "0.64078474", "0.6405377", "0.63975364", "0.63826...
0.72888416
1
Calculates two DataFrames, s.df_mo_dol_base and s.df_mo_dol_hp, that contain the fuel and electricity costs in the base case (no heat pump) scenario and the with heat pump scenario. A number of inputs found as object attributes are used.
def calc_monthly_cash(self): # shortcut to self s = self # Start the DataFrames, base and w/ heat pump # Each starts with just an index column with the month # Make shortcut variables as well. s.df_mo_dol_base = dfb = s.df_mo_en_base[[]].copy() s.df_mo_dol_hp = d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_from_wind_turbine_instances(\n cls, wind_turbine_instances: Sequence[WT], *,\n obj_name: str,\n wind_turbine_instances_data_category: Sequence[DataCategoryData] = None\n ) -> Tuple[WF, pd.DataFrame]:\n wind_farm_df = pd.DataFrame()\n rated_active_power_out...
[ "0.5660956", "0.5655172", "0.5579629", "0.5421307", "0.5419629", "0.54016674", "0.53727275", "0.5365491", "0.53054965", "0.5294723", "0.52814853", "0.52807844", "0.52779233", "0.5275528", "0.5258509", "0.5251441", "0.5247281", "0.5230594", "0.520611", "0.5203686", "0.5199195"...
0.5770504
0
Calculates the cash flow impacts of the installation over the life of the heat pump. Creates a DataFrame, self.df_cash_flow, that shows the impacts. In that DataFrame, postive values are benefits and negative values are costs. Also calculates some summary economic measures that are added to the self.summary dictionary.
def calc_cash_flow(self): s = self # shortcut variable # determine the changes caused by the heat pump on an annual basis. # First calculate annual totals for base case and heat pump case and # then calculate the change. ann_base = s.df_mo_dol_base.sum() ann_hp = s.df_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cash_flow(self):\n _cash_flow = self.after_tax_profit() + self.depreciation()\n return _cash_flow", "def calc_monthly_cash(self):\n # shortcut to self\n s = self\n\n # Start the DataFrames, base and w/ heat pump\n # Each starts with just an index column with the mont...
[ "0.6860208", "0.62159723", "0.6203873", "0.60280895", "0.58815134", "0.5846813", "0.5730285", "0.56917614", "0.552311", "0.5492948", "0.5426759", "0.5425919", "0.5409178", "0.54051167", "0.5358192", "0.53577197", "0.531285", "0.52336454", "0.5229268", "0.52243525", "0.5217386...
0.7822605
0
Exploit linearity of finitedifferences to collect `Derivative`'s of same type. This may help CIRE creating fewer temporaries while catching larger redundant subexpressions.
def collect_derivatives(expressions): processed = [] for e in expressions: # Track type and number of nested Derivatives mapper = inspect(e) # E.g., 0.2*u.dx -> (0.2*u).dx ep = aggregate_coeffs(e, mapper) # E.g., (0.2*u).dx + (0.3*v).dx -> (0.2*u + 0.3*v).dx pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(expr, defs, simplify):\n keyify = ModelBase.keyify\n D = partial(sy.Derivative, evaluate=False)\n zero = sy.S.Zero\n\n def process_one(expr):\n # Compute any needed derivatives for which the function is in defs.\n ds = {}\n for f, *vs in symu...
[ "0.64984953", "0.6022701", "0.5994475", "0.5926657", "0.5924152", "0.59209895", "0.581543", "0.57943463", "0.5684287", "0.5647038", "0.561987", "0.55969507", "0.5575678", "0.55648893", "0.5547289", "0.55321646", "0.54854757", "0.54831964", "0.5462871", "0.5462641", "0.5458628...
0.64204097
1
Create a VPL a3tree from a VPL ANTLR AST root `vplprog`.
def __init__(self, vplprog): self.validated = False self.consts = dict() self.functions = [] funcnames = set() for child in vplprog.children: func = FunctionNode(child, self.consts) if func.name in funcnames: raise VPLSyntaxError("Duplic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_program(program):\n # TODO: Check number of vars and clauses to see if they match\n\n lines = program.split(\"\\n\")\n\n # Ignore comments at the beginning of the file:\n start_i = 0\n while lines[start_i][0] != \"p\":\n start_i += 1\n lines = lines[start_i:]\n\n var_count, cl...
[ "0.52230465", "0.49252325", "0.46104807", "0.45894322", "0.45894042", "0.45825136", "0.45560837", "0.4493835", "0.44870967", "0.44837463", "0.44580024", "0.44549465", "0.4439654", "0.44291574", "0.44259748", "0.44188792", "0.43797743", "0.43463627", "0.43425164", "0.43398482", ...
0.4936901
1
Turn path into key to use in 3rd party storage. Currently this is as simple as removing base dir from path, then prefixing it with rootdir value.
def key_from_path(self, path="", base_dir=""): path = path.replace(base_dir, '') if path[0] == os.path.sep: path = path[1:] return os.path.join(self.rootdir, path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_key(dirname):\n return DIR_PREFIX + dirname", "def _dirname(self, key):\n return os.path.join(self.root, key[:2])", "def sub_key(dirname):\n return SUB_PREFIX + dirname", "def key_path(self):\n keypath = self._get_field('System', 'keypath')\n localpath = \"/\".join(__file__...
[ "0.70307285", "0.6873913", "0.6864295", "0.6697557", "0.6463119", "0.6408098", "0.6397142", "0.63430625", "0.6226184", "0.6187688", "0.6171268", "0.61642385", "0.6160851", "0.61486757", "0.611116", "0.60898304", "0.60883385", "0.6058004", "0.60259813", "0.60237646", "0.600465...
0.8618531
0
Helper to get waypoint from a ros service
def get_waypoint(self, location): try: response = self._get_waypoint_client(location) return response.waypoint except (rospy.ServiceException, rospy.ROSInterruptException) as e: if not rospy.is_shutdown: rospy.logwarn("Service call failed: {}".format(e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gpx_waypoint(self, route=None, start_time=datetime.utcnow()):\n route = route or self.route\n\n return self.place.get_gpx_waypoint(\n route=route,\n line_location=self.line_location,\n start_time=start_time,\n )", "def process_waypoint(self, waypoint:...
[ "0.6329848", "0.6078961", "0.5993481", "0.59506613", "0.5742342", "0.57323164", "0.56817514", "0.56569", "0.563713", "0.5598897", "0.55926096", "0.5566901", "0.5547881", "0.5547284", "0.5534404", "0.5523734", "0.5447893", "0.54152167", "0.5409358", "0.5405175", "0.53959525", ...
0.7313301
0
set a global plan to follow
def set_global_plan(self, current_plan): self._waypoints_queue.clear() self._waypoint_buffer.clear() for elem in current_plan: self._waypoints_queue.append(elem.pose) self._global_plan = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plan(self, plan):\n\n self._plan = plan", "def __init__(self, plan):\n self.plan = plan", "def plan(self):\n raise NotImplementedError('You must implement the plan() method '\n 'yourself!')", "def plans(self, plans):\n\n self._plans = plans", ...
[ "0.70844966", "0.64606065", "0.61399275", "0.60609365", "0.5980756", "0.5975116", "0.5964873", "0.59525704", "0.59406114", "0.57446986", "0.5731731", "0.57296085", "0.5710618", "0.56806356", "0.55868524", "0.5561553", "0.55404496", "0.54986835", "0.54892844", "0.54311496", "0...
0.6902387
1
Test that the plugin returns the expected results for the threshold_points, where they've been padded with the values from the bounds_pairing.
def test_bounds_of_threshold_points(self): result = Plugin()._add_bounds_to_thresholds_and_probabilities( self.threshold_points, self.probabilities_for_cdf, self.bounds_pairing ) self.assertArrayAlmostEqual(result[0][0], self.bounds_pairing[0]) self.assertArrayAlmostEqual(res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic(self):\n result = Plugin()._add_bounds_to_thresholds_and_probabilities(\n self.threshold_points, self.probabilities_for_cdf, self.bounds_pairing\n )\n self.assertIsInstance(result[0], np.ndarray)\n self.assertIsInstance(result[1], np.ndarray)", "def test_new_...
[ "0.719579", "0.684678", "0.6669793", "0.64796793", "0.6335615", "0.6143842", "0.61127037", "0.6032276", "0.6015421", "0.6002184", "0.599585", "0.5975781", "0.5906512", "0.5887144", "0.5832696", "0.5829893", "0.5756399", "0.5743822", "0.5730521", "0.57289267", "0.5712077", "...
0.78975093
0
Test that the plugin returns the expected results for the probabilities, where they've been padded with zeros and ones to represent the extreme ends of the Cumulative Distribution Function.
def test_probability_data(self): zero_array = np.zeros(self.probabilities_for_cdf[:, 0].shape) one_array = np.ones(self.probabilities_for_cdf[:, 0].shape) result = Plugin()._add_bounds_to_thresholds_and_probabilities( self.threshold_points, self.probabilities_for_cdf, self.bounds_pai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_probabilities_are_ok(self, seed):\n bins = defaultdict(int)\n probs = (0.1, 0.2, 0.3, 0.4)\n categories = (\"asdfa\", \"2\", \"3\", \"4\")\n categories = OrderedDict(zip(categories, probs))\n dim = Categorical(\"yolo\", categories)\n for _ in range(500):\n ...
[ "0.6374176", "0.6352754", "0.62915987", "0.62280864", "0.62017274", "0.6192897", "0.60687095", "0.6042499", "0.59759796", "0.59320986", "0.59315836", "0.5920009", "0.5913255", "0.5912493", "0.59092176", "0.5891712", "0.5841554", "0.58326256", "0.58244747", "0.5810986", "0.579...
0.6837059
0
Test that the plugin raises a ValueError when the constant end points of the distribution are exceeded by a threshold value used in the forecast.
def test_endpoints_of_distribution_exceeded(self): probabilities_for_cdf = np.array([[0.05, 0.7, 0.95]]) threshold_points = np.array([8, 10, 60]) msg = ( "The calculated threshold values \\[-40 8 10 60 50\\] are " "not in ascending order as required for the cumulativ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_endpoints_of_distribution_exceeded_warning(self):\n probabilities_for_cdf = np.array([[0.05, 0.7, 0.95]])\n threshold_points = np.array([8, 10, 60])\n plugin = Plugin(ecc_bounds_warning=True)\n warning_msg = (\n \"The calculated threshold values \\\\[-40 8 10 60 ...
[ "0.71260935", "0.69827926", "0.68927157", "0.6885777", "0.68114245", "0.6749991", "0.67027164", "0.6618494", "0.6598716", "0.6591503", "0.6530036", "0.64793366", "0.6463078", "0.64473385", "0.64358014", "0.6433764", "0.6428149", "0.63384223", "0.6301553", "0.62790203", "0.624...
0.71543616
0
Test that the plugin raises a warning message when the constant end points of the distribution are exceeded by a threshold value used in the forecast and the ecc_bounds_warning keyword argument has been specified.
def test_endpoints_of_distribution_exceeded_warning(self): probabilities_for_cdf = np.array([[0.05, 0.7, 0.95]]) threshold_points = np.array([8, 10, 60]) plugin = Plugin(ecc_bounds_warning=True) warning_msg = ( "The calculated threshold values \\[-40 8 10 60 50\\] are " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_endpoints_of_distribution_exceeded(self):\n probabilities_for_cdf = np.array([[0.05, 0.7, 0.95]])\n threshold_points = np.array([8, 10, 60])\n msg = (\n \"The calculated threshold values \\\\[-40 8 10 60 50\\\\] are \"\n \"not in ascending order as required ...
[ "0.67445374", "0.66164804", "0.6610382", "0.65033454", "0.64456296", "0.6373654", "0.63412553", "0.62923974", "0.6257579", "0.61385965", "0.6116455", "0.60966367", "0.60109484", "0.60088336", "0.5978419", "0.59771425", "0.59564394", "0.5920458", "0.5912523", "0.59046537", "0....
0.78640896
0
Test that the plugin reapplies the threshold bounds using the maximum and minimum threshold points values when the original bounds have been exceeded and ecc_bounds_warning has been set.
def test_new_endpoints_generation(self): probabilities_for_cdf = np.array([[0.05, 0.7, 0.95]]) threshold_points = np.array([-50, 10, 60]) plugin = Plugin(ecc_bounds_warning=True) result = plugin._add_bounds_to_thresholds_and_probabilities( threshold_points, probabilities_for_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bounds_of_threshold_points(self):\n result = Plugin()._add_bounds_to_thresholds_and_probabilities(\n self.threshold_points, self.probabilities_for_cdf, self.bounds_pairing\n )\n self.assertArrayAlmostEqual(result[0][0], self.bounds_pairing[0])\n self.assertArrayAlmos...
[ "0.7740982", "0.7447278", "0.70140845", "0.67366767", "0.67326176", "0.6619069", "0.6563025", "0.6515247", "0.6310733", "0.6309086", "0.6155821", "0.61060596", "0.60197926", "0.5989274", "0.5924179", "0.59113014", "0.59099185", "0.5895176", "0.5884772", "0.5873775", "0.586255...
0.74788845
1
Test that the plugin returns an Iris.cube.Cube with the expected data values for the percentiles when input probabilities are given for being above a threshold. The input cube contains probabilities that values are above a given threshold.
def test_simple_check_data_above(self): expected = np.array([8.15384615, 9.38461538, 11.6]) expected = expected[:, np.newaxis, np.newaxis] data = np.array([0.95, 0.3, 0.05]) data = data[:, np.newaxis, np.newaxis] cube = set_up_probability_cube( data.astype(np.float3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_masked_data_above(self):\n\n expected_mask = np.full_like(self.cube.data, False, dtype=bool)\n expected_mask[:, 0, 0] = True\n expected_mask[1, 0, 2] = True\n expected_mask[2, 0] = True\n expected_mask[2, 1, 2] = True\n expected_mask[2, 1, 0] = True\n\n cub...
[ "0.69277525", "0.6920947", "0.6917545", "0.68459755", "0.67894167", "0.6754685", "0.6743888", "0.67417485", "0.66948694", "0.6655549", "0.65975934", "0.65862066", "0.65759397", "0.652667", "0.6486896", "0.64796543", "0.64198154", "0.6406225", "0.63728595", "0.6294431", "0.629...
0.71302897
0
Test that the plugin returns an Iris.cube.Cube with the expected data values for the percentiles when input probabilities are given for being below a threshold. The input cube contains probabilities that values are below a given threshold.
def test_simple_check_data_below(self): expected = np.array([8.4, 10.61538462, 11.84615385]) expected = expected[:, np.newaxis, np.newaxis] data = np.array([0.95, 0.3, 0.05])[::-1] data = data[:, np.newaxis, np.newaxis] cube = set_up_probability_cube( data.astype(np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_check_data_above(self):\n expected = np.array([8.15384615, 9.38461538, 11.6])\n expected = expected[:, np.newaxis, np.newaxis]\n\n data = np.array([0.95, 0.3, 0.05])\n data = data[:, np.newaxis, np.newaxis]\n\n cube = set_up_probability_cube(\n data.ast...
[ "0.71143323", "0.69120485", "0.6853026", "0.6835354", "0.6831722", "0.68067634", "0.67906696", "0.6725671", "0.67151564", "0.6636815", "0.66038024", "0.65969193", "0.6590717", "0.65470123", "0.64915395", "0.6466899", "0.6463093", "0.6440879", "0.6410098", "0.63474613", "0.630...
0.70286065
1
Test that the plugin raises a Warning when the probabilities of the Cumulative Distribution Function are not monotonically increasing.
def test_probabilities_not_monotonically_increasing(self): data = np.array([0.05, 0.7, 0.95]) data = data[:, np.newaxis, np.newaxis] cube = set_up_probability_cube( data.astype(np.float32), ECC_TEMPERATURE_THRESHOLDS, threshold_units="degC" ) warning_msg = "The proba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_endpoints_of_distribution_exceeded_warning(self):\n probabilities_for_cdf = np.array([[0.05, 0.7, 0.95]])\n threshold_points = np.array([8, 10, 60])\n plugin = Plugin(ecc_bounds_warning=True)\n warning_msg = (\n \"The calculated threshold values \\\\[-40 8 10 60 ...
[ "0.6257544", "0.61204076", "0.6000376", "0.59060574", "0.58344734", "0.58271956", "0.5793631", "0.5765131", "0.57486564", "0.57178396", "0.57100916", "0.5699948", "0.5693938", "0.5689576", "0.5672847", "0.5670053", "0.5655936", "0.5628299", "0.56253004", "0.56231534", "0.5614...
0.7187914
0
Test that the plugin returns a cube with coordinates that do not include a thresholdtype coordinate.
def test_result_cube_has_no_air_temperature_threshold_coordinate(self): result = Plugin()._probabilities_to_percentiles(self.cube, self.percentiles) try: threshold_coord = find_threshold_coordinate(result) except CoordinateNotFoundError: threshold_coord = None sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_up_threshold_cube():\n test_data = 50*np.arange(16).reshape(4, 4)\n grid_x = DimCoord(np.arange(4), standard_name=\"projection_x_coordinate\",\n units=\"km\")\n grid_y = DimCoord(np.arange(4), standard_name=\"projection_y_coordinate\",\n units=\"km\")\n ...
[ "0.74248683", "0.7069244", "0.6810583", "0.67248046", "0.6613177", "0.66049516", "0.6124608", "0.60638976", "0.6052908", "0.6027747", "0.6007635", "0.59955645", "0.59887993", "0.5988257", "0.5962287", "0.59617907", "0.5950424", "0.5916395", "0.5913348", "0.5898261", "0.588881...
0.7110401
1
Test that if mask_percentiles is true, data is masked as expected when input probability data is below a threshold
def test_masked_data_below(self): expected_mask = np.full_like(self.cube.data, False, dtype=bool) expected_mask[:, 0, 0] = True expected_mask[1, 0, 2] = True expected_mask[2, 0] = True expected_mask[2, 1, 2] = True expected_mask[2, 1, 0] = True cube = set_up_pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_masked_data_above(self):\n\n expected_mask = np.full_like(self.cube.data, False, dtype=bool)\n expected_mask[:, 0, 0] = True\n expected_mask[1, 0, 2] = True\n expected_mask[2, 0] = True\n expected_mask[2, 1, 2] = True\n expected_mask[2, 1, 0] = True\n\n cub...
[ "0.7409071", "0.7035821", "0.69734675", "0.6844706", "0.6744364", "0.67056406", "0.66986704", "0.6684498", "0.6529539", "0.6523061", "0.6482787", "0.64597285", "0.64500827", "0.63857543", "0.6213539", "0.6212498", "0.61219025", "0.6083494", "0.60293734", "0.6021541", "0.60212...
0.74082536
1
Test that if mask_percentiles is true, data is masked as expected when input probability data is above a threshold
def test_masked_data_above(self): expected_mask = np.full_like(self.cube.data, False, dtype=bool) expected_mask[:, 0, 0] = True expected_mask[1, 0, 2] = True expected_mask[2, 0] = True expected_mask[2, 1, 2] = True expected_mask[2, 1, 0] = True cube = set_up_pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_masked_data_below(self):\n\n expected_mask = np.full_like(self.cube.data, False, dtype=bool)\n expected_mask[:, 0, 0] = True\n expected_mask[1, 0, 2] = True\n expected_mask[2, 0] = True\n expected_mask[2, 1, 2] = True\n expected_mask[2, 1, 0] = True\n\n cub...
[ "0.738824", "0.70113176", "0.6967795", "0.6865802", "0.67000794", "0.6676032", "0.6657211", "0.66358995", "0.65491456", "0.6539919", "0.64712626", "0.6468062", "0.64472556", "0.63414085", "0.6177767", "0.61747384", "0.6122537", "0.60699046", "0.6036211", "0.6035808", "0.60130...
0.74539745
0
Set up temperature probability cube and expected output percentiles.
def setUp(self): self.cube = set_up_probability_cube( ECC_TEMPERATURE_PROBABILITIES, ECC_TEMPERATURE_THRESHOLDS, threshold_units="degC", ) self.percentile_25 = np.array( [[24.0, 8.75, 11.0], [8.33333333, 8.75, -46.0], [-46.0, -66.25, -73.0]], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.cube = set_up_probability_cube(\n ECC_TEMPERATURE_PROBABILITIES,\n ECC_TEMPERATURE_THRESHOLDS,\n threshold_units=\"degC\",\n )\n self.percentiles = [10, 50, 90]", "def setUp(self):\n self.test_cube = set_up_percentiles_cube()\n ...
[ "0.8079492", "0.7257413", "0.69849426", "0.6969755", "0.69543904", "0.69267505", "0.686324", "0.6826061", "0.6756845", "0.6459269", "0.6388435", "0.59787405", "0.59350365", "0.592934", "0.5879139", "0.5785741", "0.5752016", "0.5751117", "0.5730473", "0.57197654", "0.5658526",...
0.785308
1
Test that the plugin returns an Iris.cube.Cube with the expected data values for a specific number of percentiles.
def test_check_data_specifying_no_of_percentiles(self): expected_data = np.array( [self.percentile_25, self.percentile_50, self.percentile_75] ) result = Plugin().process(self.cube, no_of_percentiles=3) self.assertArrayAlmostEqual(result.data, expected_data, decimal=5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_up_percentiles_cube():\n\n test_data = np.full((5, 4, 4), -1, dtype=float)\n for i in range(5):\n test_data[i].fill(100*i + 200)\n\n percentiles = DimCoord(np.linspace(0, 100, 5), long_name=\"percentiles\",\n units=\"%\")\n grid_x = DimCoord(np.arange(4), standa...
[ "0.7763058", "0.75996083", "0.75952774", "0.737489", "0.72322464", "0.7171106", "0.6909242", "0.6889539", "0.68199587", "0.665561", "0.6648643", "0.66393584", "0.663194", "0.66033685", "0.65933776", "0.65212876", "0.63995564", "0.6296521", "0.627213", "0.62534946", "0.6210505...
0.78087634
0
Test that the plugin returns an Iris.cube.Cube with the expected data values for a specific set of percentiles.
def test_check_data_specifying_percentiles(self): expected_data = np.array( [self.percentile_25, self.percentile_50, self.percentile_75] ) result = Plugin().process(self.cube, percentiles=[25, 50, 75]) self.assertArrayAlmostEqual(result.data, expected_data, decimal=5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_up_percentiles_cube():\n\n test_data = np.full((5, 4, 4), -1, dtype=float)\n for i in range(5):\n test_data[i].fill(100*i + 200)\n\n percentiles = DimCoord(np.linspace(0, 100, 5), long_name=\"percentiles\",\n units=\"%\")\n grid_x = DimCoord(np.arange(4), standa...
[ "0.7771506", "0.7637885", "0.7576238", "0.73423517", "0.732776", "0.7137765", "0.7137118", "0.6886038", "0.68473953", "0.6814261", "0.6812227", "0.6701598", "0.6672691", "0.6636288", "0.66092104", "0.64386344", "0.63548344", "0.6288714", "0.62531054", "0.62184966", "0.6137446...
0.7706754
1
Test that the plugin returns an Iris.cube.Cube with the expected data values when the input data is masked.
def test_check_data_masked_input_data(self): cube = self.cube.copy() cube.data[:, 0, 0] = np.nan cube.data = np.ma.masked_invalid(cube.data) expected_data = np.array( [self.percentile_25, self.percentile_50, self.percentile_75] ) expected_data[:, 0, 0] = np.na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fix_data(self):\n cube = self.fix.fix_data(self.cube)\n np.testing.assert_allclose(cube.data[0], 1.0)\n np.testing.assert_allclose(cube.data[2], 2.0)\n assert not np.ma.is_masked(cube.data[0])\n assert np.ma.is_masked(cube.data[1])\n assert not np.ma.is_masked(cub...
[ "0.7901443", "0.7473784", "0.6787747", "0.6739349", "0.6671436", "0.6651448", "0.6638396", "0.6585609", "0.647309", "0.6370611", "0.6370014", "0.630835", "0.6258658", "0.61970395", "0.6188581", "0.61869615", "0.6175183", "0.61498755", "0.61075073", "0.6079311", "0.6009722", ...
0.7906674
0
Test that the plugin returns an Iris.cube.Cube with the expected data values when the input data is masked without underlying nans.
def test_check_data_masked_input_data_non_nans(self): cube = self.cube.copy() cube.data[:, 0, 0] = 1000 cube.data = np.ma.masked_equal(cube.data, 1000) expected_data = np.array( [self.percentile_25, self.percentile_50, self.percentile_75] ) expected_data[:, 0,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_data_masked_input_data(self):\n cube = self.cube.copy()\n cube.data[:, 0, 0] = np.nan\n cube.data = np.ma.masked_invalid(cube.data)\n expected_data = np.array(\n [self.percentile_25, self.percentile_50, self.percentile_75]\n )\n expected_data[:, 0...
[ "0.7789203", "0.7684636", "0.66929466", "0.66169834", "0.659524", "0.6519391", "0.64588916", "0.6404161", "0.63929504", "0.6327322", "0.6313173", "0.63003385", "0.62461406", "0.61661744", "0.6068755", "0.6047881", "0.5975984", "0.59653634", "0.596338", "0.59392494", "0.588745...
0.7711717
1
Test that the plugin raises a suitable error when both a number and set or percentiles are specified.
def test_check_data_over_specifying_percentiles(self): msg = "Cannot specify both no_of_percentiles and percentiles" with self.assertRaisesRegex(ValueError, msg): Plugin().process(self.cube, no_of_percentiles=3, percentiles=[25, 50, 75])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_data_not_specifying_percentiles(self):\n expected_data = np.array(\n [self.percentile_25, self.percentile_50, self.percentile_75]\n )\n result = Plugin().process(self.cube)\n self.assertArrayAlmostEqual(result.data, expected_data, decimal=5)", "def test_valid...
[ "0.71166843", "0.71014607", "0.70753664", "0.70294386", "0.69882274", "0.69181544", "0.6872949", "0.68601805", "0.6572998", "0.64669484", "0.63791", "0.6377281", "0.63632876", "0.63555914", "0.62580764", "0.6247962", "0.6244597", "0.61972016", "0.6178796", "0.61508536", "0.61...
0.832811
0
Retrieves an api domain name associated with its service name and account location.
def get_domain(self, service_name: str) -> str: # Retrieve Domain URL url = 'http://api.liveperson.net/api/account/{}/service/{}/baseURI.json?version=1.0' # Generate request r = requests.get(url=url.format(self.account_id, service_name)) # Check request status if r.sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain_name(self) -> str:\n return pulumi.get(self, \"domain_name\")", "def domain_name(self) -> str:\n return pulumi.get(self, \"domain_name\")", "def domain_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"domain_name\")", "def domain_name(self) -> pulumi.Output[str]:\...
[ "0.6092376", "0.6092376", "0.6033187", "0.6033187", "0.6033187", "0.59749764", "0.58710104", "0.58710104", "0.58710104", "0.58671296", "0.58103323", "0.5798188", "0.57947475", "0.57761365", "0.5760802", "0.573283", "0.57298726", "0.57272047", "0.56885713", "0.56610256", "0.56...
0.66219825
0
Output to a file all the inversions above a certain threshold
def output_inversions(folder,threshold): start_stop_matcher = re.compile("(.*):(.*)-(.*)") common_inversions = [] abs_alt = defaultdict(dict) abs_ref = defaultdict(dict) perc_alt = defaultdict(dict) abs_alt,abs_ref,perc_alt,perc_ref,common_inversions = parse_geno_file(folder,True) ## Call ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_inversion_info(file_dic):\n #print_file_test = open('file_test.txt','w')\n\n if not ( check_inversion_files(file_dic) ):\n print 'error(read_inversion_info): problem with lenstool file names'\n return 0\n \n file_generate_arcs = file_dic['file_generate_arcs']\n info_input_lens...
[ "0.4990604", "0.49544272", "0.48831218", "0.4873142", "0.48636973", "0.4851662", "0.48394278", "0.48091355", "0.48042423", "0.4795279", "0.478783", "0.47762606", "0.4751992", "0.47463143", "0.4738957", "0.46986628", "0.46785325", "0.4669221", "0.4647818", "0.4647721", "0.4646...
0.6959288
0
Plots the Distribution of MAPQ Scores for the Inversion Regions in the respective species
def plot_mapqs(folder): mapqs_counts = defaultdict(list) mapqs_labels = defaultdict(list) strain_matcher = re.compile('(.*) \(.*\)') ## regex to get strain name from radio button click ## Parse the information from the mapq count files and store the information in a dictionary of lists for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_map(priors):\n sns.set_style(\"white\")\n\n cmap=sns.cubehelix_palette(8, start=.5, rot=-.75,as_cmap=True)\n hdulists=list(map(lambda prior:postmaps.make_fits_image(prior,prior.sim), priors))\n fig = plt.figure(figsize=(10*len(priors),10))\n figs=[]\n for i in range(0,len(priors)):\n ...
[ "0.6568001", "0.6260689", "0.6102468", "0.60836643", "0.60835874", "0.6057212", "0.5965246", "0.59614104", "0.5933933", "0.59183824", "0.5896988", "0.58681875", "0.5855228", "0.5831", "0.5818143", "0.57990634", "0.57858175", "0.57848036", "0.576552", "0.57607186", "0.5752298"...
0.66524667
0
Plot the scatter plots for the mean insert size for reference vs alt orientation
def plot_insertsize():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_scatter(self):\n plt.scatter(self.a1[:, 0], self.a1[:, 1], c=\"red\", alpha=0.5, s=10)\n plt.scatter(self.a2[:, 0], self.a2[:, 1], c=\"blue\", alpha=0.5, s=10)\n plt.scatter(0, 0, marker=\"D\", c=\"black\", alpha=0.8)\n plt.scatter(2, 2, marker=\"D\", c=\"black\", alpha=0.8)\n ...
[ "0.6182612", "0.610708", "0.60937995", "0.59914863", "0.5968338", "0.5933697", "0.59318006", "0.5899528", "0.58889055", "0.5836664", "0.58022463", "0.5787474", "0.575467", "0.57508355", "0.57342887", "0.57267606", "0.57120967", "0.57113814", "0.5710295", "0.57100904", "0.5704...
0.6834439
0
Constructor of FiniteField p should be prime
def __init__(s, p): Zmod.__init__(s, p) if s.element_class != FiniteFieldElement: raise ArithmeticError("Invalid Prime : %d" % p) s.p = p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,F,t,n):\n \n assert type(F) is Field\n assert type(t) is int, \"t is not an integer: %r\" % t\n assert type(n) is int, \"n is not an integer: %r\" % n\n assert t<= n, \"threshold t must be <= than n\"\n assert t>1, \"threshold t must be >1 %r\" % t\n ...
[ "0.6782723", "0.6398207", "0.6397169", "0.63615704", "0.6359336", "0.63571376", "0.633831", "0.626701", "0.6258804", "0.6233947", "0.6231407", "0.6160947", "0.61454636", "0.6106458", "0.6070265", "0.60607654", "0.6042472", "0.5973163", "0.5903719", "0.5888158", "0.58806837", ...
0.80051595
0
Return json string from difference object.
def get_json_string(diff: Diff, indent=4) -> str: def call_serialize(obj): return obj.serialize() json_string = json.dumps( diff.serialize(), indent=indent, default=call_serialize, ) return json_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_diff_str(diff):\r\n\r\n res = []\r\n flat_diff_from, flat_diff_to = diff\r\n flat_diff_from = remove_none_values(flat_diff_from)\r\n flat_diff_to = remove_none_values(flat_diff_to)\r\n common_keys, _, _, from_keys, to_keys = c_keys(flat_diff_from, flat_diff_to)\r\n for key in from_keys:\...
[ "0.7502188", "0.68088746", "0.6624942", "0.6578817", "0.64568", "0.63217396", "0.6257757", "0.61921203", "0.6145843", "0.603486", "0.6011713", "0.6010949", "0.59885836", "0.5964092", "0.5949869", "0.5877279", "0.5867506", "0.58630055", "0.58599705", "0.5859947", "0.5858095", ...
0.7358774
1
Concatenate multiple [ctzxy] stacks
def concatenate_5dstacks(stacks): def stack_channel(stacks, channel): """Stack multiple 4d ndarrays""" cstack = stacks[0][channel].copy() frames = [] for i in range(1, len(stacks)): frames.append(len(cstack)) cstack = np.vstack([cstack, stacks[i][channel]]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MultiLayerStack(cls,InRasters,OutRaster):\r\n try:\r\n import otbApplication\r\n except:\r\n raise ImportError(\"Can not import module otbApllication\")\r\n\r\n ConcatenateImages = otbApplication.Registry.CreateApplication(\"ConcatenateImages\")\r\n Concatenate...
[ "0.6498583", "0.6479267", "0.62884665", "0.6150949", "0.61285806", "0.60151136", "0.59927446", "0.5976746", "0.5956631", "0.59386384", "0.5853774", "0.58472294", "0.5799984", "0.57844335", "0.57686174", "0.5713166", "0.5703821", "0.5699072", "0.5677887", "0.56693846", "0.5608...
0.66099006
0
Filter objects in a labelmask by size.
def labelmask_filter_objsize(labelmask, size_min, size_max): # Count pixels in each object. (labels, counts) = np.unique(labelmask, return_counts=True) # Select and keep only objects within size range. labels_selected = labels[(counts >= size_min) & (counts <= size_max)] labelmask_filtered = np.wher...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labelmask_filter_objsize(labelmask, size_min, size_max):\n # Count pixels in each object.\n (labels, counts) = np.unique(labelmask, return_counts=True)\n # Select objects in desired size range, update filtered mask.\n labels_selected = labels[(counts >= size_min) & (counts <= size_max)]\n labelm...
[ "0.8573959", "0.6939182", "0.6483512", "0.62495494", "0.61732835", "0.61590266", "0.5965265", "0.5950577", "0.5941151", "0.5941151", "0.5934471", "0.58814865", "0.58358586", "0.5830406", "0.5786581", "0.56891656", "0.56274724", "0.5625585", "0.56160206", "0.5606811", "0.55923...
0.860325
0
Find local maxima pixels in an image stack within a given window. Defines local maxima as pixels whose value is equal to the maximum value within a defined window centered on that point. Implementation is to first run a maximum filter, then define pixels in the original image whose value is equal to the maxfilter resul...
def local_max(img, size=(70,100,100)): # Apply a maximum filter. max_f = ndi.maximum_filter(img, size=size) # Find pixels that are local maxima. local_max = np.where(max_f == img, 1, 0) return(local_max)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak_local_max_nD(img, size=(70,100,100), min_dist=0):\n def has_neighbor(peak, peak_list, min_dist):\n \"\"\"Find whether a peak already exists within minimum distance of this peak\"\"\"\n for testpeak in peak_list:\n if (distance.euclidean(peak, testpeak) < min_dist):\n ...
[ "0.6773827", "0.6690919", "0.6458444", "0.6428409", "0.63588756", "0.63492244", "0.60867316", "0.5958801", "0.5957955", "0.5957955", "0.5942641", "0.5919028", "0.59147114", "0.59119725", "0.5896226", "0.5873993", "0.5859534", "0.585771", "0.58529603", "0.5834837", "0.5811325"...
0.7622608
0
Find local maxima in an Ndimensional image. Generalizes scikit's peak_local_max function to three (or more) dimensions. Finds local maxima pixels within supplied window, determines centroids for connected pixels, and returns a mask of these centroid positions and a list of them.
def peak_local_max_nD(img, size=(70,100,100), min_dist=0): def has_neighbor(peak, peak_list, min_dist): """Find whether a peak already exists within minimum distance of this peak""" for testpeak in peak_list: if (distance.euclidean(peak, testpeak) < min_dist): return True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_max(img, size=(70,100,100)):\n # Apply a maximum filter.\n max_f = ndi.maximum_filter(img, size=size)\n # Find pixels that are local maxima.\n local_max = np.where(max_f == img, 1, 0)\n return(local_max)", "def detect_local_minima(arr, mask=None):\n # https://stackoverflow.com/questio...
[ "0.66987324", "0.6557603", "0.6429785", "0.6264377", "0.6144342", "0.6073965", "0.60014975", "0.5999285", "0.5990882", "0.5922203", "0.58585465", "0.5762706", "0.57241493", "0.5674644", "0.5631021", "0.56297046", "0.5585459", "0.5563584", "0.5530211", "0.5523302", "0.54643947...
0.7620194
0
Find whether a peak already exists within minimum distance of this peak
def has_neighbor(peak, peak_list, min_dist): for testpeak in peak_list: if (distance.euclidean(peak, testpeak) < min_dist): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_star(peaks,data):\n star = 0\n for i in peaks:\n max = data[i]\n if i<3 or i+4>data.size:\n continue\n mean = data[i-3:i+4].mean()\n if (max-mean)<0.1*max:\n star += 1\n if star*2>peaks.size:\n return True\n else:\n return False"...
[ "0.68856263", "0.67085063", "0.661296", "0.64169824", "0.6386411", "0.63811004", "0.6263147", "0.61525476", "0.61505425", "0.6147958", "0.6141748", "0.5985908", "0.59684527", "0.5882537", "0.5881153", "0.5871335", "0.58124405", "0.5790305", "0.5758674", "0.57463706", "0.57410...
0.7321443
0
Find the centroid of an object in a labelmask.
def get_object_centroid(labelmask, id): # Get coordinates coords = np.where(labelmask == id) # Find mean of each coordinate, remove negatives, make int. return tuple([int(np.mean(x)) for x in coords])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_region_centroid(mask, region):\n coords = np.column_stack(np.where(mask == region))\n coords = np.apply_along_axis(np.mean, 0, coords).round()\n coords = np.uint8(coords)\n return(coords)", "def test_centroids_mask():\n data = np.ones((2, 2)).astype(np.float)\n mask = [[False, False], [...
[ "0.70427525", "0.70268345", "0.6953521", "0.6945045", "0.6945045", "0.6806543", "0.67117083", "0.6665306", "0.6491123", "0.64543384", "0.64200026", "0.64151275", "0.6405747", "0.6400514", "0.63913816", "0.6325185", "0.63181746", "0.631281", "0.62963724", "0.6282911", "0.62579...
0.8631993
0
Find the centroid of an object in a labelmask.
def get_object_centroid(labelmask, id): # Get coordinates coords = np.where(labelmask == id) # Find mean of each coordinate, remove negatives, make int. return tuple([int(np.mean(x)) for x in coords])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_region_centroid(mask, region):\n coords = np.column_stack(np.where(mask == region))\n coords = np.apply_along_axis(np.mean, 0, coords).round()\n coords = np.uint8(coords)\n return(coords)", "def test_centroids_mask():\n data = np.ones((2, 2)).astype(np.float)\n mask = [[False, False], [...
[ "0.7041161", "0.702647", "0.6952047", "0.6944651", "0.6944651", "0.6804814", "0.67120415", "0.6666086", "0.6491608", "0.6454104", "0.6420789", "0.64144975", "0.640557", "0.63996035", "0.6391778", "0.6324928", "0.6318062", "0.6312746", "0.62966806", "0.6283854", "0.6257303", ...
0.86316955
1
Apply morphological functions to a labelmask.
def labelmask_apply_morphology(labelmask, mfunc, struct=np.ones((2,2,2)), expand_size=(1,1,1), **kwargs): # Expand the objects in the original mask to provide a "lookup" mask for # matching new objects to labels. lookupmask = ndi.maximum_filter(labelmask, expand_size) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, mask):\n mapping = self.calculate_mapping(mask)\n return self.apply_mapping(mask, mapping)", "def apply_mask(binary, mask_dict):\n result = \"\"\n for i, val in enumerate(binary):\n if mask_dict[i] in ('X', '1'):\n result += mask_dict[i]\n else:\n ...
[ "0.62201464", "0.6167879", "0.614978", "0.6043794", "0.58976614", "0.57824636", "0.57388145", "0.573605", "0.5669586", "0.5631029", "0.55734056", "0.5479389", "0.5475618", "0.5427618", "0.54106367", "0.53985476", "0.53582215", "0.5352608", "0.5342226", "0.531901", "0.52984774...
0.7854838
0
Make mesh grid for last n dimensions of an array Makes a meshgrid with the same shape as the last n dimensions of input arraylike object.
def mesh_like(arr, n): if (n > arr.ndim): raise ValueError('n is larger than the dimension of the array') # Make vectors of linear ranges for each dimension. vectors = [] for i in reversed(range(1, n+1)): a = np.arange(0, arr.shape[-i]) vectors.append(list(a)) # Make meshgrid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makegridnd(meshsize, dimension):\n x = np.meshgrid(*[np.linspace(MIN_POINT_PRECISION, 1,meshsize) for d in range(dimension)])\n mesh = np.asarray(x)\n total = np.sum(mesh,axis=0)\n plane_mesh = mesh[:,np.isclose(total,1.0,atol=1e-2)]\n\n return plane_mesh", "def nd_grid(*xg):\n grid_shape =...
[ "0.6201839", "0.60844994", "0.60239863", "0.60239863", "0.60239863", "0.60208017", "0.5992231", "0.5983395", "0.5957054", "0.5863167", "0.57123137", "0.56535494", "0.5639195", "0.55746883", "0.555606", "0.5555215", "0.5534478", "0.552817", "0.54637504", "0.5454016", "0.545089...
0.6645406
0
Find a background (value=0) pixel in a mask. Searches for a background pixel in a mask, defined as a pixel with value 0. Background pixel is chosen at random from among all 0 pixels.
def find_background_point(mask): zerocoords = np.where(mask == 0) i = np.random.randint(0,len(zerocoords[0])) coord = zerocoords[0][i] for n in range(1, len(zerocoords)): coord = np.append(coord, zerocoords[n][i]) return tuple(coord)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chooseRandPixel(mask):\n array = np.transpose(np.nonzero(mask)) # Get the indices of nonzero elements of mask.\n index = random.randint(0,len(array)-1) # Select a random index\n return array[index]", "def clean_mask(mask, background=0):\n kernels = [\n np.array([[ 1, -1, -1], [-1, 1, -1],...
[ "0.7012101", "0.63900024", "0.6272139", "0.61467755", "0.5984164", "0.5957396", "0.5819784", "0.58184606", "0.5760389", "0.5739316", "0.5737187", "0.56919", "0.56675345", "0.56653273", "0.56641465", "0.5645335", "0.5630077", "0.5629339", "0.5599537", "0.5579547", "0.5567698",...
0.738801
0
Relabel labelmask to set background to 0 and object IDs to be linearly ascending from 1.
def relabel_labelmask(labelmask, preserve_order=True): mask = np.copy(labelmask) # Get all object labels and their counts. labels, counts = np.unique(mask, return_counts=True) # Get the indexes of sorted counts, descending. ordered_indexes = np.argsort(counts)[::-1] # Set largest object as backg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _relabel(labels, minval=0, bgval=None):\n\n labels = np.unique(labels, return_inverse=True)[-1] + minval\n if bgval is not None:\n labels[labels == minval] = bgval\n return labels", "def label_to_mask(labels):\n # get the image size\n h, w = labels.shape\n\n # build a color to label ...
[ "0.7216211", "0.6909463", "0.6521286", "0.65192693", "0.65184855", "0.6427828", "0.6366801", "0.6330727", "0.61862487", "0.6171004", "0.61278653", "0.6112974", "0.61062664", "0.6094726", "0.60901254", "0.6066633", "0.6057654", "0.6008766", "0.60027987", "0.598461", "0.5973913...
0.82281446
0
Sort the items of a list by the frequency with which they occur
def sortfreq(x, descending=True): # Get unique items from list and their frequencies of occurence (counts). items, counts = np.unique(x, return_counts=True) # Get ordered indexes by sorting counts. if (descending): ordered_indexes = np.argsort(counts)[::-1] else: ordered_indexes = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ysort(L):\r\n return sorted(L, key=lambda x: x.freq)", "def find_the_frequency(the_list):\n\n freq = {}\n\n for word in the_list:\n if word not in freq:\n freq[word] = 1\n else:\n freq[word] += 1\n\n freq_list = sorted(freq.items(), key=lambda x: x[1], reverse=...
[ "0.74924433", "0.7188345", "0.7155382", "0.69913626", "0.6987749", "0.698284", "0.6797903", "0.6723372", "0.662392", "0.66192883", "0.6593263", "0.6586405", "0.6550548", "0.65173155", "0.65109074", "0.6472704", "0.6419932", "0.63889474", "0.63800836", "0.6354136", "0.63451105...
0.7306597
1
Read all TIFF files in a folder into an ndarray.
def read_tiff_folder(tif_folder): # Compile files that are files and have .tif extension (case-insensitive). tif_files = [f for f in listdir(tif_folder) if (isfile(join(tif_folder, f)) and (os.path.splitext(f)[1][0:4].upper() == '.TIF'))] # Sort the files: asciibetical sorting produces files a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_local(path):\n files = os.listdir(path)\n imgs = []\n for f in files:\n if f.endswith(\".tiff\") or f.endswith(\".tif\"):\n img = Image.open(os.path.join(path, f))\n imgs.append(np.array(img))\n return imgs", "def _load_multipage_tiff(path):\n return np.array(...
[ "0.7634265", "0.6892426", "0.68835694", "0.68317413", "0.6678273", "0.6654947", "0.6511431", "0.63753", "0.6343997", "0.62188447", "0.6216351", "0.61895293", "0.6172195", "0.6143361", "0.6139656", "0.6127509", "0.6108862", "0.6086439", "0.6077641", "0.6061779", "0.60412186", ...
0.7535456
1
Read a czi file into an ndarray
def read_czi(filename, trim=False, swapaxes=True): stack = czifile.imread(filename) stack = np.squeeze(stack) # Trim off last frame if trim: stack = stack[0:stack.shape[0]-1] if (swapaxes): stack = np.swapaxes(stack,0,1) return stack
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadz(file):\n y = np.load(file)\n return coo_matrix((y['data'],(y['row'],y['col'])),shape=y['shape'])", "def asc_to_ndarray(fname, path='./'):\r\n header, headlines = get_header(fname, path)\r\n f = file(path+fname,'r')\r\n \r\n for i in xrange(headlines):\r\n f.readline() \r\n ...
[ "0.6969091", "0.6584774", "0.6476092", "0.64466226", "0.63954574", "0.63753706", "0.6356232", "0.6354777", "0.6304026", "0.6278996", "0.62753505", "0.62701184", "0.622903", "0.6210606", "0.61813253", "0.61736315", "0.61398447", "0.61271214", "0.6124008", "0.61076677", "0.6101...
0.70002306
0
Read a list of 5d czi files and combine into single stack
def read_concat_5dczi(czis): stacks = [] for czi in czis: stacks.append(read_czi(czi, True)) stack, frames = concatenate_5dstacks(stacks) return stack, frames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_resized_image_stack(flist):\n\n #Initialize the output\n with BioReader(flist[0]['file']) as br:\n X = br.x\n Y = br.y\n \n if len(flist) > OPTIONS['n_sample']:\n N = OPTIONS['n_sample']\n samples = np.random.permutation(len(flist)).tolist()\n flist = [flist[...
[ "0.6211564", "0.616225", "0.6066706", "0.6054547", "0.6048386", "0.5954382", "0.5949909", "0.5795674", "0.5781913", "0.57127887", "0.56931484", "0.56629384", "0.5659785", "0.5639395", "0.5636547", "0.5631406", "0.56137854", "0.5611375", "0.55940217", "0.55660045", "0.5550378"...
0.80589706
0
Plot a parameter series in a specified range User supplies a plotting function that takes a single integer input as a parameter. plot_ps builds axes to display all parameter values and serially calls plot function on them.
def plot_ps(func, span=range(0,8)): nplots = len(span) ax = qax(int(len(span))) for pln in range(0, len(span)): plt.sca(ax[pln]) func(span[pln])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(\n self,\n function: Callable[[float], float],\n x_range: Sequence[float] | None = None,\n use_vectorized: bool = False,\n **kwargs,\n ):\n\n t_range = np.array(self.x_range, dtype=float)\n if x_range is not None:\n t_range[: len(x_range)] = x...
[ "0.7033721", "0.6661905", "0.6465929", "0.6342475", "0.6339204", "0.6272715", "0.6263497", "0.6233453", "0.6211613", "0.6186772", "0.6164299", "0.61561924", "0.61556005", "0.6133236", "0.6124454", "0.6091085", "0.6039477", "0.6011251", "0.5986883", "0.59812313", "0.5977569", ...
0.6764823
1
Make image stack for viewing MS2 spot raw data Given spot coordinates and original movie, builds an image stack with spot ID on the first dimension and raw data centered on the spot in the remaining three. In cases where the window exceeds the boundaries of the image, the remaining portions of the frame will be filled ...
def spot_movies(stack, spot_data, channel=0, len_ij=15, len_z=7, fill=np.nan, view=True): def adjust_coords(c, rad, frame_max, stack_max): """Adjusts coordinates to account for spots located at the edge of the stack such that the window will cross the boundary of the image. For a given axi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box_spots(stack, spot_data, max_mult=1.3, halfwidth_xy=15, \n halfwidth_z=8, linewidth=3, shadows=True):\n if (stack.dtype != 'uint16'):\n raise ValueError(\"Stack must be uint16.\")\n boxstack = np.copy(stack)\n hival = max_mult * boxstack.max()\n if (hival > 65535):\n h...
[ "0.6140449", "0.6009828", "0.5931565", "0.5780583", "0.5499807", "0.5483682", "0.54345703", "0.53908765", "0.5380058", "0.53775024", "0.5374744", "0.5372332", "0.5369346", "0.53583455", "0.530282", "0.5286252", "0.5258763", "0.52389324", "0.52122176", "0.516102", "0.51435566"...
0.7163245
0
Filter objects in a labelmask for size
def labelmask_filter_objsize(labelmask, size_min, size_max): # Count pixels in each object. (labels, counts) = np.unique(labelmask, return_counts=True) # Select objects in desired size range, update filtered mask. labels_selected = labels[(counts >= size_min) & (counts <= size_max)] labelmask_filter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labelmask_filter_objsize(labelmask, size_min, size_max):\n # Count pixels in each object.\n (labels, counts) = np.unique(labelmask, return_counts=True)\n # Select and keep only objects within size range.\n labels_selected = labels[(counts >= size_min) & (counts <= size_max)]\n labelmask_filtered...
[ "0.8584848", "0.7376639", "0.6504473", "0.62520003", "0.6157457", "0.60588294", "0.6022145", "0.6022086", "0.60021436", "0.5992528", "0.5890197", "0.57996565", "0.5785461", "0.5783187", "0.5767887", "0.57465464", "0.5717619", "0.5717619", "0.57085717", "0.56595594", "0.563888...
0.8619889
0
Calculate circularity for and object in a labelmask
def object_circularity(labelmask, label): # Find z slice with most pixels from object. z, i, j = np.where(labelmask == label) zmax = mode(z)[0][0] # Select 2D image representing object's max Z-slice. im = np.where(labelmask[zmax] == label, 1, 0) # Calculate circularity from object perimeter and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labeled_mask(mask, cutoff=.5):\n mask = mask.reshape(mask.shape[0], mask.shape[1])\n lab_mask = skimage.morphology.label(mask > cutoff) \n \n # Keep only objects that are large enough.\n (mask_labels, mask_sizes) = np.unique(lab_mask, return_counts=True)\n if (mask_sizes < min_object_size...
[ "0.6031455", "0.5951858", "0.5870883", "0.58124626", "0.5787624", "0.5734116", "0.5711091", "0.5663622", "0.5651818", "0.5637015", "0.55883014", "0.5587712", "0.5546084", "0.55093914", "0.55044156", "0.54487556", "0.54463893", "0.54330647", "0.54255563", "0.54246575", "0.5424...
0.8800705
0
Normalize each Zslice in a Zstack to by dividing by its mean
def zstack_normalize_mean(instack): stack = np.copy(instack) stackmean = stack.mean() for x in range(0,stack.shape[0]): immean = stack[x].mean() stack[x] = stack[x] / immean * stackmean return(stack)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(X):\n # z-score\n mean = np.mean(X, axis=(0, 1, 2, 3))\n std = np.std(X, axis=(0, 1, 2, 3))\n # avoid dividing zero by adding a very small number\n X = (X - mean) / (std + 1e-7)\n\n return X", "def normalise_stack(stack):\n\n for index in range(stack.shape[2]):\n ...
[ "0.66206026", "0.64258534", "0.64018106", "0.6272859", "0.6252194", "0.6252194", "0.6110111", "0.60485095", "0.6030122", "0.6000584", "0.5990235", "0.59838045", "0.59838045", "0.59280694", "0.59000444", "0.58792233", "0.58690435", "0.58375883", "0.5837155", "0.5813349", "0.57...
0.78832215
0
Segment nuclei from a 3D imaging stack
def segment_nuclei3D_5(instack, sigma1=3, sigma_dog_small=5, sigma_dog_big=40, seed_window=(70,100,100), erosion_length=5, dilation_length=10, sensitivity=0.5, size_min=1e4, size_max=5e5, circularity_min=0.5, display=False): def smart_dilate(stack, labelmask, sensiti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_nuclei3D_monolayer(stack, sigma1=3, sigma_dog_big=15, \n sigma_dog_small=5, seed_window=(30,30), min_seed_dist=25, \n dilation_length=5, size_min=0, size_max=np.inf, display=False):\n # Make max projection on Z.\n maxp = stack.max(axis=0)\n # Filter with DoG to make nuclei into b...
[ "0.71486294", "0.67655337", "0.653055", "0.63148606", "0.62940663", "0.6006777", "0.59426606", "0.58408475", "0.57491934", "0.57410175", "0.5707425", "0.567195", "0.5659216", "0.5612804", "0.54714483", "0.5444925", "0.54367715", "0.5431306", "0.5427388", "0.53908044", "0.5389...
0.7065189
1
Dilate nuclei, then apply a threshold to the newlyadded pixels and only retains pixels that cross it. Change mask in place.
def smart_dilate(stack, labelmask, sensitivity, dilation_length): # Get mean pixel values of foreground and background and define threshold. bg_mean = np.mean(stack[labelmask == 0]) fg_mean = np.mean(stack[labelmask > 0]) t = bg_mean + ((fg_mean - bg_mean) * sensitivity) # Dilate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_nuclei3D_5(instack, sigma1=3, sigma_dog_small=5, sigma_dog_big=40, seed_window=(70,100,100),\n erosion_length=5, dilation_length=10, sensitivity=0.5, size_min=1e4, \n size_max=5e5, circularity_min=0.5, display=False):\n\n\n def smart_dilate(stack, labelmas...
[ "0.66913325", "0.64422685", "0.628367", "0.62743646", "0.6162741", "0.6144059", "0.61164874", "0.6095873", "0.59970486", "0.582894", "0.57689095", "0.57682997", "0.5714616", "0.56821644", "0.56392914", "0.5630825", "0.5630542", "0.5620643", "0.56147736", "0.55803084", "0.5566...
0.6849531
0
Segment nuclei from confocal nuclear monolayers Segment nuclei from nuclear monolayers, such as standard MS2 confocal stacks. Monolayers don't generally require 3D segmentation, so this function uses the max projection in Z to define the domain of each nucleus in XY.
def segment_nuclei3D_monolayer(stack, sigma1=3, sigma_dog_big=15, sigma_dog_small=5, seed_window=(30,30), min_seed_dist=25, dilation_length=5, size_min=0, size_max=np.inf, display=False): # Make max projection on Z. maxp = stack.max(axis=0) # Filter with DoG to make nuclei into blobs. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_nuclei3D_monolayer_rpb1(stack, sigma1=3, sigma_dog_big=15, \n sigma_dog_small=5, seed_window=(30,30), min_seed_dist=25, \n dilation_length=5, dilation_length_foci=10, size_min=0, \n circularity_min=0, size_max=np.inf, display=False):\n # Make max projection on Z.\n maxp = sta...
[ "0.600986", "0.58425176", "0.538828", "0.5275178", "0.5072713", "0.5072423", "0.5031248", "0.50053304", "0.49297604", "0.4926382", "0.49043727", "0.4892382", "0.48839113", "0.48501694", "0.4845695", "0.48417535", "0.48348972", "0.48221073", "0.4791869", "0.47911322", "0.47703...
0.64009005
0
Segment nuclei from confocal nuclear monolayers based on Rpb1 signal Segment nuclei using Rpb1 signal. The segment_nuclei3D_monolayer function runs into problems because of the strong Rpb1 foci (presumed histone locus bodies) that create problems in the gradient used as input for watershed segmentation. This function h...
def segment_nuclei3D_monolayer_rpb1(stack, sigma1=3, sigma_dog_big=15, sigma_dog_small=5, seed_window=(30,30), min_seed_dist=25, dilation_length=5, dilation_length_foci=10, size_min=0, circularity_min=0, size_max=np.inf, display=False): # Make max projection on Z. maxp = stack.max(axi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_nuclei3D_monolayer(stack, sigma1=3, sigma_dog_big=15, \n sigma_dog_small=5, seed_window=(30,30), min_seed_dist=25, \n dilation_length=5, size_min=0, size_max=np.inf, display=False):\n # Make max projection on Z.\n maxp = stack.max(axis=0)\n # Filter with DoG to make nuclei into b...
[ "0.6151274", "0.565694", "0.5269071", "0.49701405", "0.45479837", "0.45193237", "0.4483922", "0.44832158", "0.44486707", "0.4435307", "0.44346797", "0.43174776", "0.4278409", "0.4278219", "0.42735934", "0.41895118", "0.41799158", "0.41637263", "0.41567457", "0.41496977", "0.4...
0.70257014
0
Perform segmentation on a timeseries of 3D stacks Accepts a function that performs nuclear segmentation on a 3D image stack, calls this function on each frame of a 4D image stack, and returns a 4D nuclear mask. Individual time frames are independently segmented and labels are not connected between them.
def segment_nuclei_4dstack(stack, seg_func, **kwargs): # Segment first frame, initialize 4D labelmask. frame0 = seg_func(stack[0], **kwargs) labelmask = np.array([frame0]) # Segment subsequent frames, stack results together. for n in range(1, stack.shape[0]): print(n, end=' ') frame ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_nuclei3D_5(instack, sigma1=3, sigma_dog_small=5, sigma_dog_big=40, seed_window=(70,100,100),\n erosion_length=5, dilation_length=10, sensitivity=0.5, size_min=1e4, \n size_max=5e5, circularity_min=0.5, display=False):\n\n\n def smart_dilate(stack, labelmas...
[ "0.63560593", "0.6342845", "0.59947366", "0.5937562", "0.58145386", "0.57874197", "0.5714978", "0.5559475", "0.55079997", "0.54416966", "0.54246885", "0.5397451", "0.53814244", "0.531016", "0.52537036", "0.52524835", "0.52115023", "0.5184818", "0.5181062", "0.51775354", "0.51...
0.693505
0
Match labels of segmented structures between two labelmasks.
def update_labels(mask1, mask2): # Find the object in mask2 that has maximum overlap with an object in max1, # (as a fraction of the objects pixels in mask1) def get_max_overlap(mask1, mask2, label1): # Count overlapping pixels. labels, counts = np.unique(mask2[mask1 == label1], return_count...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_segments(segs, truths, detected):\n for seg in segs:\n for truth in truths:\n if time_overlap(seg, truth): \n seg[\"label\"] = truth[\"label\"]\n for det in detected:\n if time_overlap(seg, det):\n if ...
[ "0.6957109", "0.62531114", "0.60568833", "0.5868811", "0.5844121", "0.583243", "0.58223724", "0.58218205", "0.58092034", "0.5799262", "0.5702313", "0.56317323", "0.5619657", "0.5604046", "0.55833405", "0.5563465", "0.55599004", "0.5557725", "0.5530411", "0.5528488", "0.549651...
0.68187106
1
Match labels in a labelmask to masks from previous frames Takes a stack of nuclear masks, for each frame, walk backward in time looking for segmented nuclei in previous frames that correspond to nuclei in the new frame. Default is to use update_labels function to do comparison of two masks, but this can be changed. Nuc...
def connect_nuclei(maskstack, max_frames_skipped=2, update_func=update_labels): # Initialize blank mask. connected_mask = np.zeros_like(maskstack) # Add first frame. connected_mask[0] = maskstack[0] # Walk through subsequent frames, connecting them to previous frames. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_labels(mask1, mask2):\n # Find the object in mask2 that has maximum overlap with an object in max1,\n # (as a fraction of the objects pixels in mask1)\n def get_max_overlap(mask1, mask2, label1):\n # Count overlapping pixels.\n labels, counts = np.unique(mask2[mask1 == label1], re...
[ "0.6420432", "0.5720513", "0.56855166", "0.56837654", "0.5676429", "0.5663203", "0.5624392", "0.5608341", "0.5602957", "0.55358654", "0.55145895", "0.5487304", "0.5482341", "0.5421463", "0.53743964", "0.5353462", "0.53521025", "0.53344667", "0.5318748", "0.5318057", "0.530485...
0.65315384
0
Find nearest frames containing nucleus before and after frame missing nucleus
def find_surrounding_frames(frame, frames_with): # If frame is missing from the beginning, return initial frame twice. if (frame < frames_with[0]): return frames_with[0], frames_with[0], frames_with[0] - frame # If frame is missing from the end, return last frame twice. elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extractFrames_(self, wordRulesFlag):\n\t\t#pdb.set_trace()\n\t\tsimplifyTree(self.srcTree)\n\t\tsimplifyTree(self.tgtTree)\n\n\t\tsDic, tDic = {}, {}\n\t\tframeSet = set() \n\t\tfor sSubtr in self.srcTree.subtrees():\n\t\t\tif sSubtr.height() <= 2:\n\t\t\t\tcontinue\n\n\t\t\tsTreePos = sSubtr.treeposition()\n...
[ "0.6090279", "0.56059974", "0.55594534", "0.5536739", "0.5533315", "0.5436862", "0.5374285", "0.5369106", "0.5363039", "0.53297997", "0.5308122", "0.5295648", "0.5294328", "0.5284594", "0.52580917", "0.5246476", "0.52261055", "0.52245086", "0.52196157", "0.51992136", "0.51830...
0.6055499
1
Use position of nucleus in preceding and succeeding frames to interpolate nucleus in missing frame
def interpolate(mask, newmask, label, frame, frames_with, coords, frame_before, frame_after): # Find centroid of nucleus in before and after frames, take the mean centroid for # the position of interpolated nucleus. centroid_before = get_object_centroid(mask[frame_before], label) centroi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate_next(self):\n\n # Get valid ensembles\n valid_ens = self.valid_data[0, :]\n\n # Process ensembles\n n_ens = len(valid_ens)\n\n for n in np.arange(0, n_ens-1)[::-1]:\n if not valid_ens[n]:\n self.u_processed_mps[n] = self.u_processed_mps[n...
[ "0.5899253", "0.58183825", "0.5697374", "0.5619849", "0.5558874", "0.5501355", "0.54089856", "0.53862375", "0.5324794", "0.5320472", "0.5313652", "0.52825856", "0.52782303", "0.5274222", "0.5257802", "0.5241171", "0.5236466", "0.5228721", "0.51967144", "0.51866394", "0.518280...
0.65932935
0
Filter MS2 spot fit data based on fit parameters Select spots based on "peakiness", measured as the ratio of the height to width of the fit. Currently uses the mean of the x and ywidths.
def filter_ms2fits(stack, fit_data, channel=1, peakiness=4.5): fit_data = fit_data.copy() for t in range(0, len(fit_data)): frame_data = fit_data[t] frame_med = np.median(stack[channel, t]) xy_width_means = np.mean(frame_data[:,5:7], axis=1) peak_heights = frame_data[:,3] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_peakiness(spot_data):\n return spot_data[3] / np.mean((spot_data[5], spot_data[6]))", "def splitDetectorPeakInfo(self):\r\n\t\tsplit_raw_min = np.amin(self.splitData)\r\n\t\tsplit_min = split_raw_min - self.splitBaseline\r\n\t\t\t\t\r\n\t\tsplit_raw_max = np.amax(self.splitData)\r\n\t\tsplit_max =...
[ "0.5881879", "0.5682952", "0.55664706", "0.5398089", "0.53972554", "0.5350966", "0.5323197", "0.5284386", "0.5274758", "0.52689517", "0.5232879", "0.5231886", "0.5214516", "0.5206664", "0.52043647", "0.51843774", "0.5128229", "0.5120721", "0.50966287", "0.50920933", "0.508343...
0.6852333
0
Connect detected MS2 spots in a single movie through multiple time frames. Spots detected in new frame are connected to spots in previous frames if they are within specified distance (max_jump). Spots can "disappear" for a number of frames defined by max_frame_gap. Spots that cannot be connected to spots from prior fra...
def connect_ms2_frames(spot_data, nucmask, max_frame_gap=1, max_jump=10, scale_xy=1, scale_z=1): def initialize_new_spot(new_spot_data, connected_data): """Initialize new spot with next numeric ID and entry in connected_data.""" if (connected_data.keys()): new_id = max(connected_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_clip(clip, distance_threshold, max_duration, fps=None, logger=\"bar\"):\n N_pixels = clip.w * clip.h * 3\n\n def dot_product(F1, F2):\n return (F1 * F2).sum() / N_pixels\n\n frame_dict = {} # will store the frames and their mutual distances\n\n def distance(t1, t2):...
[ "0.55474365", "0.55036896", "0.53912634", "0.5274397", "0.50472456", "0.50361794", "0.5018226", "0.5002714", "0.49901772", "0.49849626", "0.49625355", "0.49617618", "0.4915827", "0.49118632", "0.49091548", "0.49075747", "0.48717386", "0.48542944", "0.48492807", "0.4821987", "...
0.7447291
0
Initialize new spot with next numeric ID and entry in connected_data.
def initialize_new_spot(new_spot_data, connected_data): if (connected_data.keys()): new_id = max(connected_data.keys()) + 1 else: new_id = 1 connected_data[new_id] = np.expand_dims(new_spot_data, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._idx = Node.index\n Node.index += 1", "def init(self):\n self.padre = self.id\n self.sinVisitar = [] \n self.visited = False\n print (\"inicializo algoritmo\")\n for i in range (len(self.neighbors)): #De esta forma se pueden mani...
[ "0.5418677", "0.5404944", "0.5365731", "0.5343149", "0.5334733", "0.53292894", "0.53161687", "0.53161687", "0.5288859", "0.5250205", "0.52446026", "0.5231255", "0.52251077", "0.52228373", "0.52228373", "0.5191674", "0.51554686", "0.51548076", "0.5136638", "0.51238644", "0.511...
0.7496566
0
Determine peakiness for a spot from height and mean of x and y widths
def get_peakiness(spot_data): return spot_data[3] / np.mean((spot_data[5], spot_data[6]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak_pixel(data, x0=0.0, dx=1.0, axis=0):\n x_max = np.argmax(data, axis=axis)\n y_max = np.max(data, axis=axis)\n return x0 + dx * x_max, 0.5 * dx, y_max", "def extractPeak( image, nSizeX, nSizeY, nMaxSize, nMaxNbr = 5, nErrorValue = -1 ):\n blobs = []; # will contain the center of the blob and ...
[ "0.6414104", "0.6406288", "0.62860376", "0.6219498", "0.6204557", "0.6204557", "0.61269903", "0.61190575", "0.6079868", "0.6018854", "0.6013987", "0.6006203", "0.59839356", "0.5942573", "0.59417504", "0.5930504", "0.59203225", "0.59121776", "0.59119344", "0.58728254", "0.5864...
0.65471804
0
Walk back one frame at a time within limit set by maximum gap, search for a nearest spot that is within the maximum allowable jump, handle duplicates, add connected points to connected_data.
def update_spot(this_spot_data, connected_data, scale_z, scale_xy, max_frame_gap, t): this_spot_coords = (this_spot_data[2:5]) # Walk back one frame at a time. for t_lag in range(1, max_frame_gap + 2): if ((t - t_lag) >= 0): # Get nearest spot in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_ms2_frames(spot_data, nucmask, max_frame_gap=1, max_jump=10, \n scale_xy=1, scale_z=1):\n def initialize_new_spot(new_spot_data, connected_data):\n \"\"\"Initialize new spot with next numeric ID and entry in connected_data.\"\"\"\n if (connected_data.keys()):\n new_id = m...
[ "0.60825896", "0.54369926", "0.53995484", "0.5332382", "0.53277975", "0.5276825", "0.5246788", "0.5236791", "0.5223959", "0.52116793", "0.5205012", "0.5176807", "0.51723677", "0.5154031", "0.51372254", "0.51269925", "0.5117214", "0.5112241", "0.51113963", "0.5089505", "0.5085...
0.60334367
1
Append the frame number (t) and nucleus ID to front of spot_data
def add_time_nuc(this_spot_data, t, nucmask): # Combine frame number and zxy to for coordinate tuple, accounting for out-of-bounds z-coordinates due to re-focus adjustments. spot_coords = tuple(np.concatenate(( [t], #[clamp(this_spot_data[0], 0, nucmask.shape[-3] - 1)], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addTrack(self, t, id_num):\n # Add a new sequence\n self.id_seq.append([])\n self.id_seq[self._n_cell].append(id_num)\n\n # Include the time it was added\n self.t_appearance.append(t)\n\n # Insert it in control variables\n self.dict_track[t][id_num] = self._n_c...
[ "0.59227896", "0.5258827", "0.5251117", "0.5206328", "0.5150625", "0.50621414", "0.5040453", "0.5003244", "0.48670295", "0.48512733", "0.4798237", "0.4784199", "0.47767293", "0.47649488", "0.4754693", "0.472059", "0.47103143", "0.47102693", "0.46926743", "0.4685924", "0.46816...
0.66926765
0