sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e474ee5b8efb2fab94795956b43a27f5459b10845fb4255028d29110d3c007c2
Python
12,643
321
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # # import enum import os.path import shutil from library import * ################################################################################################### # class Conv3dOperation: # def __init__(self, conv_...
8435adda58956d3af31d9e4e76b832c1f9a7206157827a4f20b6e37ee983783e
Python
12,644
351
import glob import hashlib import os import h5py import joblib import numpy as np import pandas as pd import scipy.io import torch from numpy.random import Generator from numpy.random import PCG64 from sklearn.decomposition import PCA import sklearn.model_selection import cebra.datasets from . import pi_vae class Syn...
c04142abec388558e27620a7c6b6c07469f4abf0cbfc6d18dfec0231dc45219a
Python
12,647
426
# 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, ...
d3d262d76c8e7d9b11a6f467599034f6a2fe51a1e61534eaf70cd9f7fa2cfc8a
Python
12,651
257
import torch import torch.nn as nn import numpy as np import scanpy as sc import anndata as ad from torch.optim.lr_scheduler import _LRScheduler, ReduceLROnPlateau from tqdm import tqdm from copy import deepcopy from ..utils.eval import downstream_eval, aggregate_eval_results from ..utils.data import XDict, Transcripto...
f21a419625d10c7954ec89def9827e3792193268eec1932ce821016c4457e550
Python
12,655
369
# @license # Copyright 2017 Google 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 to in...
30063b62d6a2ead9e072909b8783db45493fba41283913f5ac6f1b0340c82535
Python
12,657
347
# 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, ...
264fe2ded0131f931af10f32aaadafd4960af9322d62de71f98dff2807d7bb81
Python
12,658
367
import re from dataclasses import dataclass from pathlib import Path from typing import Dict, List, Union import flyvis from flyvis.network.ensemble import model_paths_from_parent @dataclass class Status: """Status object from log files of model runs. Attributes: ensemble_name: Name of the ensemble....
36ea01af1062cfdc19a617205ada97f96c3d0bd49ed73f01b618b31d8674289d
Python
12,662
312
# -*- coding: utf-8 -*- """ PMLB was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - William La Cava (lacava@upenn.edu) - Weixuan Fu (weixuanf@upenn.edu) - and many more generous open source contributors Permission is hereby granted, free of charge, ...
7392047a970b098ee51284833c1f83a4ee0d16e69700463a1c1d1df7705ac966
Python
12,667
353
import rdkit import rdkit.Chem as Chem import numpy as np import random elem_list = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'As', 'Al', 'I', 'B', 'V', 'K', 'Tl', 'Yb', 'Sb', 'Sn', 'Ag', 'Pd', 'Co', 'Se', 'Ti', 'Zn', 'H', 'Li', 'Ge', 'Cu', 'Au', 'Ni', 'Cd', 'In', 'Mn', 'Zr', 'Cr', 'Pt',...
1b77104534a5b53413c36ac29ebf1b36c85da38fee4b149f211aba5e16f85632
Python
12,669
329
# -*- coding: utf-8 -*- ### ------------------------ IMPORTS -------------------------------------- ### import os import json import tables import adi from tqdm import tqdm import numpy as np from scipy import signal from string import ascii_lowercase from helper.array_helper import chunk_array ### -------------------...
a054ac2cb407bb7dec14f0f7be62ce726f063f738b45242b423ac7713e2b9d56
Python
12,671
287
import torch from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split import pandas as pd import numpy as np import os import random from collections import defaultdict, Counter from itertools import combinations import json import torch.nn as nn import torch.nn.functional as F from sklearn.m...
b730c9cd5ffcee2dcc997ec26ba2a510ea4a5645e2f7e316907f4ea68587224e
Python
12,673
316
"""MetaQ backend (Li et al., Nat Commun 2025).""" from __future__ import annotations import time from typing import List, Optional import numpy as np from scipy import sparse from .base import FitResult, MetaCellBackend class MetaQBackend(MetaCellBackend): name = "metaq" capabilities = {"soft", "latent",...
8b52ff1f2b9d0994609cb4f1bd1803c8f82738671a020058cc0b3ec80bea9789
Python
12,675
362
# 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...
075d5d1868d59ba843b2f7609d444cad03b6ec651d02d2ad9d03b179dc59e258
Python
12,676
357
""" Ray Serve application: Video Embedding → Multi-Decoder. Processes entire videos by chunking into segments. Videos are downloaded from S3 to temp file, then processed locally (faster than streaming). Encoder refs are passed directly to decoder; Ray Serve resolves dependencies automatically. Usage: serve run a...
85ac56e9420bdc6eda87c9730d93d2cb0c5887736bee0892349b8e0a7785b3c0
Python
12,677
331
import numpy import gym import pfrl import torch import functools from torch import nn def calc_shape(shape, layers): """ Calculates the shape of the tensor after the layers :param shape: A `tuple` of the input shape :param layers: A `list`-like of layers :returns : A `tuple` of the output shap...
34523d3231f0f7622ea39254dfb71d73c7ebda0aebf63bdcd9f77ca6c318fec5
Python
12,680
307
import csv import argparse from pathlib import Path import datetime import json import numpy as np import os from keras.layers import Embedding,Dense, Activation,TimeDistributed, GRU, Dropout, Input import sys sys.path.insert(0,str(Path(__file__).resolve().parents[1])) from mothra_runtime import CompatibleGRU, Deduplic...
7d2fd293a154b4ba4210f486a2242ea49ed892a703bba1a9e9ca6617d26e4716
Python
12,684
346
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=invalid-name # pylint: disable=line-too-long # pylint: disable=multiple-statements # pylint: disable=too-many-lines # pylint: disable=wrong-import-position #------------------------------------------------------------------------------- ''' This program...
1f74ad6db10088db447721e06e4be0f30f4fd778cd3c15f9e0924b1b2b62165e
Python
12,687
306
import torch import torch.nn as nn from collections import OrderedDict from utils.kfac_utils import fetch_mat_weights # from utils.common_utils import (tensor_to_list, PresetLRScheduler) from utils.prune_utils import (filter_indices, filter_indices_ni, get_t...
54b5beb8f52784fe87ec2b7334af6b447e52306a22b437f8018a1ce3299604ea
Python
12,688
425
"""RuntimeEventEmitter — unified observability surface for OVAgent runtime. Routes all runtime state through structured logger sinks and the harness event stream. Print output is **not** part of this contract — it is non-authoritative and optional. Observability contract ---------------------- * Every dispatch, resu...
f77c741f7f5d5b46db2a179a7842369aedde8ea34c9ec969a0e758e386913784
Python
12,689
293
# %% import pandas as pd import numpy as np import os import re from icecream import ic from scipy import stats import math import warnings warnings.filterwarnings("ignore") # Train set nacc = pd.read_csv('training_cohorts/new_nacc_revised_selection.csv') aibl = pd.read_csv('training_cohorts/aibl_revised.csv') nifd =...
0b49898c57cf9da117662bf559455c630a624a6b80f0c70c3764f9588a5ca54f
Python
12,700
313
# # 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...
3421b2a615404695d07a32b40f76f030aea8521ec2733020996e0d960202b4c1
Python
12,711
343
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # pylint: disable=abstract-method """High level analog tiles (analog).""" from typing import Optional, Tuple, Any from torch import Tensor from aihwkit.simul...
4ef780ef2b6196d04a18d3bce570c58c77eb7d481d4dfbf9785886bdb0255b92
Python
12,715
340
# Ultralytics YOLO 🚀, GPL-3.0 license import numpy as np from ..utils import matching from ..utils.kalman_filter import KalmanFilterXYAH from .basetrack import BaseTrack, TrackState class STrack(BaseTrack): shared_kalman = KalmanFilterXYAH() def __init__(self, tlwh, score, cls): # wait activate ...
6579a82fa272ac6be08e556f7fe60c46e8b0b6200143677a19fc84b0fb405125
Python
12,716
395
import soft_rank_isotonic import numpy as np from scipy import special def isotonic_l2(input_s, input_w=None): """Solves an isotonic regression problem using PAV. Formally, it solves argmin_{v_1 >= ... >= v_n} 0.5 ||v - (s-w)||^2. Args: input_s: input to isotonic regression, a 1d-array. input...
2767d0a117b8dbcfb4a051f6a1fcfe2e36cd88ffebebd06a03e0ebecf286752a
Python
12,722
327
r"""Interactive 3D visualization for :mod:`omicverse.mol`. Built on **py3Dmol** (3Dmol.js): each view is a self-contained HTML/JS block embedded in the notebook cell output, with no ``ipywidgets`` dependency, and **renders in nbconvert HTML / mkdocs** without a live kernel. The one caveat is Jupyter's **notebook-trus...
0e5d612e801b5acb16c364d3e37d900cfa9a3c396d3b099b87b857d2090caebd
Python
12,725
312
import numpy as np import os import glob import zipfile import exputils import re def calc_repetition_statistics(statistics, load_experiment_data_func, *args, statistics_directory=None, recalculate_statistics=False, verbose=False, repetition_directory_template=None, ...
02b38bd61558fc01607aff504e2707f6ade3a08b21d754490b433b899e7babca
Python
12,726
324
import logging import random import threading import time from collections import defaultdict from typing import Any, Dict, List, Optional from ray.autoscaler._private.aliyun.config import ( PENDING, RUNNING, STOPPED, STOPPING, bootstrap_aliyun, ) from ray.autoscaler._private.aliyun.utils import Ac...
8cdcb8a5d32bfea0ebacc0a2fd98c7726f2049076089bfcbf3d87a76760e94b2
Python
12,726
412
import pandas as pd import numpy as np import matplotlib.pyplot as plt import copy import glob, os from poser.patients import Patient, PatientCollection import re import scipy.stats as st import seaborn as sns #from statannot import add_stat_annotation #%% load patient data directory = './data/' # put the DLC tr...
1c0b6998e512626c646ec99f1cafb04ea6c1c08d7590d9078a50f758b7fa75d7
Python
12,729
345
# 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...
22ebe9a01ec1aaac0356de8d2d24b3d7a18a5ac6c059a7f54a19e9022fb3b633
Python
12,731
385
import torch from torch.utils.data import Dataset import numpy as np from functools import cached_property from typing import Any, Type from numpy.typing import NDArray import random from monai.utils.type_conversion import convert_to_tensor import time Tensor = Type[torch.Tensor] from .masker import Masker from . imp...
94a62c31cf9c17c2fc41a1cf24db46449458a4e9591c45b47aeba4337fccf9e0
Python
12,731
346
""" 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 logging from pathlib import Path from typing import Any import numpy as np import torch from to...
6ad4178080a120de6f71baaf304a4a8f06f011086f019377532eef7325e5cb45
Python
12,736
342
# 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, sof...
fedda03650a03481c495110c12df0d958eb422262998c5d6684151ea8de1e812
Python
12,736
289
import os import torch import torch.nn as nn from torch.autograd import Variable from torch.utils.data import DataLoader import argparse import time import datetime import numpy as np from skimage import io import math if __name__ == '__main__': ############################################################ IMPOR...
0ba72b2317ed757d4ae781ba209502844c29d01983837f61b6e4103442cabfa0
Python
12,739
415
""" Usage examples for DataStateInspector Production API. This module contains comprehensive examples demonstrating all features of the DataStateInspector in real-world scenarios. """ from anndata import AnnData import numpy as np import pandas as pd def example_basic_validation(): """Example 1: Basic validatio...
4e0ec6719ebe6af50f733bcf2d2f11cd81243842a6273aaa2b18e5a7ad417dc6
Python
12,744
402
from abc import abstractmethod from discontinuous_galerkin.base.base_model import BaseModel import numpy as np from attr import dataclass import pdb import matplotlib.pyplot as plt from tqdm import tqdm import ray from scipy.stats import norm from data_assimilation.model_error import BaseModelError from data_assimilat...
2403e95afcb9987cf58974e0f3c65b91a1a641a9893848e0b095808aaa990391
Python
12,747
348
from PIL import Image import numpy as np from ctypes import * import ctypes import copy import torch import torch.nn as nn import torch.nn.functional as F import os import cv2 import time import pdb import socket import pickle import scipy import scipy.ndimage import matplotlib.pyplot as plt from datas...
7fe0405bbc197a1106685e38513f8b292b00039e0892a6b301d8ad900f8dd444
Python
12,747
173
from argparse import ArgumentParser, ArgumentTypeError from ruamel.yaml import YAML import os, sys from pathlib import Path def str2bool(v): if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise Argumen...
b44687ffd4adbda243a5418bb7879b99ef435e2993d51545ca54f549a246ca39
Python
12,749
282
from typing import Optional import os from pathlib import Path import pandas as pd import numpy as np from itertools import permutations, product import scanpy as sc import requests from tqdm.auto import tqdm zipfile_install = False def check_zipfile(): global zipfile_install try: import zipfile ...
0bd8986d669aa8cea05a00d6a58d00761a89dcc6ef3e9f7f59110c6d101b8973
Python
12,750
256
import os import torch import torch.nn as nn from torch.autograd import Variable from torch.utils.data import DataLoader import argparse import time import datetime from torch.utils.tensorboard import SummaryWriter import functools import numpy as np from DWonder.RMBG.utils import FFDrealign4, inv_FFDrealign4 from DWo...
09f9cebae4bc57eaba6e92e559f304d500a11e141dd9026004f7c6ede0ce422f
Python
12,751
346
import logging import os from copy import deepcopy from typing import TYPE_CHECKING, Dict, Optional from packaging import version from ray._private.dict import flatten_dict if TYPE_CHECKING: from mlflow.entities import Run from mlflow.tracking import MlflowClient logger = logging.getLogger(__name__) class...
259bbd24318229d5db0d5a019d38a2917284658859af58a059e6bf9c40aed478
Python
12,763
305
# Copyright 2023 Stanford University Team and 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 # #...
271ed4f2bf350d776f748d9f4b1cdfd5e608032c76c3b9fdbdd3d215a8d099ef
Python
12,768
285
from torch import nn import torch import math class GCL(nn.Module): def __init__(self, input_nf, output_nf, hidden_nf, normalization_factor, aggregation_method, edges_in_d=0, nodes_att_dim=0, act_fn=nn.SiLU(), attention=False): super(GCL, self).__init__() input_edge = input_nf * 2...
54579f0398b1d09a82af60cf7fc84d075f58d0f7bcb53bd2ac2baca4529ae087
Python
12,779
300
import warnings import torch import torch.nn as nn import sinabs.layers as sl from sinabs.layers import NeuromorphicReLU def spiking_hook(self, input_, output): """Forward hook meant for Sinabs/Exodus layers. Calculates n_neurons (scalar), firing_rate_per_neuron (C,H,W) and average firing_rate (scalar). ...
3bd03b980bac097b61301821fad4ba1ba8e2927b0c7d66446fddf06d378762cb
Python
12,783
309
import os import time from typing import Union import bios from FeatureCloud.app.engine.app import AppState, app_state, Role from algo import Coordinator, Client class States: INITIAL = 'initial' # setup the app LOCAL_TRAINING = 'local_training' # train the local model and send it to the coordinator W...
1b5c8aaff9394d05455934163e54c74e98498a214402d63e8a5826ac4b30ad62
Python
12,785
374
import argparse import inspect import os import sys import warnings from importlib import resources from typing import Any, Dict, List, Optional, Union import hydra from colorama import Fore, Style, init from datamate import Namespace, namespacify from hydra.core.global_hydra import GlobalHydra from omegaconf import D...
fa9dc202fefdb43076e594487d8419ef98f386a0a27d757f827290f84a799e8e
Python
12,790
310
import torch import random from sklearn.metrics import accuracy_score, roc_auc_score, confusion_matrix, auc, precision_recall_curve, precision_score import matplotlib.pyplot as plt from torch.utils.data import DataLoader, Dataset import calibration as cal import logging import yaml import os import pandas as pd import ...
5849125b9a5dbae1db45e93a057c824766f1f9a49d3c4a1e6413c29610ed1a08
Python
12,791
377
import numpy import random from scipy import optimize from skimage import filters from stedopt import defaults from stedopt.create import create_microscope class FluorescenceOptimizer(): """ Optimizes the parameters of a fluorophore. """ FACTORS = { "clusters" : 2.25, # CaMKII & PSD95 ...
6ea06bb55f5d89ff2956bd86c98810017e2d8629e09c0f93999f2a94b5b67dc8
Python
12,792
329
import json import logging import os import socket from threading import RLock from filelock import FileLock from ray.autoscaler._private.local.config import ( LOCAL_CLUSTER_NODE_TYPE, bootstrap_local, get_lock_path, get_state_path, ) from ray.autoscaler.node_provider import NodeProvider from ray.auto...
a1593e6c7f7db03247453e0fd299532a323232bfc4f11e65ce2b9f789989c736
Python
12,793
332
# Copyright (c) Facebook, Inc. and its affiliates. # 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...
127f4f12842fd5b4f9a5c77bea0735dcf3df8d3e62c155f121bb06536ed1ea36
Python
12,795
339
# 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 to in writing, software # distributed under th...
80ea4f47587f623e53340c6bb63ac42791b32be0333ec25c6d9ba59c44f2879c
Python
12,796
377
# -*- 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. #...
d6066a68434c43496908b5dd0a2f97ebd4bdc057b0f3834fbd73fb2884c4ee22
Python
12,796
287
# biolgca is a Python package for simulating different kinds of lattice-gas # cellular automata (LGCA) in the biological context. # Copyright (C) 2018-2022 Technische Universität Dresden, Germany. # The full license notice is found in the file lgca/__init__.py. """ Interaction functions and helper functions for identi...
6ab10005d404ca3e0b568fc3f57a529687f3e23ac777d370cf599e1d9936f47b
Python
12,802
298
import sys import os import numpy as np import matplotlib.pylab as plt import matplotlib as mpl import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch.optim as optim import matplotlib.pyplot as plt from torch.utils.data.sampler import SubsetRandomSampler from...
2dbab15d1d734ff592f22ed9a074cb790879c07e48dd30b6bd40c1ad9c92f627
Python
12,814
241
"""SAMPLING ONLY.""" import torch import numpy as np from tqdm import tqdm from functools import partial from stable_diffusion.ldm.modules.diffusionmodules.util import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like, \ extract_into_tensor class DDIMSampler(object): def __init__(self, model, s...
3f2ac12c4804caeaf86bce3b68915219e4fd8aa2ff5ea20c0bd52bc1270d7e4e
Python
12,815
284
# Copyright 2023 Google Brain and 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 requ...
0ebc06272a554620e3620220d457480f4f65f278c5f8c90c3657482142170394
Python
12,817
290
import torch import numpy as np import json class PPM_extraction(): def __init__(self, train_instances, train_key, is_upper, is_lower, is_upper_lower_concat, model_path, input_seq_len, padding_len, kernel_len, ppm_file_name): ''' :param train_instances: BS (posit...
fa83ef40200568879fb2d3c86a6a2637b2fd4c036dc4cafeff02f0260b4affae
Python
12,822
299
#################################################################################################### # 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...
2269586f8692b07fa3af7588ab558c567f9f6f16087633b66f400628043d3c1f
Python
12,827
268
# 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...
fc485fb2071e816adfaf2feb2c11055ae1a39007a46703db87cd4d2f62994614
Python
12,830
349
# -*- 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. #...
2d141374b22f6e9628d52f5d0e9893d7b9bdea1e108dc91386715a403d59f331
Python
12,831
279
#!/usr/bin/env python3 ################################################################################ # -- Preprocessing and analysis of the simulation results ################################################################################ import numpy as np; import pylab as pl; import os, pickle import matplotlib...
7dde41c5a96947546da77b9d1629dcb0d8861599e060ea925d6a91ccf0e1ad16
Python
12,833
431
"""WoRMS (World Register of Marine Species) API client.""" from typing import Dict, List, Optional, Any from .base import BaseAPIClient class WoRMSClient(BaseAPIClient): """Client for WoRMS API - marine species taxonomy.""" def __init__(self): super().__init__( base_url="https://www....
9d0f204c2b31568b4bc93b21f7e6e03f8db0c75da8b0020091ca5eaed52f0c13
Python
12,834
334
#################################################################################################### # Copyright (c) 2021, 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 free softw...
8ecbce6e952dc22320fa9c828e0a9d34d67963af82d8cf4ed7f5685a4ba30a2a
Python
12,837
373
import csv import gzip import json import os from csv import DictWriter, DictReader from csv import reader as csv_reader from pathlib import Path from typing import Iterable from typing import Optional, List import plyvel from . import utils, uniprot from .string import load_upkb_aliases, update_secondaries def par...
8fef62c2ab60e113847fb68dde80eefda603b3b1390fdb8e4cd034267d97033d
Python
12,840
314
#! /usr/bin/env python3 import logging from collections import defaultdict import numpy as np import torch import tqdm from sklearn.preprocessing import StandardScaler, normalize from ..utils import common_functions as c_f from ..utils import stat_utils from ..utils.accuracy_calculator import AccuracyCalculator cl...
dbe252eca4868a61aad6f07c3501ac98afa95c0d61be68bba3531c74e2bdb5aa
Python
12,840
372
import json import logging import os import secrets import subprocess import sys from contextlib import contextmanager from typing import Optional, Tuple import pytest import ray logger = logging.getLogger(__name__) @pytest.fixture def shutdown_only(): yield None # The code after the yield will run as tear...
36097197eaafe951a009db29c3c6b047416ab68f9cc8c2647638a0cddf2195af
Python
12,848
270
""" Context-belief- and/or history-based agent by Aditya Gilra, Sep-Oct-Nov 2021 """ import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import scipy.io as scipyio import scipy.stats import sys from exp_data_analysis import get_exp_reward_around_transition, \ mouse_behaviour_data,mouse_be...
edee19bf7bae695fbccb38db575800158c0c290df97874f09120caf4103379d3
Python
12,848
279
import os import time from subprocess import call import numpy as np import pandas as pd import seaborn as sns from scipy import stats import seaborn as sns import matplotlib.pyplot as plt import scipy as sc from matplotlib.colors import ListedColormap import scipy.sparse as sparse import importlib import copy import ...
c8c9f7db60b5769be1a6b1f8b848551fa212bfa3992703136fef35688b163baf
Python
12,856
318
import cv2 import math import numpy as np import os import queue import threading import torch from basicsr.utils.download_util import load_file_from_url from torch.nn import functional as F ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) class RealESRGANer(): """A helper class for upsampl...
4d1242b538f22a71f3bc24d9e60bdb809114ce38bf4a9f9a162d9430c429f671
Python
12,858
316
import os import torch import torch.utils.model_zoo import torchvision.models as models from src.model.snn import * from src.model.cann import CANN from src.tools.utils import * os.environ['CUDA_VISIBLE_DEVICES'] = "3" device = torch.device('cuda' if torch.cuda.is_available() else "cpu") class MHNN(nn.Module): de...
ebcf74979f4faa41bdca6e73ee6ff445e619e0a6b630a60987bec4aac9d32a38
Python
12,860
352
import numpy as np from collections import Counter from scipy import sparse class BadRegionError(Exception): pass class NotInGenomeError(BadRegionError): pass class Region: @classmethod def read_bedfile(cls, path): regions = [] with open(path, 'r') as f: for line in f: ...
6d2373d33e438dc3df89a95da125feba84e399bd990c362f0276cbce68b7f235
Python
12,863
355
# 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, sof...
5550a98f1489072384c7f7585829ff8ad3e71c04fa16a2998fb4aa508e28bdeb
Python
12,864
292
import numpy as np import pandas as pd from plotnine import * import glob import yaml import pickle import os SAMPLING_COLORS_LIST_10 = ['#c6dbef','#9ecae1', '#99CCCC', '#6baed6','#3182bd', '#08519c', '#8B4513', '#CD853F', '#D2691E', '#DEB887'] ANNO_COLOR_INDV_LIST = ['#3182bd', '#6baed6', ...
98c60987c3ba7dda545ebdc3d64aa5b14503f3c3972dcab934511c5bba19c560
Python
12,864
267
r"""Real measured datasets, for when a demonstration needs data it did not invent. Every function here downloads a **published measurement** and caches it. Nothing is simulated. That distinction is the whole point: a design tool shown only on data generated by its own assumptions has not been shown to work on anything...
a5ee5ad2ece7ed8304342718ebff4ccd02e43fb15bd3b490deafc4d33fefe948
Python
12,864
266
import os import numpy as np import matplotlib.pyplot as plt project_root = "/ccb/cybertron/khchao/splam-analysis-results/" # albation_study_root=f'{project_root}results/albation_study/MODEL/subset_10000/' albation_study_root=f'{project_root}results/albation_study/MODEL/subset_10000/' output_dir = f'{albation_study_ro...
95bac8dc6621898f3dc8719709607246c72e02bfcf08ef74c8077e6d8f0f46f5
Python
12,871
379
# 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...
ebb75bf50478cf1529414b7825f7b08e46f34ea7ff7888511ea38e3727b3bf26
Python
12,872
428
"""WoRMS (World Register of Marine Species) API client.""" from typing import Dict, List, Optional, Any from ..base import BaseAPIClient class WoRMSClient(BaseAPIClient): """Client for WoRMS API - marine species taxonomy.""" def __init__(self): super().__init__( base_url="https://www...
9bd2c2947a18883ac12c3e32dff09652e2627cd43a61b056215ebf95a8f23982
Python
12,881
273
#################################################################################################### # 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...
1ac5369d31e852b9e7a33a6912a18f74f9c3e5a6b85586a171e6b51fd34d6b15
Python
12,882
353
import random from tkinter import W import brainrender as b import numpy as np from brainrender.actors import Point from brainrender import _utils #Find cell coordinates import csv as c file = open("CN_neuron_coordinates_allcells.csv") csvreader = c.reader(file) # Skip first line to get to get to data next(csvreade...
c96bf5c02747754f1cff100e73a8e18404a647fb49a67f19d7c7fa843ab9d217
Python
12,882
292
import numpy as np import torch,os,pickle import time from tqdm import tqdm from torch.nn import DataParallel as DP from mne.io import read_raw_edf np.set_printoptions(suppress=True) import warnings warnings.filterwarnings("ignore") import multiprocessing multiprocessing.set_start_method('spawn', True) im...
ceb642941b1565e34218a2fb07b3666eb3ce7928f0b1a7d73d54dd58d320b0e5
Python
12,885
222
import multiprocessing import os from time import sleep from typing import List, Type, Union import numpy as np from batchgenerators.utilities.file_and_folder_operations import load_json, join, save_json, isfile, maybe_mkdir_p from tqdm import tqdm from nnunetv2.imageio.base_reader_writer import BaseReaderWriter from...
a4d4de00c0f1cde33580111822116bd0ceb9bd38221646f9c9d1cb4f3f97ef86
Python
12,897
338
# 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...
5925911c0260379ce05d84a710d508e7b010a139504722ad405b99b20ac47aa6
Python
12,907
378
''' Train an S4 model on sequential CIFAR10 / sequential MNIST with PyTorch for demonstration purposes. This code borrows heavily from https://github.com/kuangliu/pytorch-cifar. This file only depends on the standalone S4 layer available in /models/s4/ * Train standard sequential CIFAR: python -m example * Train ...
2075906413f30f528a75435fcf0d4f86bbbfd1a66aac046726e8f5804b93b076
Python
12,908
243
from collections import OrderedDict from copy import deepcopy from typing import Union, Tuple, List import numpy as np import torch from batchgenerators.augmentations.utils import resize_segmentation, SEG_TIEBREAKS from scipy.ndimage import map_coordinates from skimage.transform import resize from nnunetv2.configurati...
4c85e41d787f2d5b27353b01fe72e2804b5e513c37b03aecac08d6c2adfa0ede
Python
12,908
343
import functools import logging import sys import time from contextlib import contextmanager def silence_logger(name): """Given a logger name, silence it completely. :param name: name of the logger :type name: str """ package_logger = logging.getLogger(name) package_logger.setLevel(logging.CR...
a673337074f684bdc2132fb87770888131efaf01453a435385c50c628b97acb5
Python
12,913
481
""" This script creates a plot which compares the heading dependent firing rates when numerically simulating equation 8 versus using the analytical derivation in equation 32 of the manuscript. The plot was not ued in the final version of the manuscript. """ import numpy as np import matplotlib import matplotlib.pyplot ...
aaf3198bdcad69da8720d5e5e73ee655105b54cdef8dd03d589209c04e5a39ba
Python
12,913
366
# Copyright (C) 2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import csv import json import uuid from collections import Counter from datetime import datetime, timedelta, timezone from http import HTTPStatus from io import StringIO from time import sleep import pytest im...
b199bd5ec1bea42362d4c76301a12eb14e482662430c6529e654efb3c4b58326
Python
12,913
278
import argparse import pickle from collections import namedtuple from typing import Dict, List, Any, Iterator import numpy as np import torch import lib.data_utils.data_util as du import lib.data_utils.dynamic_data_util as ddu import lib.dataset_config_parser.dataset_config_parser as dcp from denoise_inverse_alg.glm_...
ebeb0a565300e1ac2f82bc32e372c8bccfc30536a17563a5528064c6085f2022
Python
12,917
270
import datetime from datetime import timedelta import torch from tqdm import trange from torch import nn import matplotlib.pyplot as plt import matplotlib.dates as dates from soft_dtw_cuda import SoftDTW import os import pickle from sklearn.metrics import mean_absolute_error, mean_absolute_percentage_error class Early...
7dc8bda6487c30a5c549a4ae5aee091aa54888926b33a0433ab49710b67fec2d
Python
12,919
376
import asyncio import logging import os import shutil import subprocess import sys from datetime import datetime from pathlib import Path from typing import Tuple, Union from ray._private.ray_constants import ( VALID_CPU_PROFILING_FORMATS, VALID_MEMORY_PROFILING_FORMATS, ) logger = logging.getLogger(__name__)...
bee6264a1a4de7b0fc0ac160b9462e3e3ff01519fdf1794f2f95f8da2df75804
Python
12,922
327
"""NCBI BLAST API client.""" import logging import time import xml.etree.ElementTree as ET from typing import Any, Dict, List, Optional from ..base import BaseAPIClient from ...config import settings logger = logging.getLogger(__name__) class BLASTClient(BaseAPIClient): """Client for NCBI BLAST API. ...
38f2af92f9dbc108d1050c8e2c03f4e1a55a2c5de112d62ff0e44f11948e3f3c
Python
12,924
327
"""NCBI BLAST API client.""" import logging import time import xml.etree.ElementTree as ET from typing import Any, Dict, List, Optional from .base import BaseAPIClient from config.config import settings logger = logging.getLogger(__name__) class BLASTClient(BaseAPIClient): """Client for NCBI BLAST API. ...
a954f965c4efefd51a381ea51707f84ccdc2f832801ba98c065eab62d06d1057
Python
12,925
332
r""" This module contains wrapper for the neo Segment, that add extra functionality to the class. Within mozaik the data are stored and passed in this format. Most of the included functionality should in future be provided directly by neo. When this happens most of this code should become irrelevant and the rest shoul...
4197f845cc7bd73c4d15d505e6505276a0a7d7b5493dda971a9c2e058cb68c29
Python
12,927
347
''' Copyright 2023 Tashreque Mohammed Haq 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 ...
cdb3e0984f784102a42dfd3fc02e89ae79e4fcb0164ed6b6639da0db2ee10512
Python
12,929
496
"""Configuration for the package.""" from enum import Enum from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union import yaml from pydantic.v1 import BaseModel, BaseSettings, Field, PrivateAttr def _merge_dictionaries(dict1: dict, dict2: dict) -> dict: """ Recursive merge diction...
938743d77c735bee3b4820a5e28883dad3252dadcf71e8b4e89610827e5e7243
Python
12,932
282
# -*- coding: utf-8 -*- # File : batchnorm.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import collections import torch import torc...
c0a99753042e22ed44e7e97378680eba082d9dca3be142f19a4151542e46d1ea
Python
12,934
411
import logging import os import tempfile from pathlib import Path from time import sleep from typing import Any, Iterable, Literal, Optional, Union import ffmpeg import matplotlib from IPython import display __all__ = ["Animation", "AnimationCollector", "convert"] TESTING = os.getenv("TESTING", "False").lower() == "...
58c342e3c20d0a9c56b8184c97d82acd7dd24250224b6f4bd682e920c1004902
Python
12,941
437
# -*- 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. #...
4dc4d8a09573f214996cb9dd0b6c6063f9fe3c5587df249717e81273e0465454
Python
12,942
363
''' Created on 03.18.2014 @author: Dorjee Tamang ''' import os import tempfile class MethodScores(object): @property def scale_dict(self): return dict(zip(self._dict['residue'], self._dict['score'])) @scale_dict.setter def scale_dict(self, val): self._dict = val ...
0e66e04d049f700833bf52526ab7059a995a45ff54a5a97af3e20a1b85391644
Python
12,945
337
#!/usr/bin/env python3.7 """Defines the Deformable class. The copyrights of this software are owned by Duke University. Please refer to the LICENSE and README.md files for licensing instructions. The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent """ import sys fro...
4764d8730e7635aab67818ee25e5a8ae2e353ae67ac3e90778d95b4d66ee859a
Python
12,948
376
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib as mpl mpl.rcParams['axes.spines.right'] = False mpl.rcParams['axes.spines.top'] = False import seaborn as sns from matplotlib.colors import ListedColormap import matplotlib.pyplot as plt def sort_refs(refs): idx = np.argsort(...