content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def _jsonify(vals): """문서 출력을 위해 파이썬 값을 JSON 형태로.""" _vals = [] for val in vals: if type(val) is bool: _vals.append(str(val).lower()) else: _vals.append(val) return _vals
d9240bc43f1ca9a31152b12a94fc1ba1980e2b82
3,597,323
def order_matrix(original, sortd, sigma=0.1): """Apply a simple RBF kernel to the difference between original and sortd, with the kernel width set by sigma. Normalise each row to sum to 1.0.""" diff = (tf.reshape(original, (-1, 1)) - tf.reshape(sortd, (1, -1))) ** 2 rbf = tf.exp(-(diff) / (2 * sigma ** ...
4deac4093f6d3440e094a0a4dfcc83aef08cae0e
3,597,324
def load_ref_schema(ref_schema_uri): """ loads a referenced schema """ sub_schema = generate_schema_name_from_uri(ref_schema_uri) return import_schema_to_json(sub_schema)
3f888f40fc96d4bae0cc8b0a8982213973069c97
3,597,326
def by_tid( move_data, tid_=None, label_tid=TID, filter_out=False, inplace=False ): """ Filters trajectories points according to a specified trajectory tid. Parameters ---------- move_data : dataframe The input trajectory data tid_ : String Specifies the number of the tid u...
2400df83ac905be3f05080c5cf948c80d2ee8f34
3,597,327
def sph_dot(theta1, theta2, delta_phi): """ Compute the dot product of two unit vectors in spherical coordinates """ return np.sin(theta1) * np.cos(delta_phi) * np.sin(theta2) + np.cos(theta1) * np.cos(theta2)
8e28f015a0ff82b3f5be2d8d9d6e87016e411e63
3,597,328
def TTF_WasInit(): """Checks if the TTF engine is initialized. This function can be used before calling :func:`TTF_Init` to avoid initializing twice in a row, or to determine if need to call :func:`TTF_Quit`. Returns: int: The number of times :func:`TTF_Init` has been called without ...
b30b1ab7b9c5946dae61d09f26246b7c5134d9f0
3,597,329
def poly_from_expr(expr, *gens, **args): """Construct a polynomial from an expression. """ opt = options.build_options(gens, args) return _poly_from_expr(expr, opt)
8cca85d539104a34e16bf7fc89ac311b3c4220e6
3,597,330
from typing import Dict from typing import Any def get_metrics(database: Database): """Get all metrics.""" metrics: Dict[str, Any] = {} reports = get_reports(database) for report in reports["reports"]: for subject in report["subjects"].values(): metrics.update(subject["metrics"]) ...
2716d2716e194e457e3d548ed752dcde00197b78
3,597,331
def move_axes_to_end(mx_orig,axes): """ Moves the listed axes to the end. """ mx = mx_orig mx_axes = list(range(mx.ndim)) for i in range(len(axes)): # Finding the axis ind = mx_axes.index(axes[i]) # Move from to the end mx = np.moveaxis(mx,ind,-1) # Following ...
6a100f58a20abe440a7c2bb1ab2243d1a4f4fd74
3,597,332
def split(data, num_or_size_splits, split_axis=0, num=None): """ Splits a tensor into sub tensors. Args: data: Tensor. num_or_size_splits: Integer or list. Used to split data. split_axis: Integer. The dimension along which to split. Returns: Tuple of tensor, counts of w...
0d198ae44edafc6cadcbf949401329804483ea21
3,597,333
def _read_hc(directory): """Read the hc file to get the HPI info and to prepare for coord trans.""" fname = _make_ctf_name(directory, 'hc', raise_error=False) if fname is None: logger.info(' hc data not present') return None s = list() with open(fname, 'rb') as fid: while(...
4768754342e9537db44239f5d6c1fc270690da48
3,597,335
def find_prev_bn(bn_module, relu_attached, graph, bottoms, bot): """ Find the batchnorm layers for calculation of expectation or min/max value of input activation. And find branching type(one, add, or cat). """ bot_tmp = list(zip(bot, [str(x) for x in range(len(bot))])) type_tmp = {} targ_wi...
3c47d83329bf8334f56d02aaa9928befac4408a7
3,597,336
def get_boundary_locations(size, sector_size, stride): """Get a list of 1D sector boundary positions. Args: size: length of the full domain. sector_size: length of the sector. stride: how far each sector moves to the right Returns: boundaries: a list of 1D sector boundary pos...
ae6a2b6461f2c823f0129e7f691d63830834cbe7
3,597,337
def estimate_closest_point(dataset, lons, lats): """Estimate the closest grid point to an array of lat/lons using a index file created by make_mapping_file above :param xarray dataset: dataset :param numpy array or list: lons :param numpy array or list: lats return: numpy array of indexes: i...
a3687348489adad8e8e5894409a44581172479f3
3,597,338
def index(request): """Displaying the index page""" post_list = Post.objects.order_by('-pub_date').all() paginator = Paginator(post_list, 6) page_number = request.GET.get('page') page = paginator.get_page(page_number) return render( request, 'index.html', {'page': page, '...
dd1f9e1dad5cd22eafb93fc964864ff6c164ae15
3,597,339
def get_paging_start_end(page, numberMatches): """Get tuple (iStart, iEnd)""" iStart = (page-1)*numberMatches iEnd = iStart+numberMatches fields = (iStart, iEnd) return fields
bb2b89fd2f9b6c18f134cfabc5e56da682688b55
3,597,340
def create_kcg(documents, big_graph, dataset_name=None): """ :param documents: list of documents, each document is taken as a string :return: nodes (a list of nodes including{'keyword', 'feature'}); node['feature'] is the average of its sentences' SBERT embeddings, and adjacency ...
bf0a5b775d1b81133a3c400ab4c76e76fa289762
3,597,341
from typing import Union from typing import Optional from typing import Sequence def subset_gridpoint( da: Union[xarray.DataArray, xarray.Dataset], lon: Optional[Union[float, Sequence[float], xarray.DataArray]] = None, lat: Optional[Union[float, Sequence[float], xarray.DataArray]] = None, start_date: ...
174f1f3a46d0058b6dd53f73c2b0d500660ed28f
3,597,343
def random_shear(image, max_lambda, bbox=None, prob=0.5): """Applies random shear in either the x or y direction""" shear_lambda = tf.random.uniform([], minval=-max_lambda, maxval=max_lambda, dtype=tf.float32) image_shape = tf.cast(tf.shape(image), tf.float32) image_height, image_width = image_shape[0],...
59f1a8b6290237beb5eb7f96b0c0b8a8544092a9
3,597,345
import random def random_strategy(D): """ Retourne un nombre entre 1 et D correspondant à une stratégie aléatoire utilisée comme baseline ---------------------------------------------------- Args: - D : nombre maximum de dés """ return random.randint(1,D)
280f3deff20e0f4e96f7cbd8f3ea4d4ae671aba8
3,597,346
def next_setting(hass, entity_id=None): """ Returns the datetime object representing the next sun setting. """ entity_id = entity_id or ENTITY_ID state = hass.states.get(ENTITY_ID) try: return str_to_datetime(state.attributes[STATE_ATTR_NEXT_SETTING]) except (AttributeError, KeyError): ...
e40f4a3ab1e2673dc57a745d1474791bca52df4d
3,597,347
def _get_rate_via_base(rates, target): """ :param: rates: A set/tuple of two base Rate instances :param: target: A string instance of the currency to convert to Both target and source are not a base currency - actual rate could be calculated via their rates to base currency. For example: 7.84 ...
705ae5339cbb62da315898ae4e481f8c25edc2f3
3,597,348
def read_our_csv(startOfPath, netVers): """ Read in the edge list of a graph. In our case we created the graphs in R and output the edgelists in a certain manner with file names following a certain convention. This function simply reads in csvs formatted in that specific way, with the file paths f...
bcea9c8b622066f5d64ed46db5fce66a76edb05c
3,597,349
from typing import Any def coro_as_method_coro(coro: CoroutineFunction) -> CoroutineMethod: """Wrapper function to coro""" @wraps(coro) async def method(*args, **kwargs) -> Any: return await coro(*args, **kwargs) return method
38cebe8b7ef7e60f619d8157de8db5b4dd94a3cd
3,597,350
def fix_coordinate_system(value: float, min_value: float = 0.0, max_value: float = 1.0): """ In case of Out-Of-Range values: fix the rounding error """ value = min(value, max_value) value = max(value, min_value) return value
f692d6e94ed61be5bd25207bf787267e921a2f08
3,597,351
def solution_decomposition(xx, obj, success): """ Decomposition of objective functions :param xx: Solution :param obj: Objective value :param success: Success or not :return: """ T = 24 ng = 54 result = {} result["success"] = success result["obj"] = obj if success: ...
c786a2a610d2bbe39a81bc23417f7e4494370086
3,597,352
def setup(app): """Sets the extension up""" from docutils.parsers.rst import roles # pylint: disable=wrong-import-order roles.register_local_role("template-fields", partial(template_field_role, app)) return {"version": "builtin", "parallel_read_safe": True, "parallel_write_safe": True}
f83c702744b257d4726dd74f1ce15b3e1ca1b088
3,597,353
from typing import List def setup(client: Client) -> List[BasePlugin]: """Creates an instance of the ChallstrHandler plugin and returns it. Args: client (Client): A reference to the client. Returns: List[BasePlugin]: A list containing the ChallstrHandler plugin. """ return [Chall...
c3453897d48ade1144b12bb92f2db792ec620a9c
3,597,354
def from_dero(value_in_dero): """Convert number in dero to smallest unit""" return int(value_in_dero*10**12)
6a27469721cbd9851312f73a971caf279c95ffa8
3,597,355
def plainFlag_Task(values,*args): """ This method is identical to plainFlag but for the task decorator. """ flag = plainFlag(values,*args) return flag
ba36bff70a19bf0818ce9daeb773530500e0a05e
3,597,356
def tasks_widget(doc, notifier, cmap): """Defines the tab for the task plot""" task_plot = TasksPlot(doc, cmap=cmap) notifier.subscribe(task_plot.set_collection) return task_plot.layout()
7948e553093965017a831d8d9228610d8eca67c3
3,597,357
def _subproc(cmd): """ call subprocess `cmd` and get its output >>> _subproc(['echo', 'foo']) 'foo' """ try: p = subprocess.Popen( cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, env={"PATH": PATH}) ret, _dummy = p.communicat...
4dbfbb353f64b9091d19a83b179ce57b7a3a7930
3,597,358
def extract_gates_T1_from_result_GST(result, gate_operation_time): """Calculates the T1 from the extracted diagonal decay out of the result of GST analysis. Which is given as a number e.g. 0.001, from which T1 can be calculated. Which is done by: (1-decayrate)**N=e**(N*ln(1-decayrate)), where N is the n...
4b8be32b7d7c950578e6d719b7355b60fe089ce4
3,597,359
def rospack_depends(pkg): """ @param pkg: package name @type pkg: str @return: A list of the names of the packages which pkg depends on @rtype: list """ return rospackexec(['deps', pkg]).split()
084a6ccced5ecd7b6e03c298249a18de77174b3d
3,597,360
def check_duplicates(df, column): """ Function to check no.of values that occur more than once. Parameter --------- df : DataFrame to be processed. column : column in df for which we want to find duplicate values. """ assert_cols_in_df(df, columns_provided=[column], columns_df=df.co...
ef9a86d196122f6be1adec6aa3654d23da0baede
3,597,361
def get_batch_topk(candidate_starts, candidate_ends, candidate_scores, topk_ratio, text_len, max_sentence_length, sort_spans=False, enforce_non_crossing=True): """ Args: candidate_starts: [num_sentences, max_num_candidates] candidate_mask: [num_sentences, max_num_candidates] topk_rati...
66957cfb06499588d6c9b7e31bb4e6fc4743edf0
3,597,362
def t1t2shuffle_ex(angle_ex_rad, angles_rad, TE, TRs, M0, T1, T2, B1=1.): """Same as t1t2shuffle, with arbitrary RF excitation flip angle""" T = angles_rad.size URs = TRs - (T+1)*TE # T + 1 to account for fast recovery fi = epg.FSE_signal_ex(angle_ex_rad, angles_rad, TE, T1, T2, B1) Ej = T1_recov...
66c2078ba9c93bc997f7ade85ca087275e95b84a
3,597,363
def dump_glyphs(font): """Dump info for each glyph in a font Parameters ---------- font: DFont Returns ------- DFontTableIMG Each row in the table is represented as a dict. [ {'glyph': A, 'area': 1000, string': 'A', 'description': "A | ()", 'features': ...
d16109600a60e9cd105ff1844095833b86a5a8a3
3,597,364
from typing import List def _hash_layer(layer: List[HashedEntry], last_index: int) -> List[HashedEntry]: """ Takes a layer as a list of hashed entries and the last index as an int and returns a new layer. """ new_len = (len(layer) + 1) // 2 new_layer: List[HashedEntry] = [] for i in range(new_len): ...
1ce5b76928313420b8b8f0b6c1f7e9fd0358b0a2
3,597,365
def pixel_to_sky_position(position_px: npt.NDArray[np.float_], wcs: WCS) -> SkyCoord: """Convert pixel coordinates to the corresponding sky position. Parameters ---------- position_px: `~numpy.ndarray` of `float` Pixel coordinates. wcs: `~astropy.wcs.WCS` WCS object. Returns ...
2f514e17626b9b7ab24401a61860e912fe700624
3,597,366
def JMatrixEpoch12Epoch2(Jepoch1, Jepoch2): #---------------------------------------------------------------------- """ Precession from one epoch to another in the fk5 system. It uses :func:`Lieskeprecangles` to calculate the precession angles. :param Jepoch1: Julian start epoch :type Jepoch1: Floating point...
2822e297cdd667d3fa83518c651658a25cbfcb04
3,597,367
def bech32_encode(hrp, data): """Compute a Bech32 string given HRP and data values.""" combined = data + bech32_create_checksum(hrp, data) return hrp + '1' + ''.join([CHARSET[d] for d in combined])
626ddcf23cd3d75e8092cf5c3f257f3d46268f8b
3,597,368
import socket import struct def open_channel(client, channel_name, media_type): """func""" try: message_name = pb._OPENCHANNELREQUEST.full_name message_name_size = len(pb._OPENCHANNELREQUEST.full_name) image_data = protobuf_open_channel(channel_name, media_type) image_data_size...
be353095b091f5878317d007e1a1aa810079d9c5
3,597,369
from typing import Any def update_membership( *, db: Session = Depends(deps.get_db), id: int, membership_in: schemas.membership.MembershipUpdate, current_user: models.User = Depends(deps.get_current_active_user), ) -> Any: """ Update an membership. """ membership = crud.membership....
9f99c5b8feddd25388900560c586850098bf02e5
3,597,370
def j2s(*args): """ .. function:: j2s(jpack) -> space separated string Converts multiple input jpacks to a space separated string. Newlines are converted to spaces. Examples: >>> sql("select j2s('[1,2,3]')") # doctest: +NORMALIZE_WHITESPACE j2s('[1,2,3]') -------------- 1 2 3 >>...
79e0fe02bcb7a06b3e2f21e5a42ffdfa0d16f8f0
3,597,371
import scipy.special def detectThresholdToNoiseSignalToNoisepD(SignalToNoise, pD): """ Solve for the threshold to noise ratio, given the signal to noise ratio and probability of detection. References: "Electro-optics handbook," Tech. Rep. EOH-11, RCA, 1974. RCA Technical Series Publication. R. ...
7e26c555631efcb4a4a165a71e539a24134f0eb7
3,597,372
def lemmatize(sentence): """ pass in a sentence as a string, return just core text that has been "lematised" stop words are removed - could effect ability to detect if this is a question or answer - depends on import lemma = nltk.wordnet.WordNetLemmatizer() and from nltk.corpus import stopwords ...
7ae73e43f092246e2ba3a5060c11f870499aabd9
3,597,375
from operator import or_ def getProjectList(customer_id): """ Returns a list of projects. If a customer id is provided, the list will contain only contain projects to the given customer id """ if request.method == 'GET': search = request.args.get("search") status = request.args.get('status...
aa738c77441fb98d72797ab10a2861d4acb86701
3,597,376
def find_top_features_in_multiple_runs(x, y, importance_func, n_runs=100): """ Calculating MDI value over multiple random forest classifiers with different random seeds. Parameters: x - features vectors dataframe y - true labels dataframe importance_func - importance function n_runs - ...
16f87981db45bf9ad8fc52bbc07b3afdcd3c0d69
3,597,377
def rotm_to_quat(rotm): """ calculate the rotation matrix of a given quaternion (frames assumed to be consistant with the UKF state quaternion). First element of quat is the scalar. """ return np.roll(R.from_dcm(rotm).as_quat(),1)
3caef8738a7496a84e72ab1bb1ab1a02a3e3c566
3,597,378
def get_constant_scheduler_with_warmup(optim: Optimizer, num_warmup_step: float, last_epoch: int =-1): """ get a scheduler with a constant learning rate preceded by a linear warmup. """ def lr_lambda(current_step): if current_step < num_warmup_step: return float(current_step) / float...
c92ce113dba2ab811f6ef90d3dea78f02aa96a05
3,597,379
from modeltranslation.translator import translator def append_fallback(model, fields): """ If translated field is encountered, add also all its fallback fields. Returns tuple: (set_of_new_fields_to_use, set_of_translated_field_names) """ fields = set(fields) trans = set() opts = translator...
2c8b3af89d710fdfe4a27d0ab952d7dc7b12cc2a
3,597,380
import torch def load_diffusion(name, device, has_cuda): """Create base model.""" options = model_and_diffusion_defaults() options["inpaint"] = False options["use_fp16"] = has_cuda options["timestep_respacing"] = str( args.t_respace) # use few diffusion steps for fast sampling model, diffusion = cr...
d8ffb93fc3db447a4e96bf6d4197fb1137699157
3,597,381
def event_list(request): """ List all events """ events = Event.objects.all() serializer = EventSerializer(events, many=True) return Response(serializer.data)
d6dea7c4f17d7f40be1d1136b95df2a0979d35bb
3,597,384
from pathlib import Path def single_extra_bond_line_v3000_sdf(tmp_path: Path) -> Path: """Write a single molecule to a v3000 sdf with an extra bond line. Args: tmp_path: pytest fixture for writing files to a temp directory Returns: Path to the sdf """ sdf_text = """ 0 0 0 ...
6dd02c6c5b11f2431ad3d451afa77dd5b2f4d7bc
3,597,385
def euclid(a, b): """ Returns the Euclidean distance between `a` and `b`. """ return np.linalg.norm(np.array(a, dtype=float) - np.array(b, dtype=float))
b7d49db6569f950613b01b3be7fa4ed2765499b8
3,597,386
import torch def find_average_normal(pos, kernel_size): """Estimate the normal from the average normal of the local patches Args: pos: kernel_size: Returns: """ nbhr_diff = normalize(grad_spatial2d(pos), 1e-10) # cross-prod of neighboring difference # 0 1 2 # 3 4 5 ...
c6ef91d82b306c595cabd3ccc4e432942680310b
3,597,387
import hashlib def sha256_hash(data): """Compute SHA-256 of data and return hash as hex encoded value.""" data = data or b"" hasher = hashlib.sha256() hasher.update(data.encode() if isinstance(data, str) else data) sha256sum = hasher.hexdigest() return sha256sum.decode() if isinstance(sha256su...
88443a9a62080b9e17c6a4eb4bf68ca7b8f62e6c
3,597,388
def create_second_axis(ax1, y_converter_f=None, y_major_locator=None, y_major_formatter=None): """ Create a second y-axis Parameters ---------- ax1: first axes y_converter:second axis converter callback y_major_formatter: y tick formatter for the s...
d38a2f091ca97c67b2cfa620ec10895d58fac13a
3,597,389
async def profile(data: LineData): """Sample data over a line supplied in a JSON body.""" response = await sample_profile(data.line, data.layers, data.max_samples) return response
f2d70805c78d681807f2a782b1ecc41ec718a6c8
3,597,390
import json def load_fixture_json(name): """Load fixture from json file.""" with open(f"tests/fixtures/{name}.json", encoding="UTF-8") as json_file: data = json.load(json_file) return data
31f064da134974380ee12341199aef4d05bdba99
3,597,391
def safe_unicode(obj, *args): """ return the unicode representation of obj """ try: return unicode(obj, *args) # noqa for undefined-variable except UnicodeDecodeError: # obj is byte string ascii_text = str(obj).encode('string_escape') try: return unicode(ascii_te...
57a614c13a04b66f20b62750f45eae9b4164f78a
3,597,392
def getAdjacencyMatrixFromNetwork(GridIdxs, number_of_nodes): """ Transforms an edge list into an Adjacency matrix input: GridIdxs array (2 x k) list of couples number_of_nodes integer amount of nodes in the network output: Astack array (m x l) design matri...
4a4d737107181f4125924f2f1c48a7540f9d3214
3,597,393
import re def is_prognosis_location(word): """ is_prognosis_location() Purpose: Checks if the word is a prognosis location @param word. A string. @return the matched object if it is a prognosis location, otherwise None. >>> is_prognosis_location('c9-c5') is not None True >>...
4237b610d83080ec8145fbd611a6f7ada30c7de5
3,597,395
def split_test_train(label_id_features, test_size=0.3, random_state=0): """[summary] Args: label_id_features ([type]): [description] test_size (float, optional): [description]. Defaults to 0.3. random_state (int, optional): [description]. Defaults to 0. Returns: [type]: [de...
3be14bc05e2b98b3ff2aa0c04e0982fed9bb33a1
3,597,396
def WrapClient(location): """Returns a ClientWrapper.""" transport, path = client.get_transport_and_path(location) if isinstance(transport, client.TraditionalGitClient): return TraditionalClient(transport, path) elif isinstance(transport, client.HttpGitClient): return HTTPClient(transport, path) elif ...
b9e4a2d293ee2ddfb9d8c860f29db84bf1f687eb
3,597,397
def get_selection(): """Read the user's input from prompt. input: none returns: (str) Input read from user input. """ return input('> ')
f091b660b412972a3f5ad4342daa4cf01eb88549
3,597,398
def add_model(): """ @api {post} /v1/interfacemodule/add InterfaceModule_接口模块增加、编辑 @apiName interfaceModuleAdd @apiGroup Interface @apiDescription 接口模块增加、编辑 @apiParam {string} projectName 项目名称 @apiParam {string} name 模块名字 @apiParam {int} id 模块id @apiParam {int} num 排序 @apiPar...
2dba669bf71160e41643f44795376253f26cbb92
3,597,399
def get_neighbors(x, y): """Returns a list with the 8 neighbor positions of (x, y)""" return [ (x, - 1), (y, x + 1), (x - (1), y), (x + 1), y, (x, (-1, y)), (x + 1, y, 1), (x - 1, y + 1, x + 1, y + 1) ]
30098eb9a17e9fdd71651b4762ddeca6dad0a7f5
3,597,400
def put_remote_agg_stations(s3, bucket, dataset_id, threads=30, version=3): """ """ stn_key = key_patterns[version]['station'] stn_prefix = stn_key.split('{station_id}')[0].format(dataset_id=dataset_id) if version == 2: list1 = list_objects_s3(s3, bucket, stn_prefix) elif version == 3...
047a5b070ac425a67d1c5e687e3e855fb45c986f
3,597,401
from typing import DefaultDict def get_scopes_np(lines: Lines_np, d: int) -> Scopes_np: """ get_scopes_np(lines: Lines_np, d: int) -> Scopes_np: Calculate the scope of each cell in a hypercube Parameters ---------- lines The returned value from get_lines_np(hc) where hc is of the ...
aa74c595109b39afdcdb4150fc25b86e8e158155
3,597,402
def handle_mounted_dirs(func, dirs_string, history_filename, update_cache=True): """ This function determine which dir paths can be created. There are 2 uses cases: 1. Customers that have many dirs, each one on a separate mount point that corresponds to a different drive. 2. Developers that are using a sandbo...
0b4874d56b4b440e4f0d9eac700bd83172507590
3,597,403
def attr_descriptor(action, *names): """ Wrap a function that allows for getting or setting of an attribute. This allows for specific handling of an attribute when it comes to serializing and deserializing. :param action: The AttributeActions that this descriptor performs :param names: A list ...
6a5d9a79cf0a2d98701c4123490273aa8d73d31f
3,597,404
def compute_tsys_sefd(data, gain, antenna, pol): """ Compute Tsys and the SEFD from the gains and the baseline heights. Parameters ---------- data : heterogeneous record array containing 'calc_temp' and 'flux' records gain : an array of gains calculated from the beam heights antenna : a katpoin...
c0ef2a72d6ea149dd1c316ec51eaedac8e2d23d6
3,597,405
def fetch_token_mock(self, token_url=None, code=None, authorization_response=None, body='', auth=None, username=None, password=None, method='POST', ...
8c6902272140ffe498ac52c69564d351c6257b2f
3,597,407
def xpp(unk, stds): """xpp(unk, stds) Returns an initialized LabeledMultivariateJacobianFunction for evaluating the XPP matrix correction model relative to the MatrixCorrectionDatum objects in unk and stds. unk: a MatrixCorrectionDatum object stds: A dictionary of ElementXRaySet to a tuple of ( Matr...
f5c5ab6bfdda8454c548bc8c6b233c3a2da585ed
3,597,408
def complete(n): """ Create an undirected complete graph of *n* nodes. :param n: Number of nodes :return: A complete graph """ return Graph([list(range(i + 1, n)) for i in range(n)])
8c988e4aeb43dc67f2c841e714715f13276bbc94
3,597,409
def _handle_intermediate_type(obj, root_obj, unique, root_count, skip_set=None, original_obj=None): """Handling for a intermediate object. Effectively, it's an object that's complex enough to have associated attributes and functions that we want to display in dd output. But for basic cases, treating it mor...
addcb7ce4d1fe48a5dd969e0cec48f16c24fa560
3,597,410
def chebyshev_norm(numdata, numcoef=DEFCOEF): """Return Chebyshev polynomial normalization factors Rj. >>> chebyshev_norm(4, 4) array([ 4. , 2.22, 4. , 20. ]) """ return _chebyfit.chebynorm(numdata, numcoef)
0e6d68d41d80c48310a1ceaa4a36782ad0767d0d
3,597,412
def construct_circuit(working_graph, alpha, beta): """ construct circuit from working graph """ # Symbols for the rotation angles in the QAOA circuit. qaoa_circuit = cirq.Circuit( # Prepare uniform superposition on working_qubits == working_graph.nodes cirq.H.on_each(working_graph.nodes())...
25d6f83b901e0a84547d0c5a4a40ca7e9a4f41e6
3,597,413
def super2xsai(stream: Stream, *args, **kwargs) -> FilterableStream: """https://ffmpeg.org/ffmpeg-filters.html#super2xsai""" return filter(stream, super2xsai.__name__, *args, **kwargs)
8380d5c26ea941bd31d396030b33d472bc36f5d8
3,597,414
def stats_dict(stats_raw_reads, stats_seed_reads, stats_corrected_reads, genome_length, length_cutoff, fragmentation, truncation): """All inputs are paths to fasta files. genome_length and length_cutoff can be None. """ log.info('stats for raw reads: %s' % repr(stats_raw_reads)) ...
2047fbea4a0a1e00fab748316988af2279ca6b8e
3,597,416
import math def valid(f): """Checks if the given coordinate is valid Args: f (float): Coordinate of a HeightCoordinate Returns: boolean: whether or not the coordinate is valid """ return math.isfinite(f)
38753057630cb2581ec1752d672e9a5c76162066
3,597,418
def augfunc(data_in, data_out): """ Use this function to trim the input and output sequence data_in_modified, data_out_modified, length = augfunc(data_in, data_out) """ orig_length = data_out.shape[0] ups_rate = input_reso[0] seg_length = ups_rate * 32 if orig_length > seg_length: #...
a925923af8e3cae4673c90ec1b7d0bd14ed4dacd
3,597,419
import itertools def get_payoff_settings(ev_diff): """Provide a set of possible payoff distributions. For two payoff distributions with two outcomes each, provide settings in the form of an array, where each row is a setting for the two payoff distributions and the meaning of the columns is as follow...
ad891e045468f9cbd34be8e2fb9c4954cc771e37
3,597,420
def get_waiter( waiter_type, operation, client, resource_helper, operation_response, wait_for_states ): """Return appropriate waiter object based on type and the operation.""" # First check if there is any custom override for the waiter class. If exists, use it. waiter_override_class = get_waiter_overri...
90160757012af96e4774d22e3634f73785f222fa
3,597,421
from typing import Union from typing import Callable def resolve_sample( choices: str, ) -> Sample: """Resolve a sample from a string representation.""" split = choices.split(":") selector = split[0] amount: Union[str, int, Callable[[int], int]] if len(split) == 1: # there is no amount...
743200e5b1d4d338deabb907f7c6b7a932fef51d
3,597,422
def hrms_bernstein_gamma_seq(X, delta, L, U, propensity=0.5, v_opt=500, alpha_opt=0.05): """ Compute the uniform upper bound for Sn = X1 + ... + Xn, n in [N] using in Howard et al. 2018, using empirical Bernstein with gamma exponential mixture. Input: X: An array of Xi's...
ac2460a301683a0156a60ebc9fc99eb1e07801f3
3,597,423
def parse_discovery_properties(props): """ This method normalizes and parses _hap._tcp Bonjour TXT record keys. This is done automatically if you are using the discovery features built in to the library. If you are integrating into an existing system it may already do its own Bonjour discovery. In that...
e104d5fd90b2d84d77ec6745d97315056887a8f5
3,597,424
import collections def features_for_metapaths(g, source, target, edge_key, excluded_edges, metapaths): """ Returns an OrderedDict with metapaths as keys and metric_dicts as values. Calls metrics_for_metapath() for each metapath to generate the corresponding metric_dict. """ metapath_to_metric_...
13157e4c4890507a32eb17b892e07de01651b339
3,597,425
import re def match_geo_platform(geo_platform): """Infer the type of platform given a GEO platform""" root = retrieve_geo_platform_miniml(geo_platform) geo_platform_title = root.find('miniml:Title', ns).text # BGI if geo_platform_title.startswith('BGISEQ') or geo_platform_title.startswith('DNBSEQ...
5046c23ba7a8ef182835f2d10bb27f05e2cc0e6b
3,597,426
def compute_mediation_std(ex_hat_std, ey_hat_std, eyx, eyy, yvars, final_var): """compute mediation std""" # dimensions ndim = ex_hat_std.shape[0] mdim = ex_hat_std.shape[1] jvar = list(yvars).index(final_var) exj_hat_std = ex_hat_std[jvar, :] # (mdim) eyj_hat_std...
914f7f137ecd6ed1b76a09e4a8966384d942ea54
3,597,427
def food_tag_exists(tag_name): """ Checks whether a food tag aldready exists . :param tag_name: name of the tag to be checked :return: boolean indicating whether tag exists or not :rtype: boolean """ tags = Tags.query.all() for tag in tags: # Return False if tag name aldready exists. if ...
385417468509515baac3e17ca1ccb1eb30167b02
3,597,428
import html def link_text_to_line(text, to_file, line, from_file=None): """Link text to a line in a file in the source tree.""" if srcloct.is_builtin(to_file): return html.escape(str(text)) from_file = from_file or '.' line = int(line) path = path_to_file(to_file, from_file) return '...
27cfdc85eda8ce33b15e3632f6fff033ac830fd9
3,597,429
from pathlib import Path async def console_get_by_uuid( cluster_id: str = Path(default=None, title="cluster_id", description="Cluster ID"), console_uuid: str = Path( default=None, title="console_uuid", description="Console UUID" ), ): """ Get Console by UUID """ try: # KeyError Han...
2603bbd660d415fc9ad1099b4bf3d6a520b3c7f7
3,597,430
from scipy.ndimage import gaussian_filter def LBG_tracer(): """ Define LBG tracer """ ## Param for LBG tracer: bias = 3.2 pop = 1.0 z0 = 2.76 z_width = 1.4 ## Info sur le survey: density_deg2 = 500.0 Area = 10000 ## shot noise limited regime ? shot_noise_l...
0156a2a3802cb4cba60494e5aedd1f6e2779148c
3,597,431
def test_refreshing_wsdl_validator_not_set(self, wsdl_url, ss_host, ss_user, ss_pass, client_name, client_id): """ SERVICE_14 3a The location of the WSDL validator is not set :param self: obj - mainController instance :param wsdl_url: str - wsdl url :param ss_host: str - security server host :pa...
039f83061402599bf2faef46fc3277394333476f
3,597,432
import json def exposejson(func): """ Convenience decorator function to expose json """ def wrapper(self, data, expires, contentType="application/json"): data = func(self, data) try: # jsondata = encoder.iterencode(data) jsondata = json.dumps(data) ...
646337c671fd7e2bb1dd9215061fe1d3ceb8993c
3,597,434
def active(name): """True if the named environment is active.""" return _active_environment and name == _active_environment.name
1e87da75a81a31ee972ef7e686dd20bcd75b346f
3,597,435
def add_newitems(copied_item, cut_from_itemdict, itemdict): """met behulp van cut_from_itemdict nieuwe toevoegingen aan itemdict maken - voor elk item nieuwe key opvoeren met dezelfde data value - bij elke bestaande key de nieuwe key onthouden kopie van copied_item maken met vervangen van oude k...
c844921b5231b397678ee449f01fa6471adbaada
3,597,436