sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
eafe4673958198a3e3e114d0bfd994b5f6e4d5e0eeba628c21177ba89b378070
Python
6,709
172
from __future__ import annotations import logging import os import numpy as np import pandas as pd import scanpy as sc import scvi from .. import settings from ._base_algorithm import BaseAlgorithm class SCANVI_POPV(BaseAlgorithm): """ Class to compute a classifier using the scANVI model. """ def ...
c4be2a49bd6cc8c476bd77f3662003c5d28dee429ecbdb0f73df0abdfe036c10
Python
6,714
197
from __future__ import division import numpy as np import scipy.special as special # Import manually defined functions from .variational_nodes import ( Constant_Variational_Node, Beta_Unobserved_Variational_Node, ) class ThetaW_Node(Beta_Unobserved_Variational_Node): """ This class contain a Theta no...
dece605a7a863c20c71bd9904f11e384376578c11445e78f950641ce1eaff80f
Python
6,714
162
import json import logging import os from enum import Enum from urllib.parse import quote import aiohttp from aiohttp.web import Request, Response import ray.dashboard.optional_utils as optional_utils from ray.dashboard.modules.metrics.metrics_head import ( DEFAULT_PROMETHEUS_HEADERS, DEFAULT_PROMETHEUS_HOST,...
0633e018b82bb902d831b07dd7a967fb4d9de9e360c974ea6cfd0205a3111620
Python
6,715
190
import pickle import _reference_implementations import numpy as np import pytest import torch import cebra import cebra.attribution import cebra.data import cebra.models import cebra.solver from cebra.data import ContrastiveMultiObjectiveLoader from cebra.data import DatasetxCEBRA from cebra.solver import MultiObject...
1f418ee73cb8f2a97d431121575d280d72988c217ff65930d39c2279f77e8f89
Python
6,717
163
from typing import List, Union import numpy as np from rdkit import Chem import torch import torch.nn as nn from .mpn import MPN from GR_pKa.args import TrainArgs from GR_pKa.features import BatchMolGraph from GR_pKa.nn_utils import get_activation_function, initialize_weights class MoleculeModel(nn.Module): """...
b8af509e98897291bab6c96a46b842a2188c38816c46a0491da4d971ef7562c8
Python
6,720
174
# -*- 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. #...
2f8868d197216b3193e2c9b6ca0b8726602372d7df189f9f05df1e3aad01bc9a
Python
6,721
151
import os, sys import time import multiprocessing import numpy as np from functools import partial # Define path path_results = "../../Data/results" path_output = os.path.join(path_results, "curve_fits", "compare_fitting_methods", "beta_simulate_N_ntrials250") functions_modul = "../functions" # Importing module for f...
9d31351b6f165fd768060c6c3188612d772ae1607a23a141333babfed5dd3741
Python
6,721
148
import os import numpy as np from pyfasta import Fasta import json from loguru import logger from deltasplice.constant import Fapath, CL, EL, Train_Chromes, Valid_Chromes, Test_Chromes from deltasplice.utils import parse_bed_line import random from bisect import bisect_left def main(Data, Path): logger.info("ha...
1fe089ea2bcfcbd7e7c2d5ba47a90a299160e772877ff6fecbface6d4602731f
Python
6,722
155
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 a...
45de4b13c063732664935bc9e77640b3d6beac2f4a9510fb85520931b95c89cb
Python
6,722
190
""" 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. Unified Radial MLP: Computes all layers' radial functions in a single batched operation. Instead of running N separate RadialMLP forward passe...
8bdda067f77826f87329ef1f9972f28bf703f26702e63152f9e6d65223c53c5f
Python
6,722
193
#################################################################################################### # 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 library is fre...
f4a1a18295967076cf4328e63786fd6ec25984459bfaabc9d41a44f570503d8c
Python
6,723
195
#!usr/bin/python # -------------------------------------------------------------- # Compute a UMAP for each major celltype alone for visualization # Updated: 09/03/21 # -------------------------------------------------------------- import sys bindir = '/home/cboix/data/DEVTRAJ/bin/' sys.path.append(bindir + 'multiRegio...
45ed1e39aab8eb8c9f8a0843b13c1bfaa79714a4214ebe8d9a6e45a1a2958c0e
Python
6,724
145
import sys, os sys.path.insert(0, os.getcwd()) from src.models import get_model, get_trainer import torch from src.dataset.electrolytes import load_dset_electrolyte import torch.optim as optim from src.utils.argparser import parse_ecg_args, parse_eval_args, save_args from src.utils.random import merge_configs import n...
581afb62785367eae354543f25ef724d4123cae726843ea8966c3d6c5d00cd35
Python
6,724
152
import logging import re import pandas as pd from sklearn.model_selection import train_test_split from agent.data.entities.config import ROOT_LOGGER_ID from agent.data.entities.config import TRAIN_ITEM_FILTER, TRAIN_LABEL from agent.data.entities.config import DEV_ITEM_FILTER, DEV_LABEL from agent.data.entities.confi...
f695d2b6174d5c175fe0c8c67c4f4b5c7097af7859bc6730f2a94b2f87910a55
Python
6,724
205
"""Fixed GEO API methods.""" def get_series_matrix(self, gse_accession: str) -> Dict[str, Any]: """Get series matrix file. Args: gse_accession: GEO Series accession (e.g., "GSE1234") Returns: Series matrix data """ url = f"{self.geo_base_url}/acc.cgi" params = { ...
63f73bfa92d9eae79d8f38712c89bd8db501a9b66a75cfa1b76ec696e8c1b0fe
Python
6,727
208
import os import random from argparse import Namespace from typing import Dict, List # import nibabel as nib import numpy as np import pydicom import torch from torch.utils.data import Dataset from ldctinv.utils import load_yaml class LDCTMayo(Dataset): """Dataset class for the LDCT dataset""" def __init__...
5c340ebaee371a91b6d194052b787ba59e8238ab8afc02e493e6227a5bf11e5f
Python
6,728
125
#################################################################################################### # 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...
8977b0394a2296626f9e8155d8f45d1dfe987c9360097a24fbda58d1407bbbc0
Python
6,729
176
# -*- coding: utf-8 -*- """ Created on Fri Jun 28 08:42:00 2019 @author: ju-bar Calculations and data handling related to the Modulation Transfer Function (MTF) pixelated imaging detectors. This code is part of the 'emilys' repository https://github.com/ju-bar/emilys published under the GNU General Publishing Licens...
6880c51d7fab4b0ca5d9a3fcef45e6487f9baa1e2f9d478394e4fdcfc0cee615
Python
6,730
148
import os, sys import time import numpy as np import itertools import multiprocessing from functools import partial # Define path path_results = "../../Data/results" path_simulation_general = os.path.join(path_results, "curve_fits", "compare_fitting_methods") path_output = os.path.join(path_simulation_general, "search...
849b8f5e303cc41c5e423851d88f5e7ab76687a64ed96b13fb8d3725be1e8ea8
Python
6,730
222
# -*- coding: utf-8 -*- """ Created on Tue Jul 4 20:15:15 2023 @author: Leyang Xue """ import sys import numpy as np from multiprocessing import Pool # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation a...
45ebb1159767c5a86fecac69e1c36209ea25ba9f8315db63ad9c870f4d4b9135
Python
6,734
190
# Ultralytics YOLO 🚀, GPL-3.0 license import lap import numpy as np import scipy from scipy.spatial.distance import cdist from .kalman_filter import chi2inv95 def merge_matches(m1, m2, shape): O, P, Q = shape m1 = np.asarray(m1) m2 = np.asarray(m2) M1 = scipy.sparse.coo_matrix((np.ones(len(m1)), (...
6aebe8f8b479ee44c51afda9940fefcdacc4d48e79d8c6c3d0c250e03c9dff8c
Python
6,734
166
""" 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 warnings from typing import TYPE_CHECKING, Any import numpy as np from fairchem.data.oc.databas...
99582ad989fa474c06f6778ee3db4be04141aa04ed36b5491d743990b6ba488e
Python
6,735
181
"""Compare times to peak across layers""" import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pandas as pd # Load data data = pd.read_csv(f'/Users/sebastiandresbach/github/neurovascularCouplingVASO/results/ERAs_rawPlusZscored_equalizedNormalized.csv', sep=',') layerNames = ['Deep', 'Middl...
244f6f324481ae0feb7fdfa51cfe04da5898ecb4af849e1347fa31c1c29fd5d1
Python
6,736
196
"""Colocalization analysis for ``ov.genetics`` — coloc backend. Wraps the standalone :mod:`pycoloc` package (Giambartolomei *et al.* 2014; Wallace 2020/2021). :func:`colocalize` tests whether two traits (e.g. a GWAS signal and an eQTL) share a causal variant at a locus. ``method`` dispatches between the single-causal-...
7aa55859802b3b08360a05a4b293e86d6cc098dccf3e6126c574208a5ad0ee67
Python
6,738
195
import tracemalloc from fractions import Fraction import numpy as np import pytest from stl import mesh from .test_mesh_mass_mixed import subdivide from .test_mesh_mass_sliver import _unit_cube def winding_parts(): narrow = np.array( [ [565499, 1633004, 136135], [0, 2888250, 240...
c862ee365e13d13953cb789175a586a35ae392743f93c8c32dfc616bc602366d
Python
6,738
242
""" Segment audio files and write segmenting decisions. TO DO: - tune window size - segment could be sped up if it operated file by file. """ __date__ = "December 2018 - November 2020" import matplotlib.pyplot as plt plt.switch_backend('agg') import numpy as np import os from scipy.io import wavfile, loadmat from...
e96da9117fbf4ac58ff22ec1ab4d34812db250e51e506b7f66f8baec3f8fa6e6
Python
6,738
144
# # ATENCIÓN, para cargar los archivos pt de julio 2023 se debe utilizar: # - transformers==4.16.2 # - protobuf==3.20.3 (no comprobado que sea necesario) # import logging from datetime import datetime from agent.classifiers.utils.device_mgmt import get_gradient_accumulation_steps from agent.classifiers.transformer_...
58f27dd925bd3db8b7aa223c05ff9a975fabbc533e6a60e9dbdbfeca879604ba
Python
6,740
160
""" Behavioral transition / timescale analysis (Berman, Bialek & Shaevitz, PNAS 2016). Clean, public versions of the transition tools that previously lived only in ``demoutils``. Two improvements over the ``demoutils`` versions (which are kept, unchanged, for backward compatibility): * :func:`makeTransitionMatrix` a...
c6860a6a03f92f7ae7d12a6392db4b769fc28aea37183d490d2820771504adff
Python
6,740
157
""" This file defines necessary parameters (constants?) for the model. The order of the cell types is [EXC, PV, SST, VIP] """ # %% import numpy as np import pickle # fmt: off """ 11/23/2021: The final influence matrix is recalculated based on the mean values. (previously they were medians.), and the errors are evalu...
c0ed9a2904793b9954c41220483861d88d7b4a5ed6bca88868e4fe7b5740728f
Python
6,741
153
import numpy as np import scanpy as sc import pandas as pd import io import anndata def ligand_receptor_database( database = "CellChat", species = "mouse", heteromeric_delimiter = "_", signaling_type = "Secreted Signaling" # or "Cell-Cell contact" or "ECM-Receptor" or None ): """ Extract ligan...
7fb28d6ec318b0d01eeacbddac7414f15210997cacb2538b51810af53f8c8d7c
Python
6,742
209
""" 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 math from contextlib import suppress from dataclasses import dataclass import torch import torc...
e5d20269b1c17aa494ede1658db8f8e6a0750f0421ee9482eb0541cb8edb807b
Python
6,744
183
import json import os import pprint import sys import jsonschema import pytest from ray._common.test_utils import ( run_string_as_driver, wait_for_condition, ) from ray._private.test_utils import ( format_web_url, request_with_auth_token, run_string_as_driver_nonblocking, ) from ray.dashboard impo...
060bc50524f9c11e5ded36ab025143086ae81beb7d3570ec5e82452dead00189
Python
6,745
222
from typing import Any, Dict, Tuple import numpy as np import pandas as pd from scipy.fft import fft as scipy_fft from scipy.signal import find_peaks from statsmodels.tsa.stattools import adfuller from data_profiling.config import Settings from data_profiling.model.summary_algorithms import ( describe_numeric_1d,...
9d17023b421bee96b41d0b80a7be3cb407f3245908b7980b914a375092291719
Python
6,746
200
# -*- coding: utf-8 -*- import numpy as np from numpy.testing import assert_array_almost_equal from scipy.sparse import csc_matrix from scipy.linalg import orthogonal_procrustes from fmralign.alignment_methods import ( DiagonalAlignment, Hungarian, Identity, OptimalTransportAlignment, POTAlignment...
2c2b3f95042c4cecb608033d35a1d693f77dfea5c8e7db8cb3bcc58eadc21cf5
Python
6,747
196
import tempfile import shutil import os from os.path import * from . import tdir import subprocess from ngs_mapper import compat class BaseTester(object): def _C( self, *args, **kwargs ): ''' Set modulepath as instance variable to be the name of the module Set functionname as instance varia...
dfbafd33e9f240bc922d722aff29faebe6a204de1b32f85b5e27e08bd6cf463a
Python
6,747
238
from typing import Set, Callable, Any, Union, Optional, Type, Dict, Sequence, List, TypeVar from functools import partial import copy as cp import inspect from neuron_morphology.feature_extractor.mark import Mark from neuron_morphology.feature_extractor.data import Data from neuron_morphology.feature_extractor.featur...
c36b8e3dca2ae286641fd43e079d86e6df93e3ddcbc08bc563ea082b03b76154
Python
6,748
209
import os import numpy as np import mne from scipy.io import wavfile class SpeechWaveExtractor(): """ Class to load audio data. Methods ------- extract_wave() Gets speech wave from audio segment. get_wave() Returns speech wave and sampling frequency. """ def __init__(self...
590321100be8ff925e4246d4394feb56a249894d578706b366f5fa6d47c68274
Python
6,749
213
import abc import collections import functools import inspect import json import logging import os import traceback from typing import Any from ray.dashboard.optional_deps import PathLike, RouteDef, aiohttp, hdrs from ray.dashboard.utils import CustomEncoder, HTTPStatusCode, to_google_style logger = logging.getLogger...
2d730f73eb687b76db85842b6ec14eed798ec7895b0122c18b19ee41534add93
Python
6,751
189
# -*- coding: utf-8 -*- """ Created on Mon May 03 08:46:00 2021 @author: ju-bar Functions handling input and output of structure data via the CEL file format. The CEL file format is a text format defining a volume in space which is filled by atoms. The supercell is defined by a sequence of numbers in the second line...
680ddaca92c4779785d72f5e9befe12d8c125f2564ce2e07e1fd69b45e4ba15e
Python
6,751
169
r"""``ov.epi.tl`` — epigenomics analysis tools (wraps :mod:`epione.tl`). Dimensionality reduction (iterative LSI), clustering, gene-activity scores, peak-to-gene linkage, chromVAR motif deviations, footprinting and cross-modality integration — all delegating to `epione <https://github.com/aristoteleo/epione>`_. Each f...
b141b66fc5a00c7dfc3597d36945b6e097ec9a0728bc263c06972e031181f27d
Python
6,752
182
# ----------------------------------------------------------------------------- # MS lesion segmentation pipeline # --------------------------------- # - incorporates: # - MRI identification # - registration # - skull stripping # - MS lesion segmentation training and testing using th...
92621ae4d534e8f224b1675a611a36bd88d6924ccf6468ba0586421d3cc3e3fe
Python
6,753
220
""" # ResNet-D backbone with deep-stem # Code Adapted from: # https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py """ import torch import torch.nn as nn import torch.utils.model_zoo as model_zoo import network.nn.mynn as mynn __all__ = ['ResNet', 'resnet18', 'resnet50', 'resnet101'] model_url...
b289e468d6d02c0fca4fbb133b4f5123e7e3a482a0293e82e5aa34675e0c44bc
Python
6,755
180
import copy from abc import ABCMeta, abstractmethod from collections import defaultdict, namedtuple from threading import Lock from typing import Dict, List, Optional, Tuple StoreStatus = namedtuple("StoreStatus", ["success", "version"]) VersionedValue = namedtuple("VersionedValue", ["value", "version"]) class Stora...
a0f3e69254ca4f479503321217a87d3bffeefc85e728014bcd7a4e4a5da6b203
Python
6,760
152
#################################################################################################### # 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...
3d968ffe53deafee8f87abff4a25e97532b3605cabd5fbaeb91fea11c6fa6530
Python
6,762
227
""" Statistical functions """ import logging import numpy as np from scipy import stats from tedana import utils LGR = logging.getLogger("GENERAL") RepLGR = logging.getLogger("REPORT") def getfbounds(n_echos): """ Gets F-statistic boundaries based on number of echos Parameters ---------- n_ech...
86afb0495f86a21028264a924ba886ffb9c642fcc71c533c96711c8dda099237
Python
6,763
222
# -*- coding: utf-8 -*- """ Created on Tue Jul 4 20:15:15 2023 @author: Leyang XUe """ import sys import numpy as np from multiprocessing import Pool # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation a...
4428f43f3d05eb4db8ae3e66d7d281a9db48a13c4feede25fed62ad4566a7656
Python
6,764
194
CODE_DIR = 'C:/Users/mmall/Documents/github/' SAVE_DIR = 'C:/Users/mmall/Documents/uni/columbia/assignment_errors/fits/' import socket import os import sys import pickle as pkl import numpy as np import scipy as sp import matplotlib.pyplot as plt import matplotlib.ticker as tkr import matplotlib.font_manager as mfm i...
864dd741fab9c726cf33156c37806de7ac295d975f8f38feed6b796ee1d576ff
Python
6,765
148
"""APIs-tab sidebar (Pattern B): a single shared API navigation, loaded client-side. Ray's global sidebar server-renders the whole toctree into *every* page. The symbol- level API nav has ~3k stub pages; rendering those into every page would bloat each one (~250 KB of sidebar) and OOM the build. Instead: 1. Capture...
51e3fa3f0c6014333f01c542c9e5a5a92d36aa881c8523ef6bbe6e8f7eceeee2
Python
6,767
196
import sys import random import networkx as nx # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as kp # Import custom utility functions def kcorepercolationPlateau(G, rm_nodes, k): ''' Perform k-...
fea8a13debc399ff2f343a66aa311d8c824a0fbe6633aa5915ad09b75a8d48c8
Python
6,767
160
from __future__ import division import os import time import argparse import torch from torchvision import datasets, transforms import torch.optim as optim import torch.nn as nn from torch.optim.lr_scheduler import StepLR, MultiStepLR import torch.nn.functional as F from utils import accuracy, AverageMeter, save_checkp...
c44369992ee020e47e283047c6926071c44e3c407292eb4bd85e9a1192692592
Python
6,770
206
import argparse import os # Prevent numpy from using multiple threads os.environ["OMP_NUM_THREADS"] = "1" import numpy as np # NOQA:E402 from torch import nn # NOQA:E402 import pfrl # NOQA:E402 from pfrl import experiments, utils # NOQA:E402 from pfrl.agents import a3c # NOQA:E402 from pfrl.optimizers import Sh...
96fdb51a76e9dbd9022de503ee4054e356baf867f5a7d5e085440c6c30ef4523
Python
6,771
168
import math import torch from torch import nn import torch.nn.functional as F class DotProductAttention(nn.Module): def __init__(self, dropout, **kwargs): super(DotProductAttention, self).__init__(**kwargs) self.dropout = nn.Dropout(dropout) def forward(self, queries, keys, values): d ...
d2e83e47e86d4ee09801f1bcb2667bfa1bc893207ded6c7bcb197c5bf6739061
Python
6,771
193
""" a lstm-a2c with context context input is added to the linear layer of A2C """ import torch import torch.nn as nn import numpy as np from model.A2C import A2C_linear # from model.A2C import A2C # constants N_GATES = 4 # output format is either discrete (e.g. action selection) or continuous OUTPUT_FORMAT = ['discre...
90c37ef85e189e9c84c35e52c019a985f86fd8d4fc6b8159b447ff7fbdfe43bc
Python
6,772
177
import nibabel as nib import numpy as np import scipy.sparse as sp from lib.surface import ( get_boundary_loop, monotone_free_arcs, read_surface_from_gifti, write_metric_gii, ) from lib.utils import setup_logger from scipy.sparse import coo_matrix, diags log_file = snakemake.log[0] if snakemake.log els...
da1550bdc28de84f6619c3601ae48a8b129b38a1372e1a8752f75d574749bea9
Python
6,772
222
from __future__ import annotations from functools import singledispatch from typing import TYPE_CHECKING import numba import numpy as np from scipy import sparse from sklearn.random_projection import sample_without_replacement from ._compat import DaskArray, _CSMatrix, njit if TYPE_CHECKING: from typing import ...
d4c1a3b1b992fd84e6f15426c9c53035998eceb470c3e3580b36e9efaea50d4f
Python
6,774
193
""" Creates a new table which maps patient ICD codes in UK Biobank to phecodes. inputs in BQ bigquery hesin table: <HESIN_TABLE> previously loaded phecode data outputs in BQ: <OUTPUT_TABLE> with fields <sampleid, datetime, ICD10, Phecode>. """ from collections import defaultdict import csv from google.clo...
134f9abd7071a3556ebd6ce18591235aab38db50311397459fc9db06e460471a
Python
6,775
216
''' 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 torch import numpy as np import pandas as pd import seabo...
565a7b28e5d07b95e14f051ceb6a962f0fb00edf7a392e2e128022ea121527cb
Python
6,775
215
import os import sys import tempfile from unittest import mock import pytest from ci.ray_ci.automation.update_version_lib import ( get_current_version, list_java_files, update_file_version, ) def test_list_java_files(): with tempfile.TemporaryDirectory() as tmp_dir: os.mkdir(os.path.join(tmp...
99d79b86c6d382d4f6ffd16636e3462ca210c20f30646fc5f267acf5e2a1ca86
Python
6,776
156
# 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...
ef413207899756a13362da7d06b1dec10ccd7d37d8bc8e7e37894d154c3373b1
Python
6,777
214
import tensorflow as tf from tensorflow.keras.layers import * class CustomAttention(tf.keras.Model): ''' LSTM attention layer ''' def __init__(self, units): super().__init__() self.W1 = Dense(units, use_bias=False) self.W2 = Dense(units, use_bias=False) self.V = Dense(1)...
fe7ae3ba8dc77b2fd8b824fa756b7027fb12c7bfe4749127a33745f346a12ada
Python
6,777
139
import numpy as np import visionloader as vl import argparse import pickle from typing import List, Tuple, Dict # USES pycpd as a dependency, https://github.com/siavashk/pycpd # you can install this with "pip install pycpd" from pycpd import RigidRegistration from lib.dataset_config_parser.dataset_config_parser impor...
e9b5cd3922ea6916ad92e634af3dcd9ff8fd051cb1b8a829b8917f1b8c444f61
Python
6,784
201
# # 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 ...
99acfd3d4fa8da3061cd6d24916eeb3146596f8f10862dfa7a900036d36047f0
Python
6,788
189
import numpy as np from lib.qc import ERROR from lib.qc_surface import ( compute_qc, compute_topology, face_clusters, plot_defects, plot_distortion, plot_histograms, self_intersecting_faces, unfold_distortion, ) def grid(n=8, m=8, wrap_u=False, wrap_v=False): """Triangulated n x m ...
c3e31593b914260cabbb8ff1107f148526dc5f537c179dbcfc1f0d84d2847d40
Python
6,789
191
# -*- 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. #...
a140f4684a28909415f45c41db9b2045be7476e48e272139ea37d4b991e5846e
Python
6,790
203
"""gRPC server interceptor for token-based authentication.""" import logging from typing import Awaitable, Callable, Optional import grpc from grpc import aio as aiogrpc from ray._private.authentication.authentication_constants import ( AUTHORIZATION_HEADER_NAME, TOKEN_AUTH_ERROR_MESSAGE, ) from ray._private...
8ba05a28615c4d37416c19b953c4b8711f120e2c76e15a731d6018978b985c69
Python
6,793
161
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns def translate_nuc_to_aa(seq): ''' The function receives a nucleotide sequence and translates it to an amino acid sequence :param seq: string of nucleotide sequence :return: string of amino acid sequence '''...
494170f3bc590722089f53040f990867caf7cacfea9b5a931ed3588329511e0b
Python
6,794
212
import os import sys import logging from deeprvat.data import DenseGTDataset import yaml from typing import Dict, Tuple import itertools from torch.utils.data import DataLoader from tqdm import tqdm import copy import numpy as np from pathlib import Path import pytest import torch import zarr from deeprvat.deeprvat.tr...
d49c038769602eb09969103fd4cccdeeaaacb4e026d6d966c101e1b183b502d9
Python
6,796
163
#!/usr/bin/env python from __future__ import print_function import argparse import glob import sys import numpy as np import pysam import time import tempfile import os from subprocess import run from contextlib import closing from collections import defaultdict import shutil import subprocess is_secondary = lambda x...
90b809c885fc17eb57b8f8c7625135a3f7aa9674dbcc6199205c663aa2c3f906
Python
6,798
254
from attr import dataclass import ray from data_assimilation.PDE_models import AdvectionEquation import numpy as np import matplotlib.pyplot as plt import pdb from matplotlib.animation import FuncAnimation from data_assimilation.particle_filter_old import ParticleFilter from data_assimilation.aux_particle_filter import...
499322418554df81489b44c5adc93b0664b8ce5e820aae17db6ed31ecbd53e75
Python
6,799
180
import torch.nn as nn import torch from torch import autograd #把常用的2个卷积操作简单封装下 class DoubleConv(nn.Module): def __init__(self, in_ch, out_ch): super(DoubleConv, self).__init__() self.conv = nn.Sequential( nn.Conv2d(in_ch, out_ch, 3, padding=1), nn.BatchNorm2d(out_ch), #添加了BN...
b93c2e6fee98fadd938123dd31b75fee6249bd060c631b4a1c4e1e671253c1f8
Python
6,799
168
"""A small, dependency-free text-repel for label placement. The third-party :mod:`adjustText` computes label positions against the axes geometry at call time and, in a small or freshly-resized axes, can push labels far outside the data limits (a volcano panel that ends up 60 mm tall in a multi-panel figure sends its g...
242a4668fd96344bf4e9656436c158fd93e37170ffb4ab7ac6363bd249d693f5
Python
6,801
187
#################################################################################################### # 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...
ca06176b4e6509c870b17c809448572390f6631d78ad76db25a3cf77f1eb75f5
Python
6,802
165
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp from typing import Optional, Sequence import mmcv import numpy as np from mmdet.engine.hooks import DetVisualizationHook from mmdet.structures import DetDataSample from mmengine.fileio import get from mmengine.runner import Runner from mmengine.util...
b25e84203eb3af598d34376aa93d4ba03156cbd68a18fd70278a78a2f52df2ae
Python
6,803
128
#!/usr/bin/env python # coding: utf-8 # author: Maruthi Mutnuri (maruthi2008@gmail.com) # loading libraries import pandas as pd import numpy as np # loading database file INPUTEVENTS_CV = pd.read_csv("/home/maruthikumar.mutnuri/physionet/files/mimiciii/data/INPUTEVENTS_CV.csv.gz", sep = ',', compression = 'gzip', ...
0d5df00aaebef50666c24be1a40aae12bd952caf35a73fdfee1e613be2952b5c
Python
6,805
201
""" Purpose ------- This script is intended to aid in variant calling. It generates statistics about a given location in a BAM file. Usage ----- .. code-block:: bash stats_at_refpos <bamfile> <regionstring> Notes ----- **regionstring** The region string is a bit confusing if you are unsure what it is...
5d6c2bd03a08def076189cba89077cb033d9971e91be8ad3e8e5c6996000ccd6
Python
6,805
183
from typing import List, Optional, Tuple import numpy as np import torch from .chips import ( Speck2EConfigBuilder, Speck2FConfigBuilder, ) from .config_builder import ConfigBuilder from .utils import parse_device_id class ChipFactory: supported_devices = { "speck2e": Speck2EConfigBuilder, ...
a45a468fd191b16571d74c97e0e2e9a3f70be9fad229291f3f2d362553fe23cf
Python
6,805
185
# -*- 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. #...
a08a7ef7ed8577a3ad2fe4d7e884f73720696e0c007fd8cd511bbd96cbc1c8c9
Python
6,806
154
import numpy import time import random from pysted import base, utils, raster, bleach_funcs from pysted.microscopes import DyMINMicroscope, RESCueMicroscope, DyMINRESCueMicroscope from matplotlib import pyplot import sys sys.path.insert(0, "..") from src.tools import datamap_generator from src.experiment import Expe...
b05a3b85521ff39b0ce3a93e07c90ab3046874dce36ecc336a14cf8417550797
Python
6,806
157
import numpy as np import gurobipy as gp import math from utils.tool import get_dimension, read_img def cal_feature(image): """优化后的频域特征计算""" if len(image.shape) == 3: f = np.fft.fftn(image) else: gray = np.mean(image, axis=-1) f = np.fft.fftn(gray) f_abs = np.abs(f) return f...
5a22cf3b1cacbca49cc32e6eee848d7f82b2ea03364b64b92891747a12fe7088
Python
6,807
123
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'custom_config.ui' # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore...
9b9d5178f94b81ec62058ed3e2f2948a8b3b3eb97566e67d6814befc221fcdcd
Python
6,809
145
import pandas as pd import numpy as np from prepare_and_parse import reidentify_isoform_dataset def identify_mapt_exon2_3_17(species, gencode): ''' Aim: Identify from the flattened structure of MAPT (using the parse_gencode_reference()), the exons corresponding to exon 2, exon 3 and exon 10 in the genome (...
1988fd1d40daf5535bd2d282acab7202b5e436ab4a2f941e2be775caa7e61aa1
Python
6,811
156
import os import cv2 import numpy as np import EAV_datasplit from facenet_pytorch import MTCNN import torch class DataLoadVision: def __init__(self, subject='all', parent_directory=r'C:\Users\minho.lee\Dropbox\EAV', face_detection=False, image_size=224): self.IMG_HEIGHT, self.IMG_WIDTH = ...
58ea5f6b1e28d5179b87bf96ebe9493fe652ff762e55dceb22f49372e2608fde
Python
6,815
218
"""Rendering of circular flash sequences on a hexagonal lattice.""" import logging from itertools import product from typing import Dict, List, Tuple, Union import numpy as np import pandas as pd import torch from datamate import Directory, root from tqdm import tqdm from flyvis import renderings_dir from flyvis.uti...
8965b7400f12cee4b0cba637238a2aaf5b01696ac02cca6416ecd5e512a68a37
Python
6,816
216
""" a shortcut for predicting the context """ import torch import torch.nn as nn import numpy as np from utils import to_sqpth, to_sqnp from sklearn.model_selection import train_test_split class ShortCut(nn.Module): def __init__(self, input_dim, output_dim, hidden_dim=128, lr=1e-3, buffer_size=512, allow...
e4a639c74a68c5713e72e3e860b63cd9b0313159eed75c358fe47c2732ede798
Python
6,817
183
# built-in dependencies import os from typing import Any, List, cast # 3rd party dependencies import cv2 import numpy as np from numpy.typing import NDArray # project dependencies from deepface.commons.onnx_utils import build_session from deepface.models.Detector import Detector, FacialAreaRegion from deepface.common...
f5e3b3fc55b2083c15964b2341e1f993df35a9c8adfa368c7655f6dd743cd5d8
Python
6,817
219
import argparse import json import os import numpy as np import torch import pfrl from pfrl import agents, experiments, explorers from pfrl import nn as pnn from pfrl import replay_buffers, utils from pfrl.q_functions import DistributionalDuelingDQN from pfrl.wrappers import atari_wrappers def main(): parser = ...
32a1ec60fdb2bd3c7792507e70ea78abcbbbd02de25be57620e6c467e4250862
Python
6,818
193
"""Lightweight MCP client for BioContext biomedical knowledge tools. Uses the MCP Streamable HTTP transport to communicate with the remote BioContext server. No external dependencies — only ``urllib.request`` from the standard library. """ from __future__ import annotations import json import logging import threadi...
a91299ad8f305f35160ca9d26aad41b988eaf08468a8328c23a4e10b3a48a95f
Python
6,818
216
""" a shortcut for predicting the context """ import torch import torch.nn as nn import numpy as np from utils import to_sqpth, to_sqnp from sklearn.model_selection import train_test_split class NNShortCut(nn.Module): def __init__(self, input_dim, output_dim, hidden_dim=128, lr=1e-3, buffer_size=512, all...
915df1863cea806f027d6462182ab884d14714c6a59f1b069a499feece7e8727
Python
6,820
158
#################################################################################################### # 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...
d05f2b8e62a366a871807517bcf9d05d77d763a1489062f199c02e1e1d4ce877
Python
6,820
180
# Copyright 2021 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, sof...
c76c8adb46b46bc8d5ce63d07900ae55102b8be36c8abefa40260c0b685d7491
Python
6,825
229
import json import sys from typing import List import pytest from ci.ray_ci.automation.determine_microcheck_tests import ( _get_failed_commits, _get_failed_tests_from_master_branch, _get_flaky_tests, _get_test_with_minimal_coverage, _update_high_impact_tests, ) from ci.ray_ci.utils import ci_init ...
6dcd300f17124964b746e70bcfcaf61275d275d2db62d0d3ff4c47888bbc22af
Python
6,827
169
#################################################################################################### # 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...
10a0daa8de31905e4fed00339167004a045fe4348ac358e5454f572a3f281b79
Python
6,828
189
""" Calculates word-based phoneme surprisal and entropy for each phoneme in the audiobook segment. """ import os import json import numpy as np import pandas as pd from tqdm import tqdm from pathlib import Path def create_word_phoneme_df(words: pd.DataFrame, phones: pd.DataFrame) -> pd.DataFrame: """ Builds a Da...
dfddb6e99952e881e73fcf30989e5233f682ccd153f3b41ec24ef33ec7fc1956
Python
6,828
208
import torch import argparse import json import pickle import numpy as np from models import PretrainModel, load_model_arch from utils.data_utils import fix_seed from utils.chemistry_parse import augment_product_smiles, clear_map_number from utils.graph_utils import smiles2graph import torch_geometric from rdkit impo...
9614836e3e7c78b7f249a4886c58dcfb973e18a190d0be4cd28b67099ca1b130
Python
6,831
119
import datetime import torch from torch.nn import LSTM import torch.nn.functional as F import numpy as np from torch.optim import Adam from pathlib import Path class ConfigCore(): def __init__(self, data_path='./'): # network self.device = 'cuda:0' # 'cuda:0' if uses gpu; otherwise 'cpu' ...
2af1281052bafbcdceeef93ff2275aad93bafed19d28d9d59d7751ee46c7fb86
Python
6,834
175
''' Optimizer Factory w/ Custom Weight Decay Modified from timm Use parameter name to remove weight decay since tensor product weight is always one-dimensional. ''' from typing import Optional import torch import torch.nn as nn import torch.optim as optim from timm.optim.adafactor import Adafacto...
5c72a5bec91f3cbe8b66f7089ab77325e3ae39098d79f0ad862e78cb93abb9ea
Python
6,834
202
"""Tests for display-independent HTML surface reports.""" import json import re import subprocess import sys import numpy as np from brainspace.mesh.mesh_creation import build_polydata from brainspace.plotting import write_surface_report def _surfaces(): points_lh = np.array([ [-1.0, 0.0, 0.0], ...
19e2a7a68c85e57b69c868ea4f3ea18f8ea3dc7108b354dc5ee057007e5a3042
Python
6,838
180
""" *** built as part of the Russell Ray Lab Breathing And Physiology Analysis Pipeline *** Breathe Easy - an automated waveform analysis pipeline Copyright (C) 2022 Savannah Lusk, Andersen Chang, Avery Twitchell-Heyne, Shaun Fattig, Christopher Scott Ward, Russell Ray. This program is free software: you can redist...
1b8d9cd757d72efb7e24d878161f2418f2bed8d0ce78726edcfacf791ed1b47c
Python
6,838
128
import os import torch import scipy.ndimage import numpy as np import torch.nn as nn import torch.utils import nibabel as nib from utils import orientation, find_bbox from pytorch3dunet.unet3d.model import UNet3D from nibabel.orientations import ornt_transform class InVivoInference(): def __init__(self, devic...
61d3809d83d2c3ae79a7fdaeb933834048d502af72b53af5f35ba1f658065b04
Python
6,838
215
import argparse import os # Prevent numpy from using multiple threads os.environ["OMP_NUM_THREADS"] = "1" import gym # NOQA:E402 import gym.wrappers # NOQA:E402 import numpy as np # NOQA:E402 from torch import nn # NOQA:E402 import pfrl # NOQA:E402 from pfrl import experiments, utils # NOQA:E402 from pfrl.agen...