sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4f6df6dcca00bb5c7e49bf2ea5ab6fb56744273eb486fea75a4c1cc5d44dccf3
Python
2,486
77
from typing import Dict from keras.models import load_model from keras.backend import clear_session import numpy as np from common import XAIScenarios, SEED from utils import load_json_file, append_date, dump_as_pickle, load_pickle from xai.methods_keras import get_keras_attributions import gc from glob import glob ...
b7c9d8362b535f430bc844645ba2d53e982c57db9cfab89a5bda6ce5d86d3db8
Python
2,486
93
#!/usr/bin/env python """ Collect raw read count metrics. Writes stats to stdout. Metrics: counts_qN : Nth percentile counts_num_intervals : number of records counts_intervals_size : sum of interval sizes """ import gzip import argparse import sys import numpy as np import svtest.utils.TestUtils ...
f91bb6da13d603d4e7f7ba59baf15bc935fa77c8980fea3334da723b05589462
Python
2,486
67
from txgnn import TxData, TxGNN, TxEval import argparse parser = argparse.ArgumentParser('') parser.add_argument('--device', type=int, default=0) parser.add_argument('--split', type=str, choices = ['random', 'complex_disease', 'complex_disease_cv', 'disease_eval', 'cell_proliferation', 'mental_health', 'cardiovascular...
3340f312e454d2a77b41ca7619016d4db053fabd2031513485694dbf3173cf27
Python
2,488
78
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
377b44d6cb7f4bec606edbdad017e022507836fce496f86af95de4d808fe72d7
Python
2,488
55
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
8a515adb16f9821695d2a154e873d8fb8c85104a9f8d5488a5aebd81d812e18f
Python
2,488
93
""" test lif_curr_exp_no_delay """ import os import matplotlib.pyplot as plt # get results and plot import numpy as np from spinnaker2 import hardware, snn def test_lif_curr_exp_no_delay(do_plot=False): params = { "threshold": 1000.0, # high value so neurons don't spike "alpha_decay": 0.9, ...
06774c0ce0882e60b01e5115ac4c3d7c3d2db850907ea9f49c766b3450edadb8
Python
2,489
69
""" This module defines project-level constants. """ import os import numpy as np from tensorflow.keras.losses import MeanSquaredError from tensorflow.keras.optimizers.legacy import Adam from tensorflow.keras.metrics import RootMeanSquaredError from . import regressor_tools as rt from . import experiments_tools as et ...
e37404a28d02bb245e8cc8af997ab8b38227f205f94d1231fac2ea7cadf8ce3d
Python
2,490
84
""" This script provides the functionality to generate metadata.npz files necessary for load_balancing the DataLoader. 1. Copy from: https://github.com/Open-Catalyst-Project/ocp/blob/09f0d3bdf4c9154c2f11105eb5d61e1cc0d8c638/scripts/make_lmdb_sizes.py 2. Used for generating sizes of data for S2EF ta...
484a7644d92868787e7733471fd7f4b90fe6fa52eb64dc915e3eccf9dbb976a7
Python
2,491
69
import torch import logging from torch.utils.data import TensorDataset from sklearn.model_selection import train_test_split from agent.data.entities.config import FC_CLASS_VALUES from agent.classifiers.utils.class_mgmt import get_number_of_classes from agent.classifiers.data.transformer_text_triple_fc_dataset_mgmt i...
a7a889078baa680505d2140d5ea04b3cd0246870228f2037d7c196dcf1da7d05
Python
2,491
81
import numpy as np import os import json from ..io import SAVED_DIR, load_network_all from types import SimpleNamespace from copy import deepcopy def analyze_weights(run_name, directory=SAVED_DIR, auto_save=True): print("starting weights analysis") try: # Loading the Network print("1") ...
a81388f8295bfdd4481d599f69d2ea857e796b1918caf524ebb262ef15665f5d
Python
2,491
49
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ #------------------------------------------------------------------------------ # Analysis Parameters (modify if required) min_per = 18 #min period (in h) to be analysed max_per = 30 #max period (in h) to be analysed pixels_per_...
c43f2076621df64760ed9ff04322fcdd82d6175ab8741764e9b4b880e0ac7e7a
Python
2,491
69
# # Copyright (c) 2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
17501e6b1c56867bbdb4052106e438fc007077f0e8dc89c0921738d895b7fb85
Python
2,492
77
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import gzip import pysam def load_introns_for_contig(intron_file, contig): introns = [] is_gzipped = intron_file.endswith('.gz') opener = gzip.open if is_gzipped else open with opener(intron_file, 'rt') as f: for line in f: ...
4885d438cfcc39d2edb32c5462f3f1351040ce40293bbf66d1c1c713866d7ced
Python
2,492
80
# built-in dependencies from typing import List, Union, Any, cast # 3rd party dependencies import numpy as np from numpy.typing import NDArray # project dependencies from deepface.commons import weight_utils from deepface.models.FacialRecognition import FacialRecognition from deepface.commons.logger import Logger lo...
a34b205456e1df53bc7448871c9df76bcf8a20424e6fea8d8c74ac0a2a4b1572
Python
2,492
86
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Global drift compensation for inference.""" from typing import Tuple, TYPE_CHECKING from torch.autograd import no_grad from torch import abs as torch_abs fr...
b984b0e93940e34fa034be4f2e8a5c36f28e6279a265bdc84045b1711dc625d0
Python
2,493
81
"""Script to run a jupyter notebook for an ensemble.""" import argparse import logging import sys from importlib import resources from typing import List from flyvis.utils.compute_cloud_utils import launch_single logging.basicConfig( format="[%(asctime)s] [%(filename)s:%(lineno)d] %(message)s", level=logging.INF...
bb6c52b8c41535ced3208bc432bde76a2ef12df03bc5a4e174cda97d42bd02b2
Python
2,493
79
"""Allow ``python -m omicverse.mcp`` to start the MCP server.""" import sys def _requested_transport(argv: list[str]) -> str | None: """Return the requested transport, or ``None`` when argparse should handle exit-only flags.""" args = list(argv[1:]) for index, token in enumerate(args): if token i...
f3a43de98331f55c9eb19d22417449ae667108b3642e6bf7be5885fe3e51ccb0
Python
2,493
64
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
965fcbee7b9049f19724eeddf489499e594540b5ebef7bab8935249c588f8e7d
Python
2,494
98
import pandas as pd from neuron_morphology.morphology import Morphology from cloudfiles import CloudFiles import io import os import csv SWC_COLUMNS = ( "id", "type", "x", "y", "z", "radius", "parent", ) COLUMN_CASTS = {"id": int, "parent": int, "type": int} def read_swc(path, columns=SW...
b16aae810deeae9bbe00f5e6242ca683e631b103b08096a42548071330099d3a
Python
2,494
90
from functools import partial from typing import Annotated, Callable, Iterable, Literal, Any import numpy as np from numpy.typing import NDArray from sklearn import model_selection from sklearn.base import BaseEstimator from siapy.core.types import ArrayLike1dType, ArrayLike2dType from siapy.optimizers.evaluators imp...
d8a13f6e57c6b8aefea518538375995c95769faaf5ab411a46aa53a8e32b4d56
Python
2,494
65
# -*- coding: utf-8 -*- # @Time :2024/6/6 20:23 # @Author :MENGLong Li # @File :main.py # @Software:PyCharm import numpy as np from lib.ReadTxtDataFromOdbFile import ReadTxtDataFromOdbFile from lib.MachineLearning import MachineLearningSet "-------------------------------------------------- Step 1 -----------...
e6471025d8b892e4bc4008c64619d4266c35ce72d9352c13657c0a351134f255
Python
2,494
77
import numpy class ContextHandler: """ Handles different contextual information. Available modes are: - `mean`: The average of the image - `quantile`: The quantiles of the image - `image`: The entire image """ def __init__(self, ctx_info): """ Initializes the class wit...
9fb218061ef15f775b5c15cb56778a7e7fff147da8a15c25d509bdd750568c81
Python
2,495
57
import numpy as np import h5py import argparse import pickle from typing import Dict import lib.dataset_config_parser.dataset_config_parser as dcp from lib.data_utils import sta_metadata from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct if __name__ == '__main__': parser = argparse.Argu...
3dd3523d146a7c757dddc3d2854698a4b575f2123b532ab26dab0533fb68c128
Python
2,496
95
import numpy as np class gene(object): def __init__(self, geneID, geneType, binID = -1): """ geneType: 'MR' master regulator or 'T' target bindID is optional """ self.ID = geneID self.Type = geneType self.binID = binID self.Conc = [] self....
14350c2940ed9c3a95bead764100e930fbce9976f7996739e2db469c5a5bae42
Python
2,497
73
__author__ = 'jfaskowitz' ''' josh faskowitz Indiana University Computational Cognitive Neurosciene Lab Copyright (c) 2018 Josh Faskowitz See LICENSE file for license ''' import numpy as np import nibabel as nib from sys import argv import json def main(): i_file = str(argv[1]) o_file = str(argv[2]) la...
3e32613ba3a790b6c9222af58f8dc169f75ed5b20758416f496a7f0572e0af8b
Python
2,497
64
#!/usr/bin/env python import argparse import os import sys import json import dxpy import requests from dxencode import dxencode as dxencode ASSAY_TYPE = 'RNA-seq' ASSAY_TERM_ID = "OBI:0001271" PROJECT_NAME = 'long-rna-seq-pipeline' def get_args(): '''Parse the input arguments.''' ap = argparse.ArgumentPars...
297604aab5a16da4ae627232ee840245fdd81ec789ef54d92812273c720e8cb2
Python
2,498
90
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. This script provides the functionality to generate metadata.npz files necessary for load_balancing the DataLoader. """ from __future__ import...
53fd2a6c356c85e485797ebf4f63b38d15c86cff2836976119d6eb646a51e1fb
Python
2,498
48
import numpy as np from numba import njit @njit def forward(input_size, indices, timestamps, weights, thresholds, leak_tau=None, max_time=1, dropout_in=None, dropout_out=None): # Init membrane potentials mem_pots = np.zeros(weights.shape[0], dtype=np.float32) # Record input and output spike timestamps ...
f6c67822305ab80c71923e4dee064af54dca2266f6bc16ba5208b05e5bceb59a
Python
2,498
58
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
f7cd88301be5fa375f7415643efa85e76c9ca08a3010b1dc02481b44822df2ce
Python
2,498
58
import os import nibabel as nib import pandas as pd import numpy as np from scipy.stats import ttest_ind, mannwhitneyu # Load participant data participants_df = pd.read_csv("participants.tsv", sep="\t") # Function to calculate lesion volume (in cc) def calculate_lesion_volume(nifti_path): img = nib.load(nifti_pat...
a26f772e9bbc9b08826831cfb4534858c75f2b3e0087d2a478e1e47b3f3d02df
Python
2,499
80
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import gzip import json import os from glob import glob from typing import TYPE_CHECKING, TypeVar if T...
e638c71242082f77721085560c61fc3b5a8dd726ed30604986e5ab771be61452
Python
2,500
63
from __future__ import absolute_import, print_function # checks try: import tensorflow del tensorflow except ModuleNotFoundError as e: from six import raise_from raise_from(RuntimeError('Please install TensorFlow: https://www.tensorflow.org/install/'), e) import tensorflow, sys from ..utils.tf import...
140baf3cb49808b0f32757761a7b53c105e9c6000111aa0bae3e4b7503adc690
Python
2,502
71
from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class SafetyConfig(object): WEAK = { "sld_warmup_steps": 15, ...
280eeff997742439e30ad95b88e71a3dffa10ee2a94ff85413199d775c134ea1
Python
2,503
62
import nibabel as nib import numpy as np import pyvista as pv from lib.qc_surface import compute_topology from lib.surface import write_points_faces_to_gifti from lib.surface_repair import fill_holes, repair_mesh from lib.utils import setup_logger log_file = snakemake.log[0] if snakemake.log else None logger = setup_l...
296522a08f41a520e752c0bb21a1cda2821d434813e715b4de5212af9b870efb
Python
2,504
54
import logging from datetime import datetime from transformers import FunnelForSequenceClassification from agent.classifiers.transformer_classifier import transformer_classifier from agent.classifiers.transformer_classifier_text_trainer import train_loop, eval_loop from agent.classifiers.data.transformer_text_cw_data...
77ece7506e0da16c3d0ad15314a2c8fcf19910cf7d7a878d0bac2f6fad8d73d6
Python
2,504
68
import os import numpy as np import pandas as pd import pyranges as pr def annotate(df, genes): gr = pr.PyRanges(df) return gr.nearest(genes) def fdr(p, n=None): """Give a numpy array, convert P values to FDRs""" if not n: n = len(p) p = np.array(p) # do not allow nan values asser...
a43214a4b58f06625dd817b759974c826eb6e7cdcec76685e6418e62329acace
Python
2,504
78
# built-in dependencies from typing import List, Any # 3rd party dependencies from numpy.typing import NDArray from retinaface import RetinaFace as rf # project dependencies from deepface.models.Detector import Detector, FacialAreaRegion # pylint: disable=too-few-public-methods class RetinaFaceClient(Detector): ...
cbc1e00f5333626aa577c1281882bcb127ad84cc682f380eaf0f8cc64012d452
Python
2,506
79
# type: ignore # pylint: disable-all # -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """aihwkit example 31: Using half precision training. This example demonstrates how to use half precision training with aih...
2ee59eef8e24c0e00ada2def73a1619d7bfbfb934a501af6b8bedd401a42ef8d
Python
2,507
80
"""Tools for manipulating sparse matrices.""" import itertools from typing import Any, Collection, Iterator, Sequence import numpy as np from scipy import sparse def rescale(matrix, factors: Sequence[float], axis: int = 0): diagonal = sparse.csr_array(sparse.diags(factors)) match axis: case 0: ...
8d3f2482b3c58ff38cc49a2b812fcc54affbda35044c0e05ce598bde8131078a
Python
2,509
75
import numpy import os import json import pickle import bz2 import torch import gym_sted from .prefNet import PrefNet def load_demonstrations(path=None, f1_score=False): """ Loads a set of demonstrations from the given path :param path: A `str` of the path to the set of demonstrations :returns : A...
a2198fb8ee5d66524622e758d85d7aec80e8084b6759b99916a33d25d9affd82
Python
2,509
68
# coding: utf-8 import os import sys import unittest import pytest # noqa from ray._private.test_utils import load_test_config from ray.autoscaler.tags import TAG_RAY_NODE_KIND from ray.autoscaler.v2.instance_manager.config import AutoscalingConfig from ray.autoscaler.v2.instance_manager.ray_installer import RayInst...
ea1a3ae75ee039527a160fddb56ad6efbf08a253be03b34ad2902c6aa8793232
Python
2,509
69
import tempfile import torch import tqdm from ddw.prepare_data import prepare_data from .subtomo_dataset import SubtomoDataset def get_avg_model_input_mean_and_std(tomo_file, subtomo_size, subtomo_extraction_strides, standardize, mw_angle, batch_size, num_workers, batches=None, verbose=False): """ Computes...
12fa2efb9eb2a78de7bb11c4ef532367ccba221b9d12bd5241aba64679da3732
Python
2,510
66
import sys import json import pickle import argparse from lop.utils.miscellaneous import * from lop.utils.plot_online_performance import generate_online_performance_plot def add_cfg_performance(cfg='', setting_idx=0, m=2*10*1000, num_runs=30): with open(cfg, 'r') as f: params = json.load(f) list_param...
1384bf782404897a562f1ec2e4cb49c04659cbc6167c78059b71fd0abd6a6288
Python
2,510
66
# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
c2962b9a958249e737e30e42c83b33148b53dc54ca9474182b41e0d6843e7d0f
Python
2,510
77
# Modified from https://github.com/dbolya/tide # This work is licensed under MIT license. from typing import Union class Error: """A base class for all error types.""" def fix(self) -> Union[tuple, None]: """Returns a fixed version of the AP data point for this error or None if this error sho...
d39743fe5ec7daa8a92349632715bd6ba581943cb72d6bdcff34f88cd972a91c
Python
2,511
66
"""Helpers for recognizing and recovering from cloud credential failures. Format-agnostic: an expired S3 session token or Azure SAS token looks the same to any datasource or datasink that talks to object storage, so these live here rather than next to one format's implementation. """ import os from typing import Dict...
d79ee28d2bda90be98040827899b510514919e2448e99710a8df061193af5ae7
Python
2,513
81
import numpy as np import gym import exputils as eu from .twod_object_collection import TwoDObjectCollection class Barreto2018TwoDObjectCollection(TwoDObjectCollection): ''' 2D grid object collection task described in Barreto et al. (2018) (https://arxiv.org/pdf/1606.05312.pdf). ''' @staticmethod ...
b0cc21dc30d229fa8cf2644d0504608ca8c6a14a428f43a014096e5e56ab9a92
Python
2,514
78
""" Base adapter interface for MCP tool execution. All adapters normalize Python function calls into the standard MCP response envelope: ``{ok, tool_name, summary, outputs, state_updates, warnings}``. """ from __future__ import annotations import traceback from abc import ABC, abstractmethod from typing import Any, ...
ee2bdba50f6873b7c4b8630aaa60a43fd9ebe1874971667175ef991b33463565
Python
2,515
63
import torch from torch.utils.data import DataLoader, TensorDataset, Dataset import cv2 import numpy as np import clip import uuid from albumentations import Compose, RandomBrightnessContrast, \ HorizontalFlip, FancyPCA, HueSaturationValue, OneOf, ToGray, \ ShiftScaleRotate, ImageCompression, PadIfNeeded, Gaus...
623f941d3b5dfef06996189d74f3f9a8d68ca1afbcfa570bd8478fb159550392
Python
2,516
81
_base_ = [ '../../_base_/datasets/urpc2020/urpc2020-test-A_coco_detection.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py' ] # model settings model = dict( type='TOOD', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], ...
d13f28af7a8b553a4c18d8dd40e68f50624836b9c4e755fdf0adf4147bbe7258
Python
2,516
81
_base_ = [ '../../_base_/datasets/urpc2020/urpc2020-test-B_coco_detection.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py' ] # model settings model = dict( type='TOOD', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], ...
752573945f5d39a4ef7317d1d82a064fda9b2d3a2550fdde2cbd7a7539c1a70c
Python
2,517
78
"""Provide functions for system setup""" # general imports import json from openmm import unit from openmm.app import ( CharmmPsfFile, CharmmCrdFile, ) def gen_box(psf: CharmmPsfFile, crd: CharmmCrdFile) -> CharmmPsfFile: """Function to create psf file containing information about the box used (only for ...
0dbbda1464e19deac09407185959f5775d12bec8e02ed8877f942f3b8f4c9bb9
Python
2,519
77
# built-in imports from typing import List, Tuple, Optional, Any from abc import ABC, abstractmethod from dataclasses import dataclass # Third party imports from numpy.typing import NDArray # Notice that all facial detector models must be inherited from this class # pylint: disable=unnecessary-pass, too-few-public-...
a130ea65f58000bd0e2be5e286c68f645494e94c783bc685442d472f4adbcb40
Python
2,519
76
"""Print the doc example test targets that a change feeds directly. Prints one `<team> <label>` pair per line to stdout, and a report of what runs and what doesn't to stderr. See doc_example_targets.py for the matching rules. Pass files explicitly, or pass --base to diff HEAD against a ref. In CI, run_doc_example_tes...
2f5aab11c7ae2212bbe20d55395b47e2e409d9b6e2c757e32bbd3246f208f84d
Python
2,520
81
_base_ = [ '../../_base_/datasets/urpc2020/urpc2020-validation_coco_detection.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py' ] # model settings model = dict( type='TOOD', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53],...
a2cbd11edb1dd8fb169d352832b4a296cc578f88a664766358ebf26a840fd51f
Python
2,523
87
# coding: utf-8 import os import sys import pytest # noqa from ray.autoscaler.v2.instance_manager.storage import ( InMemoryStorage, StoreStatus, VersionedValue, ) @pytest.mark.parametrize("storage", [InMemoryStorage()]) def test_storage(storage): assert storage.get_version() == 0 assert storage...
232cc06940c70b2c358c8458f02e5ad7cf55bd5758287e3c16cb98b1823e8965
Python
2,524
42
import numpy as np, pandas as pd, json, itertools from scipy.optimize import minimize from scipy.special import logsumexp from emp import counts, dm_ll, R def prep(f,manip_col,manip_val,has_nt): x=pd.read_excel(R+f).dropna(subset=["t_court","defbehav"]); g=(x[manip_col]==manip_val).astype(int).values h=(~x.thre...
f123653af57ce2fa64949728abe4a0d6de4feddb97015547fbd3c702557dacc2
Python
2,525
90
import socket import os import sys import numpy as np import scipy as sp import scipy.linalg as la import scipy.io as sio from sklearn import svm, manifold, linear_model from sklearn.model_selection import cross_val_score as cv_score import sklearn.kernel_approximation as kaprx def convexify(cols, bins): ''' ...
67630e74f6e07ee9ffdc1a469d5f94a230b3ba642e092afc542e725c47f99cc5
Python
2,528
66
""" Shared /model command output helpers for Jarvis channels. """ from __future__ import annotations from html import escape from typing import List, Sequence from .model_registry import iter_supported_model_catalog _MODEL_SWITCH_EXAMPLES: Sequence[str] = ( "gpt-5.3-codex", "claude-sonnet-4-6", "qwen-max...
7478699cb9e8163f6f178a15b1fd303aa3c74743bda4cfb685c417c3f1f8cdfa
Python
2,528
83
"""Shared utilities for local build scripts (build_wheel.py, build_image.py).""" from __future__ import annotations import logging import platform as _platform import re import subprocess from pathlib import Path class BuildError(Exception): """Raised when a build operation fails.""" class _ColorFormatter(logg...
969de6389e40456fb9515eb1eda5e05474cad88645ed11e4b657c79508989399
Python
2,528
79
#!/usr/bin/env python3 import argparse from glob import glob import sys import numpy as np import matplotlib.pyplot as plt import pysam import math import pandas as pd import haplotagging_stats import os import collections import seaborn as sns SWITCH="switch_err_rate" HAMMING="hamming_err_rate" HAPLOTYPE="haplotype" ...
b152ce6547074412a69b08656a7bdfa00562fe067dec96badd948026669c6781
Python
2,528
79
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Python version: 3.10.9 pandas version: 1.5.0 numpy version: 1.23.3 """ #%% Import Modules import pandas as pd import numpy as np #%% Functions def dice_coeff(df, thresh=None): if thresh != None: ses1 = df[(df["ses"]=="ses-01") & ((df["pval"] < thresh))].re...
9863dec5e32e2906d9cde4d88fdefe7191e4198ce83193710ac3f67fa6f65199
Python
2,529
128
from numba import jit import pandas as pd import numpy as np from numba import njit N_BIN_TARGET = 30 @jit(nopython=True) def find_gene_p(num_umi, D): """ Finds gene_p such that sum of expected detects matches our data Performs a binary search on p in the space of log(p) """ low = 1e-12 ...
ade4f9403b827af383ef07e881d67ab30c09965eb29764114b99d7b5dca39a8c
Python
2,529
69
# metrics.py from prometheus_client import Counter, Histogram, Gauge from typing import Dict from dataclasses import dataclass, field import os import psutil import os @dataclass class PerformanceMetrics: _instance: 'PerformanceMetrics' = field(default=None, init=False, repr=False) # Prometheus Metrics ...
57a572234f1e2b4790cc57e8faa93cc1a17608f5bd0badec8cf9a5f5f849e2c3
Python
2,530
63
import numpy as np import scipy.sparse as sparse from hic3defdr.util.banded_matrix import BandedMatrix def filter_sparse_rows_count(matrix, min_nnz=25, k=300): """ Wipes the sparse bins (both rows and columns) of a matrix, where "sparse" means that the bin has less than ``min_nnz`` nonzero interactions w...
644c1604a1c4ffbf6db6a6ecb73dce39178e9fb4e65abb3881476a9908d42ad5
Python
2,532
71
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F def init_lecun_uniform(tensor, scale=1.0): """Initializes the tensor with LeCunUniform.""" fan_in = torch.nn.init._calculate_correct_fan(tensor, "fan_in") s = scale * np.sqrt(3.0 / fan_in) with torch.no_grad(): ...
1b41ea5d0483e300bbe350dfbbe480a5079e96cebcc657e1d18daac813d048df
Python
2,533
76
"""Exercise registration ownership with an actual on-disk Qdrant local client.""" from types import SimpleNamespace import numpy as np import pytest from deepface.modules import datastore from deepface.modules.database import qdrant @pytest.mark.parametrize("owned", [False, True]) @pytest.mark.parametrize("fail", ...
018706d27cd87a683578d945d1d88de0756834bf562b150a284a9c30320a0a7b
Python
2,534
81
""" Auxiliary handler methods for data summary extraction """ from typing import Any, Callable, Dict, List, Sequence import networkx as nx from visions import VisionsTypeset def compose(functions: Sequence[Callable]) -> Callable: """ Compose a sequence of functions. :param functions: se...
16d9376d4e90fe2a6754b3802916e89e6bfee3b9191b44e7b1cc14450c1c41a5
Python
2,535
77
# import needed libraries import cv2 import numpy as np import plotly.express as px import plotly.graph_objects as go import os import glob from plotly.subplots import make_subplots def plot_part_region_spectrum(img_i, img_o, colorbar_min, colorbar_max): img_i = np.array(img_i) img_i = img_i / np.max(img_i) ...
3a31bf5e47b5fd2c2b44b51b3e7519ac58fcfe310139a1020c8f257b9bff193c
Python
2,535
66
import numpy as np import UnitMatchPy.Param_fun as pf def get_ParameterKernels(Scores2Include, labels, Cond, param, addone = 1): """ Requires Score2Include, a dictionary where the keys are the metric used and the values are nUnits * nUnits with the score for each unit. Smoothing and add one is done to...
5d4c6b73a52e991c743662567bbeb6c617080face7ba4222c0877b75e402eeb5
Python
2,535
71
import marshmallow as mm from argschema.schemas import ArgSchema, DefaultSchema from argschema.fields import InputFile, List, Float, Int, Nested, Boolean from neuron_morphology.transforms.affine_transformer._schemas import AffineDictSchema def validate_input_affine(data): has_slice_transform_dict = bool(data.get(...
c3524b12a0b06ce4470ccee3eeab141bd39a79383b4181b05cfbd9f1716d40b0
Python
2,535
74
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Tests for Experiment Runners.""" import os from io import StringIO from unittest import SkipTest, skipIf from unittest.mock import patch from torch import d...
06959e77be4bef1b18bddbd0c15189a76bf79cbada0265adfca018eb73cb2e71
Python
2,536
74
# Generated by Django 4.1.6 on 2023-02-06 04:19 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("infer", "0005_remove_weights_path_weights_chkpt"), ] operations = [ migrations.CreateModel( name...
9ec79a46f88cd350492e7806355166b826510a7cec82af8fc3fe557ba25371ab
Python
2,537
74
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
21ce5377d7f89c1913e5d4940cd4dc6c4f3624ca432fafde4903f85534f89f68
Python
2,539
86
from collections.abc import MutableSequence from typing import Any, Iterator, Iterable class ConstantLookupList(MutableSequence): """A list with constant time index lookup.""" def __init__(self, values: Iterable = ()): self._lst = list(values) self._lookup = {} self._generate_lookup()...
61c617dd8d6d6f45291792a152a9d6bc6035a1645930e170756cfdeeaf498efa
Python
2,539
48
from model import (IntraEncoder, InterEncoder, ProteinInteractionNet, Trainer, Tester) from uncertaintyAwareDeepLearn import VanillaRFFLayer from utils import ( load_configuration, initialize_logging, set_random_seed, get_computation_device, initialize_scheduler, train_and_validate_model ) def ...
efb4d6a87712a318c016f9cf8bad49344ceaeaa103f5642c70216dc5c97e02dd
Python
2,539
77
# -*- coding: utf-8 -*- """Simulate and export one Randomized Experanto chunk. CHUNK selects a chunk; the model's trial parameter selects its trial. RUN_CONFIG names the launcher's run_config.json, containing input paths, shared export settings and run provenance. Manual runs use CHUNK_DIR and BASE_PATH. SHEET_NAMES s...
0320d6ff6bae4756b52c3a90b770950686b8f39d8c86799dd9cfd57b154d3932
Python
2,540
72
#!/usr/bin/python import sys import os import subprocess import argparse #################################################################################################### # @compute_hausdorff #################################################################################################### def compute_hausdorf...
b27d7902cca668e9d8e74e66685de85c7ed163cb0abe2f05b6088865bcf814ce
Python
2,540
76
import unittest from spinnaker2 import mapper from spinnaker2.neuron_models.common import format_routing_table from spinnaker2.coordinates import PE class TestSynapseWordSpec(unittest.TestCase): def test_enum(self): s16 = mapper.SynapseWordSize.SIZE_16 self.assertEqual(s16.value, 16) s32...
4fdf78f360e71fb818d40583e7bdcc17b73beff298b5871f3fc3331094d10e70
Python
2,541
83
# Copyright (c) 2017-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
88f071924f1f47766c24d4f64b763ce9b2f5496e98039ed91a590bb9f7a022ac
Python
2,541
91
_base_ = [ '../_base_/datasets/rtts_coco.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='FCOS', data_preprocessor=dict( type='DetDataPreprocessor', mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0], ...
cdff1115fc9a2b57d6cf5a2a699d7e99541bc2b313eb93eec59be6b6c1a8b77a
Python
2,541
57
from pkg_resources import parse_version from configparser import ConfigParser import setuptools assert parse_version(setuptools.__version__)>=parse_version('36.2') # note: all settings are in settings.ini; edit there, not here config = ConfigParser(delimiters=['=']) config.read('settings.ini') cfg = config['DEFAULT'] ...
00cdf6d2fa038caeaf20d2c193ceb3913dc2d528e06efcbfb62ddbfa41be974b
Python
2,543
75
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Tests for Experiment Runners.""" import os from io import StringIO from unittest import SkipTest, skipIf from unittest.mock import patch from torch import d...
c70ca867d26a937477258cf1aa7f7fa95d3360278e02b8e1c9fd91270ac55af9
Python
2,543
81
from ogb.utils.features import ( allowable_features, atom_to_feature_vector, bond_feature_vector_to_dict, bond_to_feature_vector, atom_feature_vector_to_dict ) import torch import rdkit from rdkit import Chem import numpy as np def smiles2graph(smiles_string, with_amap=False): """ Converts SMILES stri...
403c489ecd25c816d7fe3c1165b8d1574d1d7dda55f2c67a8e4ff0a290f2c867
Python
2,544
75
import base64 import json import os import socket import sys import pytest import ray from ray._private.test_utils import ( wait_for_condition, wait_for_dashboard_agent_available, ) from ray.dashboard.tests.conftest import * # noqa _RAY_EVENT_PORT = 12345 @pytest.fixture(scope="session") def httpserver_li...
322aa18e61c84c9e248b38211c76bc53ffaf0c9a2e21b96a6b1287d9ce13543a
Python
2,545
86
_base_ = [ '../_base_/datasets/rtts_coco.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='ATSS', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], ...
5b0042d8ea6b21e4ca8effde9788ffb71eea093b29520161d69eb84c7db6d92d
Python
2,545
72
from typing import Optional import torch from torch import nn __all__ = ["MILModel", "Attention"] class MILModel(nn.Module): def __init__( self, n_feats: int, n_out: int, encoder: Optional[nn.Module] = None, attention: Optional[nn.Module] = None, head: Optional[nn...
bac6484716f7af34f1b49ad8787a39b54520ba1981a1f0aa1e702b639a55dc80
Python
2,545
80
from typing import List, Tuple from ray.autoscaler._private.util import format_readonly_node_type from ray.autoscaler.node_provider import NodeProvider from ray.autoscaler.tags import ( NODE_KIND_HEAD, STATUS_UP_TO_DATE, TAG_RAY_NODE_KIND, TAG_RAY_NODE_NAME, TAG_RAY_NODE_STATUS, TAG_RAY_USER_NO...
a3b422f881cf0b657b45b4d1eeeff63ab5ee95cf50e9c44670d03eda79ddf525
Python
2,548
62
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
beaefd2662df36a5d4a31572c5e660a3d68c844d3752d1590b0d17306e4d847b
Python
2,548
91
_base_ = [ '../_base_/datasets/duo_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='FCOS', data_preprocessor=dict( type='DetDataPreprocessor', mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0],...
f63b23f9f56ba8861329e524ef39a3347e4a0340005e85697a1a6ee28eab66cc
Python
2,549
76
# -*- coding: utf-8 -*- import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set(style='white', palette='colorblind', context='poster') n_dim = 16 n_context = 2 bank_size = 3 percept_noise = .2 n_tps_per_context = 5 T = n_tps_per_context * n_context contexts = [np.random.normal(loc=0,scale=1,s...
c6ff4a4251033bf066f3b0d02a56a4abbe8d677d8835db7b9e7beebc50fcb83b
Python
2,550
81
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
df80423c3879dc4f274ac0708226b3ee6f978d76e4a072e2f72af1831682eef2
Python
2,550
92
import os import time from contextlib import contextmanager from typing import List, Optional, Tuple import numpy as np import ray # Only run tests matching this filter pattern. filter_pattern = os.environ.get("TESTS_TO_RUN", "") skip_pattern = os.environ.get("TESTS_TO_SKIP", "") def timeit( name, fn, multipl...
195aae127fb16b528016e51edf9d8a5018b581dbafe9b8b1a02797dbf1c4e450
Python
2,551
75
# dataset settings dataset_type = 'BasicImageDataset' data_root = 'data/uw_enhance/' file_client_args = dict(backend='disk') train_pipeline = [ dict(type='LoadImageFromFile', file_client_args=file_client_args), dict(type='LoadGTImageFromFile', file_client_args=file_client_args), dict( type='TransB...
6c33b47d6676f4f5034607bc69c99774ebbf90fc142957e390c3e9c1a3f9facc
Python
2,551
63
import math import json import argparse import itertools from pathlib import Path from tuner import KernelTuner def forward_params_list(N): blocksize_params = ('MAX_BLOCK_SIZE_VALUE', [64, 128, 256, 512, 1024]) thread_value_default = [2, 4, 8, 16, 32, 32, 32, 32, 32, 32] thread_values_supported = [2, 4, ...
00ea95d5a6dc20f3c8d4d465f9feb4dde25ef976637ac632078f43f3632fd9a4
Python
2,552
91
_base_ = [ '../_base_/datasets/ruod_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='FCOS', data_preprocessor=dict( type='DetDataPreprocessor', mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0]...
13b5b23e3db85fcd07acd8f8e0ca223a4811e2d65bdd749c2d772e0a632d8e92
Python
2,552
79
""" _*_ coding: utf-8 _*_ """ from sklearn import cluster from sklearn.manifold import TSNE import os import numpy as np import pandas as pd import pickle as pkl class Clustering: def __init__(self, input_data, static_data): PD_cohort = list(static_data[static_data['case_control_other_at_baseline'] == '...
728fb7bff87a30b77c7445bdccc19d22072fb55865321d17f9eb9c83fa970916
Python
2,552
94
from django.shortcuts import render from django.views.decorators.cache import cache_page from rapppid_org.settings import TEMPLATES, STATIC_URL from glob import glob import markdown import os.path import re def index(request): return render(request, "index.html") @cache_page(60 * 60) def privacy_policy(request):...
97def89923c2725e4c3f497b8261ee965c83decd1efc2b99b5dd88fdc185983a
Python
2,552
86
_base_ = [ '../_base_/datasets/duo_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='ATSS', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.37...
4faae21361e1623dfa768ef857efac7191d00fe62265f222125664f188b9c1d5
Python
2,553
92
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...