sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b5c9e45058005dc86aa33151c1bf57f07a1fb805c1ef2b88a01acdc77328a078
Python
5,365
166
# %% from pathlib import Path import h5py import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch from fastai.learner import load_learner from PIL import Image from marugoto import mil from marugoto.mil.data import get_target_enc __all__ = ["plot_top_att_tiles_", "plot_top_att_from_df_"] ...
d0ef00013dfb9bcb2fa07ede09db1f2b65a4479ba61066eba49bd6c5bb86be68
Python
5,368
154
# 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...
6da6a70ffba23824154eb6192d32d7b8fc4761e890059e054fe083e9a83184ed
Python
5,369
140
r"""``ov.epi.pp`` — epigenomics preprocessing (wraps :mod:`epione.pp`). Quality control, fragment ingestion and feature-matrix construction for single-cell ATAC-seq, delegating to `epione <https://github.com/aristoteleo/epione>`_. Each function imports epione internally, so importing omicverse stays cheap. Typical sc...
86f5b4bc8185cdb3341355452d5c4fa74a0fb6be5c97470a8c99b9efb24e68e8
Python
5,369
210
import csv #import itertools #import operator #import numpy as np #import nltk import os #from rdkit import Chem #from rdkit.Chem import Draw #from IPython import display #import matplotlib.pyplot as plt #from rdkit.Chem import Descriptors """ def zinc_data_with_bracket(): sen_space=[] #f = open('/Users/yan...
3a3994038396121256ecd0411db2f5c53d739a591cad3c78c60fe2cacd76770f
Python
5,372
172
# Copyright 2023 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, ...
f2b226af8634e25a7f9bcfea9699fca482b1eed3bb698dcb0600e1914f016821
Python
5,374
188
import torch import torch.nn.functional as F from math import exp def gaussian(window_size, sigma): gauss = torch.Tensor( [ exp(-((x - window_size // 2) ** 2) / float(2 * sigma**2)) for x in range(window_size) ] ) return gauss / gauss.sum() def crea...
e9fad503a7bff6a700f9892ab3596c9470099fa8b54ee5b352fe319f97956ac3
Python
5,380
121
#################################################################################################### # 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...
7b1bf39692b98876b8628ec572043686db320a1f693d679fa4f6f99ae89fe21d
Python
5,381
160
# Copyright 2023 The HuggingFace Team. All rights reserved. # # 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 applicabl...
1306123e714b4f3ca932cda3f7093eec117751ddf2aa4069ae6948d78fb0264c
Python
5,383
134
import math import torch from torchEnKF import nn_templates from torchdiffeq import odeint_adjoint from torchdiffeq import odeint from tqdm import tqdm import os import sys sys.path.append(os.getcwd()) # Fix Python path def generate(ode_func, obs_func, t_obs, x0, model_Q_param, noise_R_param, device, ode...
fe21fab07090a8869d8385691d7ad0abe877b37e250d25dabcf3441eee6f1a84
Python
5,384
104
import os import torch import random import pandas as pd from model import PretrainModel from dms import ProcessingData, train_model, validation_model, test_model ####################################################################### # predifined parameters ############################################################...
0659c6a72a30cd63f4c2b2cfb28b855922f5564658ecf18f307c22e75e4d12df
Python
5,385
194
""" Implementing "a network with residual connections" example in https://github.com/synsense/sinabs/issues/181 """ import torch.nn as nn from sinabs.activation.surrogate_gradient_fn import PeriodicExponential from sinabs.layers import IAFSqueeze dcnnl_map_1 = { 0: { "input_shape": (2, 34, 34), "...
47a074756e88b5f24e96b57e9827b5f35a11cd0088014ca2267d37c45054cdb1
Python
5,390
128
import matplotlib.pyplot as plt import pickle import numpy as np import sys import os # from Step_7_util import * from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve np.set_printoptions(threshold=sys.maxsize) def main(): splam_v2_j_shuffle_pred_prob = []...
4f588fcabbf2ed2ed0996a5934d2a0dd267617bf0d982673ace39bd450b1a4dd
Python
5,390
165
from array import array import os from pathlib import Path import pdb import pickle import numpy as np import oci from multiprocessing import Process from multiprocessing import Semaphore import ocifs import torch import yaml # Number of max processes allowed at a time concurrency= 5 sema = Semaphore(concurrenc...
d297839f8dc78a9e3d60da9fabef984b7e19f58927d63e306dabe886d8fe2cf0
Python
5,392
173
"""Database utilities and initialization.""" import logging from typing import Optional from sqlalchemy import create_engine, event, text from sqlalchemy.orm import Session from sqlalchemy.pool import Pool from src.models.base import Base, init_db from ..config import settings logger = logging.getLogger(__name__) ...
ef214b97f86434fd458b9a718774e84a8a46f1562c02932f2dd5caccdbab4ff3
Python
5,392
63
"""Merge event related average measurements into a single nifti.""" import os import subprocess import numpy as np import nibabel as nb import glob # ============================================================================= FOLDER = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti/derivatives/sub-06...
5a436de56ba636669eff4ec0ee6578ee7096d32103db587e5658c7b1e0c6db8d
Python
5,393
191
""" This module contains utilities for processing cortical surface drawings. In general we take these as given (they even take precedence of e.g. the upper and lower surfaces of layers 1 and 6b for instance), but some drawings pose resolvable problems. The main such problem occurs when cortical layer drawings exten...
d70f400e32f0ee54e3ddc98628432727bd967b00e91fe4aef1856f32ee64ec4a
Python
5,393
197
# flake8: noqa """ Cross-node parallelism examples for Ray Serve LLM. TP / PP / custom placement group strategies for multi-node LLM deployments. """ # __cross_node_tp_example_start__ import vllm from ray import serve from ray.serve.llm import LLMConfig, build_openai_app # Configure a model with tensor parallelism a...
67af56eeec4d87fd79fc8c6a399112e9e9ac5cb4efe7ef219513fc4b088c4be6
Python
5,395
133
""" Functions to identify TE-dependent and TE-independent components. """ import logging import numpy as np from tedana import utils from tedana.metrics import collect from tedana.selection.selection_utils import clean_dataframe, getelbow, getelbow_cons from tedana.stats import getfbounds LGR = logging.getLogger("GE...
4a29923a91472e0aaa4e1ef4bd16fe92998f2be900d62ed9c13496b3f5eb7f24
Python
5,397
174
from typing import List, Optional from itertools import chain import math import torch import numpy as np from scipy.spatial import Delaunay import scipy from anndata import AnnData def alpha_shape(points, alpha, only_outer=True)->List: """ Compute the alpha shape (concave hull) of a set of points. P...
5842df464032cd56c161c6ae1408d1ce7d4e5ea3af4dae6d269c6d0e2f70bf7d
Python
5,398
162
import collections import numpy as np from neuron_morphology.validation.result import NodeValidationError as ve from neuron_morphology.constants import * def validate_radius_threshold(morphology): """ This function validates the radius for types 1, 3, and 4 """ result = [] soma_radius_threshold = 35 ...
fd6c674be39a763a86f6299682ff95e8e3ef1a2f6d34c281a780b6ed00c90a37
Python
5,398
143
"""Real scRNA-seq data for the ``ov.single`` metabolism tutorial. Loaders download a dataset asset from the ``omicverse-data`` GitHub release (``metabolism-v1``) on first use, cache it under ``dir``, and return it ready for the single-cell metabolism workflow (:class:`ov.single.Metabolism` — scMetabolism / Compass / s...
85037b2c3ca9ca8c525ae1b365835e13a9bf9bfd46e240cfbf87e1a0deb72f55
Python
5,399
112
# -*- coding: utf-8 -*- """Rolling shutter diffuserCam utility functions. Heavily referenced from Nick Antipa's MATLAB code:: https://people.eecs.berkeley.edu/~nick.antipa/antipa_files/hsvideo_code_with_data.zip """ import numpy as np from skimage import io as skimageio import skimage.transform from absl import ...
0be9fc03028a604cd70de9d60c9102575b64e305379908be40b8cc4cd20b660b
Python
5,400
131
import numpy as np import torch import pickle import lpips from eval_fns.eval import Masked_MS_SSIM, compute_convolutional_max_metric, compute_convolutional_min_LPIPS from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct import lib.dataset_config_parser.dataset_config_parser as dcp from lib.datas...
67d49fab06dc637d194c81a6691256aedf7a2acb9cfe0eff1a1a2896d001816c
Python
5,400
107
from loguru import logger import os import argparse import random import numpy as np from deltasplice.utils import MutGenerator, GetSummaryStatisticsCallback from deltasplice.models.model_utils import ( get_available_gpus, ) import torch from torch.utils.data import DataLoader import copy import deltasp...
0b851b5f2898ea81fda91bfe4db63d5704ae38ffc733c11f3b9a9f4f3109cb87
Python
5,401
142
import requests from .__config import base_url from .__aux_funcs import process_response def get_all_sample_lists(projection="SUMMARY", direction="ASC", pageNumber=0, pageSize=10000000, sortBy=None): """ Get all sample lists. \n :param projection: Level of detail of the response. \n Possible values...
339d502454f66875712c773d6dbe6a831ae5dffb3e3337ae67b8ebf0072e2376
Python
5,405
177
""" 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 numpy as np import pytest import torch from ase.geometry.geometry import general_find_mic from ...
febe3598ca493739f6aeb14523eaabce945b064d5e8fe00871e660a97e168c83
Python
5,405
151
import torch import torch.nn.functional as F import torch.nn as nn import math from models.DeepLab.modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d import torch.utils.model_zoo as model_zoo def conv_bn(inp, oup, stride, BatchNorm): return nn.Sequential( nn.Conv2d(inp, oup, 3, stride, 1, bia...
9171f0e1d09967cd37843acc4bba983d6a75d15bb9d33c22347c44351ee7c8a8
Python
5,408
134
#!/usr/bin/env python # import ## batteries from __future__ import print_function import argparse import logging ## 3rd party import networkx as nx from networkx.algorithms.dag import descendants from networkx.algorithms.lowest_common_ancestors import lowest_common_ancestor from networkx.algorithms.shortest_paths.unwei...
b82d7edb5e52a8ae57f015e31584d533ac3c16ec50aa285e07bb861fbaf07470
Python
5,408
160
import torch import torch.nn as nn import torch.nn.functional as F from .utils import preprocess_graph class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super(...
5e56df01fb32fbc8f020206a3ecb663242fae4918ee29a62f9ade3be659da166
Python
5,410
127
#################################################################################################### # 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...
c643a69478a931b52fbb6519ade7b6a8470358de84004209be1ddcab926d4886
Python
5,411
171
from imports import * # Lazy import from ngs_mapper.bqd import ( G, N, LC, LQ, LCQ ) class Base(BaseTester): modulepath = 'ngs_mapper.bqd' def setUp(self): pass def _make_lineargs(self, regiontypes): lineargs = {} for r in regiontypes: lineargs[r] = {'color':r,'li...
cd0fad9d935b0cae6e4a2c55a15be1f68770efab182ce11f7cce63862cb4e323
Python
5,411
149
import torch import torch.utils.data as data import os import random import glob from PIL import Image from utils import preprocess import numpy as np import cv2 class DMData(data.Dataset): CLASSES = [ 'BG','DM' ] def __init__(self, root, train=True, test=False, inference=False,transform=None, tar...
00b3af740da6417e13470b0faf5b017ba103528550316e862c2f844e65bfcd07
Python
5,413
86
proj_dir = "/path/to/main_project_folder/" # edit this line import numpy as np import pandas as pd import xarray as xr import dask.array as da import glob as glob from functools import partial import os import sys sys.path.append(proj_dir) from project_fxns import load_region from project_fxns import fxns import impor...
7a9cad2395ee3e7a62704022e61bdc2bc993232fec42e91fa8b6e364babbab39
Python
5,413
152
import os from concurrent import futures from typing import Any, Optional, Sequence, Tuple import grpc from grpc import aio as aiogrpc import ray from ray._common.tls_utils import load_certs_from_env from ray._private.authentication import authentication_utils def init_grpc_channel( address: str, options: O...
6804b3aa15e53e3c42bee2e59435f878734e9372888b82742aa0c8fce233ebb7
Python
5,414
132
from loguru import logger import os import sys import json from deltasplice.constant import CL, EL, Fapath from bisect import bisect_left import numpy as np from pyfasta import Fasta from pyliftover import LiftOver SavePath = "data/sQTLs" def parse_line(line, i): line = line.replace("\n", "").split("\t") Na...
8f1f681073d45a5a7a1c341602ef12f12846100d4f9cc5609fefc58a229295aa
Python
5,414
224
import time from typing import Any, Type import pytest import ray from ray.air.execution._internal import Barrier from ray.air.execution._internal.event_manager import RayEventManager from ray.exceptions import RayTaskError @pytest.fixture(scope="module") def ray_start_4_cpus(): address_info = ray.init(num_cpus...
a8f753f94e4108c361c08e25508b826b91a82e28ab1a4b7efea924e6c58de2a0
Python
5,414
173
# Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. import os import json import torch import clip from PIL import Image import numpy as np from torch.utils.data import dataset import torchvision.transforms as transforms from bert_embedding import BertEmbedding from timm.data.constants import IMAGENET_D...
ea63613af6ae7074c5a35604fc88068580df8ef909b79484b7d44c68e31c75f1
Python
5,414
120
#################################################################################################### # 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...
ebf648470cef49ae678c0890410df25dd874bdfe0159f4e7d78e5b08ccb9bf0b
Python
5,416
126
import scipy.io as sio import os import numpy as np import h5py import sys # from skimage import filters from scipy.ndimage import gaussian_filter import time import multiprocessing as mp sys.path.insert(1, '../SUNS2') # the path containing "suns" folder from suns.PreProcessing.preprocessing_functions import preproces...
8163ce294b949388dc2134dc1bf792b44fac7286db0ef812dc0c1ad1d7aa21b7
Python
5,418
152
# coding=utf-8 # Copyright 2023 HuggingFace 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 ag...
7691ce13feab9367b77364d4de6d296f7990a0097052f477c458f99fc1c4ae3e
Python
5,419
197
""" Utilities for the chord diagram. """ from collections import defaultdict import numpy as np def dist(points): ''' Compute the distance between two points. Parameters ---------- points : array of length 4 The coordinates of the two points, P1 = (x1, y1) and P2 = (x2, y2) in th...
ca8cea9a94f29eeeebec4e477c3e5807e52317d1f4dd07b6c76ac7600c13ff7f
Python
5,419
129
#################################################################################################### # 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...
eccdc3aebb44d3879a256b3c272b38a041b84b1aec08dc50101ce847d1870ff0
Python
5,419
122
import torch import numpy as np import argparse import pickle from typing import List from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct import lib.dataset_config_parser.dataset_config_parser as dcp from lib.dataset_config_parser.dataset_config_parser import read_config_file import lib.data_uti...
efc98320783eecfae712d25a4154cb1850e3bb8411e0017dd38e1aa8d2e35064
Python
5,420
124
import random import numpy as np from projectmetis.python.logging.metis_logger import MetisLogger class DataPartitioning(object): def __init__(self, x_train, y_train, partitions_num, seed=1990): self.x_train = x_train self.y_train = y_train self.partitions_num = partitions_num s...
874dce25cd8c1907a2358d9fcf14a0a317e272653bd55a8f1dca1c3f161f11f1
Python
5,423
148
import torch import torch.nn as nn from torch_geometric.nn import GCNConv, NNConv, GINConv, GATConv, Set2Set class GNNm(nn.Module): def __init__(self, n_features, hidden_dim, n_classes, n_conv_layers=3, dropout=0.1, conv_type1="GIN",conv_type2="GIN",batch_norm=True, batch_size=128): supe...
ba6770ec40684c39634ecc51c436269a0da5849956f2f9a5c880382aa86a57c5
Python
5,423
179
""" 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 os import random from functools import partial import numpy as np import pytest import torch f...
e679d78f8a2eff05a1329d62ca3ffade1954bd41a311c51bc340f1342522b0fa
Python
5,424
142
r"""Convenience loaders for 10x Visium demo datasets used by HE-zoo. Two adjacent sections from the same patient/block are pre-wired: * **Section 1** (``load_breast(section=1)``, the default) — used as the reference / training slide across all HE-zoo tutorials. * **Section 2** (``load_breast(section=2)``) — the *he...
ed3386f9b79d4513e49f06918f31e136d88f262e56d2f24592c820a2dbb17a09
Python
5,424
152
"""Runtime-specific data location constants and associated helper methods. TODO(everyone): * Add more datasets and data types as needed. * Update logic to determine runtime as needed. * Update Cloud Storage and persistent disk paths as needed. """ import collections from enum import Enum, auto import os class Runti...
f03f3a267da8de7e753dc42c79df25d8cc4a473ad0464878995245080f4876c5
Python
5,424
168
from dataclasses import dataclass from torch import nn import torch from tqdm import tqdm import pdb from latent_time_stepping.time_stepping_training.train_steppers import BaseTimeSteppingTrainStepper @dataclass class EarlyStopping: num_non_improving_epochs: int = 0 best_loss: float = float('inf') patien...
299cb111afa7e91ce19dee85b138325e5ede439590276c16ffeadeff48c77605
Python
5,426
140
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 9 10:24:09 2023 @author: hansav """ import os import pickle import pandas as pd import numpy as np import pcntoolkit as ptk from pcntoolkit.dataio.fileio import load as ptkload from pcntoolkit.dataio.fileio import save as ptksave from pcntoolkit....
96914017e251b521140306ddf5a997c210d305e6ac3c1ef0738088d0d05c1ff6
Python
5,427
134
#################################################################################################### # 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...
9de154990cd71786a0ce7325e5f635e6574b23a95a23a06b2db156a932df7943
Python
5,431
140
# -*- coding: utf-8 -*- """ Pairwise functional alignment. ============================== In this tutorial, we show how to better predict new contrasts for a target subject using source subject corresponding contrasts and data in common. We mostly rely on python common packages and on nilearn to handle functional da...
1b0f8388a73a3699768ed254716556a0d5ee91f7eb1453f4a86a92caaed97b80
Python
5,432
165
import unittest import numpy as np import neuron_morphology.features.layer.layer_histogram as layer from neuron_morphology.feature_extractor.data import Data from neuron_morphology.features.layer.reference_layer_depths import \ ReferenceLayerDepths from neuron_morphology.features.layer.layered_point_depths import...
9607f6c2cfdeb51813b4845013e5568b5ef5fac6fb00b5904a95b4bf19800fcc
Python
5,432
98
import os from typing import Optional, Sequence, Tuple, Set from sv_utils import pedigree_tools class Default: resources_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources") ped_file = os.path.join(resources_dir, "1KGP_2504_and_698_with_GIAB.ped") random_seed = 0 class SubsetData...
cf93e1bb203d17fcd07bc761891245fc80ad3f9ab720a8cacec84c1c217dd489
Python
5,432
155
from ray.dag import DAGNode from ray.util.annotations import DeveloperAPI @DeveloperAPI def get_dag_node_str( dag_node: DAGNode, body_line, ): indent = _get_indentation() other_args_to_resolve_lines = _get_other_args_to_resolve_lines( dag_node._bound_other_args_to_resolve ) return ( ...
3c0f85854c912ef301e0fb2fb0151e0fcf968f9abba6b253a7c0fc12d863defa
Python
5,433
159
from numpy.random import seed seed(1) import tensorflow as tf tf.random.set_seed(1) import random random.seed(1) import tensorflow as tf import csv import numpy as np import SimpleITK as sitk import matplotlib.pyplot as plt from numpy import argmax import pandas as pd import tensorflow.keras.backend as K ...
50f5f6a1c8307be8481bd6459830ded848eab1bd6e9de60a18ee72bd07991a4e
Python
5,433
136
# -*- 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 quantized tile functionality.""" from typing import Union from pytest import mark import torch from aihwkit.nn import AnalogLinear from aihwkit.s...
e4b2a1cd3219c8fd71d0216b1cd2186b4d3891117a6354e1363ef013c2e701ae
Python
5,437
149
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Wed Sep 20 17:52:23 2017 Basic demo for the OnACID algorithm using CNMF initialization. For a more complete demo check the script demo_OnACID_mesoscope.py @author: jfriedrich & epnev """ import os import numpy as np import pylab as pl import caiman as cm f...
5ec45febe7020a8f733951b9da8c0950256511dced5f6e2d6c34d4a3a8de7de6
Python
5,438
133
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, absolute_import, division from six.moves import zip from tifffile import imread from collections import namedtuple from itertools import chain from ..utils import _raise, consume, axes_check_and_normalize from ..utils.six import Path, Fil...
115e2a8c885c72638c631a30dcfc1481444ffb9acc8cef482e20e6260e7df2c7
Python
5,440
171
''' check if we can cluster the scene vectors in particular, can we derive good clustering parameters from the training set and generalize to the validation set this is essential for the clustering based shortcut model to work ''' import os import pickle import numpy as np import pandas as pd import seaborn as sns imp...
51307089f59e98f66988d038964982eb5bb59d9ee310b4773c581dfa6b284f54
Python
5,441
152
import asyncio import logging import random from typing import List, Optional from packaging.version import Version import ray.dashboard.optional_utils as dashboard_optional_utils from ray._common.network_utils import build_address, get_localhost_ip, is_localhost from ray._common.utils import get_or_create_event_loop...
6bcbb68838c1804108245a10d5ad51fe2854d81a5b64c031129d298257d545d3
Python
5,442
192
import os import pdb from matplotlib import pyplot as plt import numpy as np import yaml from yaml.loader import SafeLoader import torch from latent_time_stepping.AE_models.ViT import SimpleViT, ViTEncoderLayer from latent_time_stepping.oracle import ObjectStorageClientWrapper from latent_time_stepping.utils import cr...
49f2dd325eba8537209aec165e5a2a8fa247f1b87fc6c48920cfc8d80d55fe44
Python
5,444
139
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 9 10:24:09 2023 @author: hansav """ import os import pickle import pandas as pd import numpy as np import pcntoolkit as ptk from pcntoolkit.dataio.fileio import load as ptkload from pcntoolkit.dataio.fileio import save as ptksave from pcntoolkit....
10a79eccc7afa8dfd95d5a0fc53c01ec96fbf15f6043a738f0b29ad1c754e384
Python
5,445
176
import time import numpy as np import torch import torch.nn as nn import torch.optim as optim from config import args from dataloader import DataLoaderSubstructContext from models import GNN from torch_geometric.nn import global_mean_pool from util import ExtractSubstructureContextPair, cycle_index from datasets impo...
98b09cef4df0382350b6665a1ccde6991a064d090951c5a95668222a9e887085
Python
5,445
219
#!/usr/bin/env python import os import librosa #mfcc 1.st lib from scikits.talkbox.features import mfcc # 2'nd lib # import python_speech_features # 3rd lib import os.path import numpy as np import subprocess AUTOMATIC_ALL_VOICES=False # list voices: `say -v ?` # good_voices = [] #AUTOMATIC !! good_voices = """ Agnes...
54e6799efb02c5e2409e90334c9e694d87e39d732b1998cb2988152536ddd447
Python
5,446
115
# Copyright 2024 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, ...
6dace6045ee3a4b29caf3e0928e558c40e03dbae7d1c49c0051ab50919645ab7
Python
5,447
109
import os import torch import pandas as pd from model import Model from data_ddG_dTm import ProcessingData, train_model, validation_model, test_model, convert_batch_data ####################################################################### # predifined parameters #####################################################...
24f9ead08358adfb4e2eb79a1dbbccb9c9fb765692bc50801ffbe893c85bf55d
Python
5,448
112
import pandas as pd from src.commons.process_dataframe import rename_df_col, insert_new_col, insert_new_col_from_two_cols from src.commons.process_number import cal_SEM def get_percent_triplets(percentpairs): if percentpairs == 1: return 0 elif percentpairs == 0.75: return 0.25 elif perce...
3b7c09782da5e4f368ac53e1273a35551c28db250105a8bf6993d1bdcb1c4ace
Python
5,448
141
import numpy as np import matplotlib.pyplot as plt import math from matplotlib.ticker import FixedLocator,FuncFormatter plt.rc('font',size=15) ruptime=[] rdowntime=[] puptime=[] pdowntime=[] rupnumber=0 rdownnumber=0 pupnumber=0 pdownnumber=0 point=20 upstate=28 downstate=12 Exp=0 def Fsign(data)...
df6d7a0615ab07b4e277f482785efc10ddacd8e7116ecb4e66b7648fbfb45d3e
Python
5,449
122
#################################################################################################### # 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...
fb72fe3f2dc72569b0d9e1ffe25b9517a98112392450d74618942e95274eeddd
Python
5,449
209
import gc from typing import List import torch from rdkit import Chem from utils.rerank import rerank_predictions CUDA_OOM_ERROR = getattr(torch.cuda, 'OutOfMemoryError', None) def check_valid(smi): mol = Chem.MolFromSmiles(smi) return mol is not None def _strip_tokens(smi, begin_token, end_token, pad_t...
50ad21f64f5b80b003fb67e2feac7b2eec5153198542acc8300e1ca6d8367195
Python
5,452
167
''' check if we can cluster the scene vectors in particular, can we derive good clustering parameters from the training set and generalize to the validation set this is essential for the clustering based shortcut model to work ''' import os import pickle import numpy as np import pandas as pd import seaborn as sns imp...
bdc0612410b2b6e9317802eb85e9a650a473c0875ba2d918d6792575d0ee0896
Python
5,452
136
# import the main libraries required for the preprocessing from pathlib import Path import numpy as np import matplotlib.pyplot as plt import os # import homemade function from technical_validation_utils import subjects # %% # NB: run_emg.py must has been runned before running the average emg_dir = [Path('./emg...
8e80eaa4420c937b4e31f039a2bc52a846788c7f27d542178514a54cec821d07
Python
5,455
155
# --- START OF FILE token_counter.py --- import tiktoken import logging import json # Added to enable JSON conversion from typing import Tuple # Set up logging for the token counter logger = logging.getLogger('token_counter') logger.setLevel(logging.INFO) handler = logging.FileHandler('logs/token_counter.log') handle...
acc896ee2312b4b8db42ec6c400423fd89d5f7a56d46ba3d9d8ebfecfef93208
Python
5,457
160
# -*- 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. #...
b9766c283946b10158faeb0412d24899b038a22aa0e9af94e2570d48895f4aec
Python
5,458
142
#################################################################################################### # 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> # # The code in this fi...
ff5740ca3ea1e32ca8f2f3b60d1546a3ef36624e813495e46842a0a42abd08ac
Python
5,458
152
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022 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. # # Any modif...
31a23e0a8ab5dd4a5c40858d6519b1260d06c9c8a526d0350e4be132838a76f1
Python
5,462
140
import numpy as np import argparse import subprocess import datetime import time import os import pandas as pd import glob as glob def string(boolean): if boolean == True: return "true" else: return "false" def loop(output_dir, params, param_names, values = [], depth = 0, **kwargs):...
5e78591522308baab1768974751fb1dbda54cadfaee7348e143612479ec9c0c1
Python
5,462
117
# Copyright 2023 The HuggingFace Team. All rights reserved. # # 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 applicabl...
2bce98279d68798c18755b9ee4151928b975d2cdd1931ecd9176fd7588ebd7eb
Python
5,464
166
"""Unit tests for PlatformEventsHead module. Tests verify the core caching, deduplication, eviction, and REST API logic inside the central PlatformEventsHead controller. """ import sys from unittest.mock import MagicMock, patch import pytest from ray._private import ray_constants from ray.core.generated.events_base...
8494f90bfa7bedac8d0e015e29c21f1d031d502ccef50139acd8a78dfdd61562
Python
5,464
116
#################################################################################################### # 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...
85e4a8788103df2f170ce3550550ccee27478704de1ac0df2a372540f7370542
Python
5,465
134
# Ultralytics YOLO 🚀, GPL-3.0 license import signal import sys from pathlib import Path from time import sleep import requests from ultralytics.hub.utils import HUB_API_ROOT, check_dataset_disk_space, smart_request from ultralytics.yolo.utils import LOGGER, PREFIX, __version__, checks, emojis, is_colab, threaded AG...
24412168e98f81cb304ddbed1d1cf5df2725f892923544d2836fc93672b40351
Python
5,470
122
def predict_nmd(gencode, transcript): ''' Aim: Predict nonsense-mediated decay for transcript using: - ORF prediction from CPAT --> ORF length, start and end - Blat analysis of Best ORF.fa from CPAT to mouse reference genome --> genomic coordinates of CDS ## Assuming if there is only one ...
07f47d3886482fd5d6d15ed14c89930cd13399f2e22fa4ea3f3272eae29c8c07
Python
5,471
131
r"""Vendored `PrimeDesign <https://github.com/pinellolab/PrimeDesign>`_ — the Pinello-lab reference pegRNA/ngRNA designer (Hsu *et al.* 2021). PrimeDesign is a pure-stdlib Python tool (no heavy deps). We clone it on first use and drive its command-line script, converting an ``ov.synbio`` edit (``target`` + ``edit_pos`...
3a2c2334f56c6d4081580b0b862a0e2b5ae12efe47bb61d139f0f665d35c5077
Python
5,471
129
from loguru import logger import os import sys import json from deltasplice.constant import CL, EL, Fapath from bisect import bisect_left import numpy as np from pyfasta import Fasta from pyliftover import LiftOver SavePath = "data/sQTLs_neg" def parse_line(line, i): line = line.replace("\n", "").split("\t") ...
43cd6ad60ef3e550f5398f41dd1e7fba03145398a0ea1d131923310c2d34b3ad
Python
5,471
168
# Copyright 2023 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, ...
0f4615f2028873a455402f48c5ac2249878b1707108ade8d5af2c9791dc328f8
Python
5,472
102
import os import argparse import subprocess import multiprocessing from utils.generate_folds import generate_kfolds from utils.tools import ROOT_PATH, absolute_path """ Train and test the SNN pipeline (CSNN + Readout) with K-fold cross-validation. The input directory must contain the datasets to the format <X_{set}....
4e3611794a95cdfee91b6996c7d77b551d4fad467f52b503050e92759fbd5e8a
Python
5,472
147
# general imports from openmm import LangevinIntegrator from openmm.app import ( PME, CharmmParameterSet, CharmmPsfFile, CharmmCrdFile, PDBFile, Simulation, ) from endstate_correction.constant import zinc_systems, blacklist from endstate_correction.analysis import plot_endstate_correction_result...
7c6a6550b8f00ca04e46293b32d35bd26a701bbed173874438467cc9a887ccc2
Python
5,472
157
import sys import os sys.path.append(os.path.dirname(os.path.abspath(__file__))) import numpy as np import pandas as pd from random import choices from random import sample from itertools import combinations from scipy import stats import itertools import tensorflow as tf from tensorflow import keras from tensorflow.ke...
27ee74d92e722f4f661ab0f3142a1d3ee75da57ddfb0ec9d375184d4676e8c6a
Python
5,474
141
import re import torch import numpy as np import os from batchgenerators.dataloading.data_loader import DataLoaderFromDataset from batchgenerators.dataloading.multi_threaded_augmenter import MultiThreadedAugmenter from batchgenerators.datasets.cifar import HighPerformanceCIFARLoader, CifarDataset from batchgenerators.t...
533c377a8c7d1ef4f1b9888e86ee51b20f645e7c7dbf3a456ed84b070ab0b732
Python
5,474
138
import asyncio import logging import os import time from concurrent.futures import ThreadPoolExecutor from typing import Union import ray._private.ray_constants as ray_constants import ray.dashboard.consts as dashboard_consts import ray.dashboard.utils as dashboard_utils from ray._private.authentication.http_token_aut...
f7b13d6bd634f7ac44e70b721fda2af64f225cae37cd30018e5a8e5562cfa90c
Python
5,474
161
#!/usr/bin/env python3 """Verify a soft-wrap pass changed nothing but whitespace. For each target file, compares the current (transformed) content against a reference -- either a git ref (the pre-transform state) or a reference directory -- on three deterministic axes: 1. Content invariant non-whitespace bytes id...
d44cacddd07c4044725935f09d0fd9719d34cce5ee90722d6fa8633516ac3836
Python
5,477
192
#!/usr/bin/env python from __future__ import print_function import subprocess import os # BEDS = [ # # 'np_pb_intersect.bed', # # 'np_pb_int_gte10.bed', # # 'np_pb_int_gte5.bed', # # 'np_pb_int_gte15.bed', # 'int_gte5_2xmed.bed', # 'pb_gte5_2xmed.bed', # 'np_gte5_2xmed.bed', # # 'gatk_...
127c5aed3be5ab2fd0b0e19de53a05219acc13790c1942e459b94adcc60e4025
Python
5,478
147
r"""Layer B — zero-shot variant-effect prediction (in-silico directed evolution). Score amino-acid substitutions with an ESM language model, no labels required. For a mutation ``p.A123V`` the effect is the log-likelihood ratio .. math:: \text{score} = \log P(x_i = \text{mut}) - \log P(x_i = \text{wt}) positive ⇒ th...
321236625ea38c7fe3fbb6b03b56dde5f5b93b3b7888a6588a8805d2ce6fa7d3
Python
5,479
160
"""Tests for the optional threemica bridge.""" import subprocess import sys import types import numpy as np import brainspace.plotting.threemica_report as threemica_report from brainspace.plotting.threemica_report import ( available_threemica_surface_maps, write_brainspace_threemica_report, write_threemi...
3ffa2f1df5ebee05e87b2e516529e08c44d9f863cb972d4cba6c5ca4d4980f1f
Python
5,481
134
import torch.nn.functional as F import torch from torch import nn class DecadeCELoss(nn.Module): def __init__(self, sigma = 5) -> None: super().__init__() self.ce = nn.MultiLabelSoftMarginLoss() self.sigma = sigma def forward(self, input, target): # input: B, 10 ...
5f8f15a7b6b2cf91efeda1b65b241f0e301109c068a2f575e4d88b706472fbd4
Python
5,481
169
import logging from typing import TYPE_CHECKING, List, Optional from ray.data._internal.object_extensions.arrow import raise_on_pickle_object_columns from ray.data._internal.util import _check_import from ray.data.block import Block, BlockMetadata from ray.data.datasource.datasource import Datasource, ReadTask if TYP...
caaca24156b59a2480715779fa1777c83eb9c62ffa03caa581f65ff38d576b29
Python
5,481
187
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
6d8ed3746f5647502e52d7b89191595ccb0299484b4bb3b3f69e37ec1176704b
Python
5,484
134
"""HTTP/TLS and IDNA compatibility; no external network, credentials or model files.""" import json from pathlib import Path import ssl import subprocess import tempfile import threading import unittest from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from urllib.parse import urlparse, parse_qs impo...
6f1f37083ba8393e320ddb9f5d0dc022df01e1400f65a9276a9806319146a324
Python
5,485
115
#Plot abundance distribution from glob import glob import os import pandas as pd import geopandas as gpd from src import start_cluster client = start_cluster.start(cpus=75,mem_size="10GB") ##Same data species_model_paths = ["/blue/ewhite/b.weinstein/DeepTreeAttention/snapshots/1ccdc11bdb9a4ae897377e3e97ce88b9.pt", ...